Allow tumblr-style posts

This commit is contained in:
mez 2025-05-18 15:16:44 +01:00
parent 585f05ccce
commit a39b0cb445
2 changed files with 17 additions and 22 deletions

View file

@ -21,6 +21,8 @@
(setq pageurl (replace-regexp-in-string "-" "" (file-name-base)))
(setq thedesc (cadar (org-collect-keywords '("OGDESC"))))
(setq thecategory (cadar (org-collect-keywords '("CATEGORY"))))
(setq tumblrop "")
(setq tumblrop (cadar (org-collect-keywords '("OP"))))
(setq havecomments (if
(string-match
(cadar (org-collect-keywords '("COMMENTS"))) "t")
@ -63,7 +65,7 @@ holding export options."
(org-html--build-head info)
(org-html--build-mathjax-config info)
"</head>\n"
"<body>\n"
"<body class=\"" (subst-char-in-string (string-to-char " ") ?- thecategory) "\">\n"
(let ((link-up (org-trim (plist-get info :html-link-up)))
(link-home (org-trim (plist-get info :html-link-home))))
(unless (and (string= link-up "") (string= link-home ""))
@ -81,26 +83,14 @@ holding export options."
(plist-get info :html-content-class)))
"<section>\n"
;; Document title.
(when (plist-get info :with-title)
(let ((title (and (plist-get info :with-title)
(plist-get info :title)))
(subtitle (plist-get info :subtitle))
(html5-fancy (org-html--html5-fancy-p info)))
(when title
(format
(if html5-fancy
"<header>\n<h1 class=\"p-name\">%s</h1>\n%s</header>"
"<h1 class=\"p-name\">%s%s</h1>\n")
(org-export-data title info)
(if subtitle
(format
(if html5-fancy
"<p class=\"subtitle\" role=\"doc-subtitle\">%s</p>\n"
(concat "\n" (org-html-close-tag "br" nil info) "\n"
"<span class=\"subtitle\">%s</span>\n"))
(org-export-data subtitle info))
"")))))
(if (string-match "tumblr" thecategory)
(concat "<h1 class=\"p-name\">" tumblrop " on tumblr said: “" thetitle "”</h1>\n")
(concat "<h1 class=\"p-name\">" thetitle "</h1>\n"))
(when (string-match "tumblr" thecategory)
(concat "<p id=\"theop\">" tumblrop "</p>\n"))
"<p class=\"date\"><time class=\"dt-published\" datetime=\"" (file-name-base) " 00:00:00\">" (file-name-base) "</time></p>\n"
(when (string-match "tumblr" thecategory)
(concat "<p id=\"ogpost\">" thetitle "</p>\n"))
"<div class=\"e-content\">\n"
contents
"</div>\n"

File diff suppressed because one or more lines are too long