From 5a37d07c06b3fbcf9b486aa27f96ec5b4c630762 Mon Sep 17 00:00:00 2001 From: Yuchen Pei Date: Mon, 2 Oct 2023 18:51:11 +1100 Subject: fix html export style - custom_id for better anchors. - no postamble --- bom.el | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/bom.el b/bom.el index 8831ad3..e9a44f7 100644 --- a/bom.el +++ b/bom.el @@ -56,9 +56,6 @@ (defvar bom-areas nil "List of areas with forecasts.") -(defvar bom-area-hierarchy (hierarchy-new) - "Hierarchy of areas with forecasts.") - (defvar bom-server nil "The BOM server object.") (defun bom-area-parent (area) @@ -71,11 +68,21 @@ Used as parentfn for hierarchy." (equal (dom-attr area 'aac) parent-aac)) bom-areas))) +(defun bom-hyphenate-downcase (name) + "Downcase NAME and replace all space with hyphens." + (replace-regexp-in-string " " "-" (downcase name))) + (defun bom-format-area (area level) "Format an AREA of LEVEL." - (format "%s %s%s\n" + (format "%s %s +:PROPERTIES: +:CUSTOM_ID: %s +:END: +%s +" (make-string level ?*) (dom-attr area 'description) + (bom-hyphenate-downcase (dom-attr area 'description)) (if (dom-children area) (concat "\n" (bom-format-forecasts (dom-children area))) ""))) @@ -125,7 +132,8 @@ We use the description of the first root as the state name." "Export org string S to html and return the html string." (with-temp-buffer (insert s) - (org-export-as 'html))) + (let ((org-html-postamble)) + (org-export-as 'html)))) (defun bom-format-areas-html (areas) "Format hierarchy of AREAS with forecasts to html." -- cgit v1.2.3