aboutsummaryrefslogtreecommitdiff
path: root/bom.el
diff options
context:
space:
mode:
Diffstat (limited to 'bom.el')
-rw-r--r--bom.el18
1 files 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."