-
Notifications
You must be signed in to change notification settings - Fork 0
/
publish.el
109 lines (84 loc) · 3.59 KB
/
publish.el
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
;; publish.el --- Publish runcom on Gitlab Pages
;; Author: Pradyumna Paranjape
;;; Commentary:
;; This script will tangle and export org mode files to executables and
;; html pages.
;;; Code:
;; Org mode and melpa repos
(when (getenv "CI_PAGES_URL")
(require 'package)
(package-initialize)
(add-to-list
'package-archives '("elpa" . "https://elpa.gnu.org/packages/" ) t)
(add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/") t)
(package-refresh-contents)
(package-install 'htmlize)
(setq user-full-name "Pradyumna Paranjape"))
;; org mode
(require 'org)
(require 'ox-publish)
(require 'ox-html)
(setq org-confirm-babel-evaluate nil)
(setq org-html-head-include-default-style nil)
(setq org-html-head "
<link rel=\"stylesheet\" href=\"https://cdn.datatables.net/1.10.22/css/jquery.dataTables.min.css\">
<link rel=\"stylesheet\" type=\"text/css\" href=\"https://fniessen.github.io/org-html-themes/src/readtheorg_theme/css/htmlize.css\"/>
<link rel=\"stylesheet\" type=\"text/css\" href=\"https://fniessen.github.io/org-html-themes/src/readtheorg_theme/css/readtheorg.css\"/>
<script src=\"https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js\"></script>
<script src=\"https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js\"></script>
<script type=\"text/javascript\" src=\"https://fniessen.github.io/org-html-themes/src/lib/js/jquery.stickytableheaders.min.js\"></script>
<script type=\"text/javascript\" src=\"https://fniessen.github.io/org-html-themes/src/readtheorg_theme/js/readtheorg.js\"></script>
<style>pre.src{background:#343131;color:white;} </style>
<script src=\"https://cdnjs.cloudflare.com/ajax/libs/jquery/3.5.1/jquery.min.js\"></script>
<script src=\"https://cdn.datatables.net/1.10.22/js/jquery.dataTables.min.js\"></script>
<script> $(\"table\").DataTable(); </script>
")
(defun org-man-publish-to-man (plist filename pub-dir)
"Publish an org file to MAN-PAGE.
FILENAME is the filename of the Org file to be published. PLIST
is the property list for the given project. PUB-DIR is the
publishing directory.
Return output file name."
(let* ((org-section (or (plist-get plist :section-id) "1"))
(man-dir (format "%s/man%s" pub-dir org-section)))
(org-publish-org-to 'man filename
(concat "." org-section)
plist man-dir)))
(setq org-publish-project-alist
'(("prady-shell-scripts-manual"
:base-directory "./org"
:base-extension "org"
:publishing-directory "pss/share/man/"
:exclude "((.*private.*)|(.*sitemap.*))"
:publishing-function org-man-publish-to-man
:recursive t
:headline-levels 4
:auto-preamble t)
("runcom"
:base-directory "./org"
:base-extension "org"
:publishing-directory "docs/"
:publishing-function org-html-publish-to-html
:recursive t
:auto-sitemap t
:auto-preamble t)
("org-static"
:base-directory "./"
:base-extension
"css\\|js\\|svg\\|png\\|jpg\\|gif\\|pdf\\|mp3\\|ogg\\|swf"
:publishing-directory "docs/"
:publishing-function org-publish-attachment
:recursive t)
("org" :components ("runcom" "org-static"))))
(defun tangle-runcom ()
(mkdir "docs/share/man" t)
(dolist (litorg (directory-files "." nil ".org"))
(org-babel-tangle-file (format "%s" litorg)))
(org-publish "runcom-manual" t))
(defun runcom/publish-pages ()
"Publish everything"
(mkdir "docs/" t)
(org-publish "org" t))
(unless (getenv "CI_PAGES_URL")
(runcom/publish-pages)
(tangle-runcom))