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 pageurl (replace-regexp-in-string "-" "" (file-name-base)))
(setq thedesc (cadar (org-collect-keywords '("OGDESC")))) (setq thedesc (cadar (org-collect-keywords '("OGDESC"))))
(setq thecategory (cadar (org-collect-keywords '("CATEGORY")))) (setq thecategory (cadar (org-collect-keywords '("CATEGORY"))))
(setq tumblrop "")
(setq tumblrop (cadar (org-collect-keywords '("OP"))))
(setq havecomments (if (setq havecomments (if
(string-match (string-match
(cadar (org-collect-keywords '("COMMENTS"))) "t") (cadar (org-collect-keywords '("COMMENTS"))) "t")
@ -63,7 +65,7 @@ holding export options."
(org-html--build-head info) (org-html--build-head info)
(org-html--build-mathjax-config info) (org-html--build-mathjax-config info)
"</head>\n" "</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))) (let ((link-up (org-trim (plist-get info :html-link-up)))
(link-home (org-trim (plist-get info :html-link-home)))) (link-home (org-trim (plist-get info :html-link-home))))
(unless (and (string= link-up "") (string= link-home "")) (unless (and (string= link-up "") (string= link-home ""))
@ -81,26 +83,14 @@ holding export options."
(plist-get info :html-content-class))) (plist-get info :html-content-class)))
"<section>\n" "<section>\n"
;; Document title. ;; Document title.
(when (plist-get info :with-title) (if (string-match "tumblr" thecategory)
(let ((title (and (plist-get info :with-title) (concat "<h1 class=\"p-name\">" tumblrop " on tumblr said: “" thetitle "”</h1>\n")
(plist-get info :title))) (concat "<h1 class=\"p-name\">" thetitle "</h1>\n"))
(subtitle (plist-get info :subtitle)) (when (string-match "tumblr" thecategory)
(html5-fancy (org-html--html5-fancy-p info))) (concat "<p id=\"theop\">" tumblrop "</p>\n"))
(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))
"")))))
"<p class=\"date\"><time class=\"dt-published\" datetime=\"" (file-name-base) " 00:00:00\">" (file-name-base) "</time></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" "<div class=\"e-content\">\n"
contents contents
"</div>\n" "</div>\n"

File diff suppressed because one or more lines are too long