worgtest-init.el 8.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192
  1. (mapc (lambda (e)
  2. (add-to-list 'load-path e))
  3. worg-add-load-path)
  4. (require 'org)
  5. (require 'htmlize)
  6. ;; to have things work correctly in batch-mode
  7. (require 'font-lock)
  8. (require 'cc-mode)
  9. (c-after-font-lock-init)
  10. (custom-set-variables
  11. ;; custom-set-variables was added by Custom.
  12. ;; If you edit it by hand, you could mess it up, so be careful.
  13. ;; Your init file should contain only one such instance.
  14. ;; If there is more than one, they won't work right.
  15. '(org-modules (quote (org-jsinfo)))
  16. '(safe-local-variable-values (quote ((org-tags-column . -80) (org-export-latex-image-default-option . "width=30em") (org-html-head . "<link rel=\"stylesheet\" type=\"text/css\" href=\"stylesheet.css\" />") (org-html-head-extra . "<link rel=stylesheet href=\"org-faq.css\" type=\"text/css\"> <style type=\"text/css\"> </style>") (org-export-publishing-directory . "tmp") (org-html-head . "<link rel=stylesheet href=\"freeshell2.css\" type=\"text/css\"> <style type=\"text/css\"> .tag { color: red; font-weight:bold}</style>")))))
  17. (show-paren-mode 1)
  18. (menu-bar-mode 0)
  19. (set-face-foreground 'font-lock-keyword-face "DeepSkyBlue1")
  20. (set-face-foreground 'font-lock-string-face "pale goldenrod")
  21. (setq make-backup-files nil
  22. vc-handled-backends nil)
  23. (setq org-export-default-language "en"
  24. org-export-html-extension "html"
  25. org-export-with-timestamps nil
  26. org-export-with-section-numbers nil
  27. org-export-with-tags 'not-in-toc
  28. org-export-skip-text-before-1st-heading nil
  29. org-export-with-sub-superscripts '{}
  30. org-export-with-LaTeX-fragments t
  31. org-export-with-archived-trees nil
  32. org-export-highlight-first-table-line t
  33. org-export-latex-listings-w-names nil
  34. org-export-html-style-include-default nil
  35. org-export-htmlize-output-type 'css
  36. org-startup-folded nil
  37. org-export-allow-BIND t
  38. org-publish-list-skipped-files t
  39. org-publish-use-timestamps-flag t
  40. org-export-babel-evaluate nil
  41. org-confirm-babel-evaluate nil)
  42. ;; re-export everything regardless of whether or not it's been modified
  43. (setq org-publish-use-timestamps-flag nil)
  44. (defun set-org-publish-project-alist ()
  45. (interactive)
  46. (setq org-publish-project-alist
  47. `(("worg" :components ("worg-org-faq" "worg-pages" "worg-code" "worg-color-themes" "worg-images-dir" "worg-images" "worg-sources" "worg-extra" "worg-bibtex"))
  48. ("worg-org-faq"
  49. :base-directory ,worg-base-directory
  50. :base-extension "dummy"
  51. :include ("org-faq.org")
  52. :html-extension "html"
  53. :publishing-directory ,worg-publish-directory
  54. :publishing-function org-html-publish-to-html
  55. :section-numbers nil
  56. :table-of-contents nil
  57. :style "<link rel=\"stylesheet\" title=\"Standard\" href=\"/worg/style/worg.css\" type=\"text/css\" />
  58. <link rel=\"alternate stylesheet\" title=\"Zenburn\" href=\"/worg/style/worg-zenburn.css\" type=\"text/css\" />
  59. <link rel=\"alternate stylesheet\" title=\"Classic\" href=\"/worg/style/worg-classic.css\" type=\"text/css\" />
  60. <link rel=\"stylesheet\" href=\"https://orgmode.org/css/lightbox.css\" type=\"text/css\" media=\"screen\" />
  61. <link rel=\"icon\" href=\"/favicon.ico\" type=\"image/x-icon\" />"
  62. :recursive t
  63. :html-preamble ,(org-get-file-contents (concat worg-base "preamble.html"))
  64. :html-postamble "<div id=\"show_source\"><input type=\"button\" value=\"Show Org source\" onClick='show_org_source()'></div><div id=\"license\"><p>Documentation from the https://orgmode.org/worg/ website (either in its HTML format or in its Org format) is licensed under the <a href=\"http://www.gnu.org/copyleft/fdl.html\">GNU Free Documentation License version 1.3</a> or later. The code examples and css stylesheets are licensed under the <a href=\"http://www.gnu.org/licenses/gpl.html\">GNU General Public License v3</a> or later.</p></div>"
  65. )
  66. ("worg-pages"
  67. :base-directory ,worg-base-directory
  68. :base-extension "org"
  69. :exclude "FIXME"
  70. :makeindex t
  71. :auto-sitemap nil
  72. :sitemap-ignore-case t
  73. :html-extension "html"
  74. :publishing-directory ,worg-publish-directory
  75. :publishing-function (org-html-publish-to-html)
  76. :htmlized-source nil
  77. :section-numbers nil
  78. :table-of-contents nil
  79. :style "<link rel=\"stylesheet\" title=\"Standard\" href=\"/worg/style/worg.css\" type=\"text/css\" />
  80. <link rel=\"alternate stylesheet\" title=\"Zenburn\" href=\"/worg/style/worg-zenburn.css\" type=\"text/css\" />
  81. <link rel=\"alternate stylesheet\" title=\"Classic\" href=\"/worg/style/worg-classic.css\" type=\"text/css\" />
  82. <link rel=\"stylesheet\" href=\"https://orgmode.org/css/lightbox.css\" type=\"text/css\" media=\"screen\" />
  83. <link rel=\"icon\" href=\"/favicon.ico\" type=\"image/x-icon\" />"
  84. :recursive t
  85. :html-preamble ,(org-get-file-contents (concat worg-base "preamble.html"))
  86. :html-postamble "<div id=\"show_source\"><input type=\"button\" value=\"Show Org source\" onClick='show_org_source()'></div><div id=\"license\"><p>Documentation from the https://orgmode.org/worg/ website (either in its HTML format or in its Org format) is licensed under the <a href=\"http://www.gnu.org/copyleft/fdl.html\">GNU Free Documentation License version 1.3</a> or later. The code examples and css stylesheets are licensed under the <a href=\"http://www.gnu.org/licenses/gpl.html\">GNU General Public License v3</a> or later.</p></div>"
  87. )
  88. ("worg-code"
  89. :base-directory ,worg-base-code-directory
  90. :base-extension "html\\|css\\|png\\|js\\|bz2\\|el\\|sty\\|awk\\|pl"
  91. :html-extension "html"
  92. :publishing-directory ,(concat worg-htmlroot "/code/")
  93. :recursive t
  94. :publishing-function org-publish-attachment)
  95. ("worg-color-themes"
  96. :base-directory ,worg-base-color-themes-directory
  97. :base-extension "el"
  98. :html-extension "html"
  99. :publishing-directory ,(concat worg-htmlroot "/code/elisp/")
  100. :recursive t
  101. :publishing-function org-publish-attachment)
  102. ("worg-images-dir"
  103. :base-directory ,worg-base-images-directory
  104. :base-extension "png\\|jpg\\|gif\\|pdf\\|cvs\\|css"
  105. :publishing-directory ,(concat worg-htmlroot "/images/")
  106. :recursive t
  107. :publishing-function org-publish-attachment)
  108. ("worg-images"
  109. :base-directory ,worg-base-directory
  110. :base-extension "png\\|jpg\\|gif\\|pdf\\|csv\\|css\\|tex"
  111. :publishing-directory ,worg-publish-directory
  112. :recursive t
  113. :publishing-function org-publish-attachment)
  114. ("worg-sources"
  115. :base-directory ,worg-base-directory
  116. :base-extension "org"
  117. :publishing-directory ,(concat worg-htmlroot "/sources/")
  118. :recursive t
  119. :publishing-function org-publish-attachment)
  120. ("worg-extra"
  121. :base-directory ,worg-base-directory
  122. :base-extension "css"
  123. :publishing-directory ,worg-publish-directory
  124. :publishing-function org-publish-attachment)
  125. ("worg-bibtex"
  126. :base-directory ,(concat worg-base "org-contrib/bibtex/")
  127. :base-extension "bib"
  128. :publishing-directory ,(concat worg-htmlroot "/org-contrib/bibtex/")
  129. :recursive nil
  130. :publishing-function org-publish-attachment)
  131. )))
  132. (setq worg-base-directory worg-base)
  133. (setq worg-base-code-directory (concat worg-base "code/"))
  134. (setq worg-base-color-themes-directory (concat worg-base "code/elisp/"))
  135. (setq worg-base-images-directory (concat worg-base "images/"))
  136. (setq worg-publish-directory worg-htmlroot)
  137. (set-org-publish-project-alist)
  138. (defun worg-fix-symbol-table ()
  139. (when (string-match "org-symbols\\.html" buffer-file-name)
  140. (goto-char (point-min))
  141. (while (re-search-forward "<td>&amp;\\([^<;]+;\\)" nil t)
  142. (replace-match (concat "<td>&" (match-string 1)) t t))))
  143. (defun publish-worg-old nil
  144. "Publish Worg."
  145. (interactive)
  146. (add-hook 'org-publish-after-export-hook 'worg-fix-symbol-table)
  147. (let ((org-format-latex-signal-error nil)
  148. (worg-base-directory worg-base)
  149. (worg-base-code-directory (concat worg-base "code/"))
  150. (worg-base-color-themes-directory (concat worg-base "code/elisp/"))
  151. (worg-base-images-directory (concat worg-base "images/"))
  152. (worg-publish-directory worg-htmlroot))
  153. (set-org-publish-project-alist)
  154. (org-publish-project "worg")))
  155. (defun publish-worg nil
  156. "Publish Worg."
  157. (interactive)
  158. (add-hook 'org-publish-after-export-hook 'worg-fix-symbol-table)
  159. (let ((org-format-latex-signal-error nil)
  160. (worg-base-directory worg-base)
  161. (worg-base-code-directory (concat worg-base "code/"))
  162. (worg-base-color-themes-directory (concat worg-base "code/elisp/"))
  163. (worg-base-images-directory (concat worg-base "images/"))
  164. (worg-publish-directory worg-htmlroot))
  165. (set-org-publish-project-alist)
  166. (message "Emacs %s" emacs-version)
  167. (org-version)
  168. (org-publish-project "worg")))
  169. (defun parse-org-quotes ()
  170. "Create ~/orgmode.org/org-quotes.js from org-quotes.org."
  171. (interactive)
  172. (load (concat worg-base "code/elisp/worg-fortune.el"))
  173. (worg-write-fortune-file
  174. (concat worg-base "org-quotes.org")
  175. "~/orgmode.org/org-quotes.js"
  176. 120
  177. "r_text[%d] = \"%s\";" "\n"
  178. 'worg-fortune-insert-javascript-pre
  179. 'worg-fortune-insert-javascript-post))