summaryrefslogtreecommitdiff
path: root/repo/www/preprocess-org.el
blob: f7be9360a9fb6df58f4cbd26d195e6d9651756b6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
(defun preprocess-org (input)
  (with-temp-buffer
    (insert-file-contents input)
    (org-mode)
    (while (re-search-forward org-heading-regexp nil t)
      (save-excursion
        (save-match-data
          (when-let ((tags (org-get-tags (point))))
            (insert "\n#+begin_tags\n")
            (dolist (tag tags)
              (insert "- " tag "\n"))
            (insert "#+end_tags\n")))))
  (let ((org-export-with-properties t)
        (org-export-with-section-numbers nil)
        (org-export-with-sub-superscripts '{})
        (org-export-with-tags nil)
        (org-export-with-title nil)
        (org-export-with-toc nil))
    (org-md-export-as-markdown))    
  (princ (buffer-string))))