diff options
Diffstat (limited to 'shittyweb-html.el')
-rw-r--r-- | shittyweb-html.el | 62 |
1 files changed, 26 insertions, 36 deletions
diff --git a/shittyweb-html.el b/shittyweb-html.el index c83ec50..dc1e654 100644 --- a/shittyweb-html.el +++ b/shittyweb-html.el @@ -4,13 +4,6 @@ ;; https://github.com/grc/jujutsu-website/blob/master/elisp/org-jujutsu-site.el ;; https://orgmode.org/worg/dev/org-export-reference.html -(defvar shittyweb-html-background-color "#dcd1ba") -(defvar shittyweb-html-table-background-color "#bebebe") -(defvar shittyweb-html-table-border 1) -(defvar shittyweb-html-table-width "65%") -(defvar shittyweb-html-code-background-color "white") -(defvar shittyweb-html-code-border 1) - (org-export-define-derived-backend 'shittyweb-html 'html :translate-alist '((template . shittyweb-html-template) (src-block . shittyweb-html-src-block)) @@ -50,38 +43,37 @@ holding export options." (org-html--build-meta-info info) (org-html--build-head info) (org-html--build-mathjax-config info) - "</head>\n" - ;; Body with background + ;; Background (let ((background (plist-get info :background-image))) (if background - (format "<body bgcolor=\"%s\" background=\"%s\">\n" - shittyweb-html-background-color - background) - (format "<body bgcolor=\"%s\">" - shittyweb-html-background-color))) + (format "<style type=\"text/css\">\n\ +body { background-image: url(\"%s\"); }\n\ +</style>" + background))) + "</head>\n" + "<body>\n" ;; I dont use link-up so byebye it goes. ;; Also I give it a directory instead of file. - (let ((link-home (org-trim (plist-get info :html-link-home)))) + ;; Also has a back thingy added. + (let ((link-home (org-trim (plist-get info :html-link-home))) + (back-page (org-trim (plist-get info :shittyweb-back)))) (unless (string= link-home "") - (format (plist-get info :html-home/up-format) link-home link-home))) - ;; The back button thingy - (let ((back-page (org-trim (plist-get info :shittyweb-back)))) - (unless (string= back-page "") - back-page)) - ;; Preamble. - (org-html--build-pre/postamble 'preamble info) - "\n<center>\n" - ;; Shittyweb header. Its outside the weird table thing. + (format (plist-get info :html-home/up-format) + link-home link-home + (if (string= back-page "") + "" + back-page)))) + ;; Shittyweb header. Its outside the thingy. (let ((shittyweb-header (plist-get info :shittyweb-header))) (if shittyweb-header - shittyweb-header)) + (format "<div class=\"shittyweb-header\">\n%s\n</div>" + shittyweb-header))) + ;; Preamble. + (org-html--build-pre/postamble 'preamble info) ;; Document contents. (let ((div (assq 'content (plist-get info :html-divs)))) - (format "<table border=\"%d\" width=\"%s\" bgcolor=\"%s\" id=\ -\"%s\" class=\"%s\"><tr><td>\n" - shittyweb-html-table-border - shittyweb-html-table-width - shittyweb-html-table-background-color + (format "<%s id=\"%s\" class=\"%s\">\n" + (nth 1 div) (nth 2 div) (plist-get info :html-content-class))) ;; Document title. @@ -105,7 +97,7 @@ holding export options." (org-export-data subtitle info)) ""))))) contents - "</td></tr></table>\n" + (format "</%s>\n" (nth 1 (assq 'content (plist-get info :html-divs)))) ;; Postamble. (org-html--build-pre/postamble 'postamble info) ;; Possibly use the Klipse library live code blocks. @@ -116,7 +108,7 @@ holding export options." "\"></script><link rel=\"stylesheet\" type=\"text/css\" href=\"" org-html-klipse-css "\"/>")) ;; Closing document. - "</center>\n</body>\n</html>")) + "</body>\n</html>")) ;; I don't like the way it handles src blocks. I just want <code>. (defun shittyweb-html-src-block (src-block _contents info) @@ -127,10 +119,8 @@ holding export options." (if (cdr lines) (concat "<br />\n" (join-code-lines (cdr lines))) ""))) - (format "<table bgcolor=\"%s\" border=\"%d\"><tr><td>\n\ -<code>\n%s\n</code>\n</td></tr></table>" - shittyweb-html-code-background-color - shittyweb-html-code-border + (format "\n\ +<div class=\"org-src-container\"><code>\n%s\n</code></div>\n" (join-code-lines code-lines)))) (defun shittyweb-publish-to-html (plist filename pub-dir) |