-
Notifications
You must be signed in to change notification settings - Fork 131
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Generate README, CONTRIBUTE, Wiki pages from ox-hugo-manual.org
See ox-hugo-export-gh-doc function in doc/export-gh-doc.el
- Loading branch information
1 parent
0dd01f2
commit 60daaee
Showing
6 changed files
with
323 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
[submodule "doc/ox-hugo.wiki"] | ||
path = doc/ox-hugo.wiki | ||
url = https://github.com/kaushalmodi/ox-hugo.wiki.git |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
;; Time-stamp: <2017-08-08 12:20:38 kmodi> | ||
|
||
;; Helper function to export Org documentation to GitHub repo Wiki pages | ||
|
||
(defun ox-hugo-export-gh-doc () | ||
"Export `ox-hugo' Org documentation to documentation on GitHub repo." | ||
(interactive) | ||
(let* ((ox-hugo-root-dir (cdr (project-current))) ;Requires emacs 25.1 | ||
(ox-hugo-doc-dir (concat ox-hugo-root-dir "doc/")) | ||
(ox-hugo-org-file (expand-file-name "ox-hugo-manual.org" ox-hugo-doc-dir)) | ||
;; cd doc/ | ||
;; git clone https://github.com/kaushalmodi/ox-hugo.wiki.git | ||
(ox-hugo-wiki-dir (concat ox-hugo-doc-dir "ox-hugo.wiki/")) | ||
(org-src-preserve-indentation t) ;Preserve the leading whitespace in src blocks | ||
(org-id-track-globally nil) ;Prevent "Could not read org-id-values .." error | ||
(org-export-with-sub-superscripts '{}) | ||
(org-export-with-smart-quotes t) | ||
(org-export-headline-levels 4) | ||
(org-src-fontify-natively t)) | ||
(if (file-exists-p ox-hugo-wiki-dir) | ||
(let ((subtree-tags-to-export '("readme" "contributing" "wiki")) | ||
;; If a subtree matches a tag, do not try to export further | ||
;; subtrees separately that could be under that. | ||
(org-use-tag-inheritance nil) | ||
(org-export-time-stamp-file nil) ;Do not print "Created <timestamp>" in exported files | ||
(org-export-with-toc nil) ;Do not export TOC | ||
(org-export-with-tags nil)) ;Do not print tag names in exported files | ||
(dolist (tag subtree-tags-to-export) | ||
(let* ((exported-file-list (org-map-entries '(org-org-export-to-org nil :subtreep) tag))) | ||
;; Move files to their correct directories | ||
(cond | ||
((or (string= "readme" tag) | ||
(string= "contributing" tag)) | ||
(dolist (exported-file exported-file-list) | ||
(rename-file (expand-file-name exported-file ox-hugo-doc-dir) | ||
(expand-file-name exported-file ox-hugo-root-dir) | ||
:ok-if-already-exists))) | ||
((string= "wiki" tag) | ||
(dolist (exported-file exported-file-list) | ||
(rename-file (expand-file-name exported-file ox-hugo-doc-dir) | ||
(expand-file-name exported-file ox-hugo-wiki-dir) | ||
:ok-if-already-exists))))))) | ||
(user-error (concat "ox-hugo.wiki dir does not exist. " | ||
"You need to `cd doc/' and " | ||
"`git clone https://github.com/kaushalmodi/ox-hugo.wiki.git'"))))) |
Oops, something went wrong.