worgtest-init.el 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195
  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=\"SHORTCUT ICON\" href=\"/org-mode-unicorn.ico\" type=\"image/x-icon\" />
  62. <link rel=\"icon\" href=\"/org-mode-unicorn.ico\" type=\"image/ico\" />"
  63. :recursive t
  64. :html-preamble ,(org-get-file-contents (concat worg-base "preamble.html"))
  65. :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>"
  66. )
  67. ("worg-pages"
  68. :base-directory ,worg-base-directory
  69. :base-extension "org"
  70. :exclude "FIXME"
  71. :makeindex t
  72. :auto-sitemap nil
  73. :sitemap-ignore-case t
  74. :html-extension "html"
  75. :publishing-directory ,worg-publish-directory
  76. :publishing-function (org-html-publish-to-html)
  77. :htmlized-source nil
  78. :section-numbers nil
  79. :table-of-contents nil
  80. :style "<link rel=\"stylesheet\" title=\"Standard\" href=\"/worg/style/worg.css\" type=\"text/css\" />
  81. <link rel=\"alternate stylesheet\" title=\"Zenburn\" href=\"/worg/style/worg-zenburn.css\" type=\"text/css\" />
  82. <link rel=\"alternate stylesheet\" title=\"Classic\" href=\"/worg/style/worg-classic.css\" type=\"text/css\" />
  83. <link rel=\"stylesheet\" href=\"https://orgmode.org/css/lightbox.css\" type=\"text/css\" media=\"screen\" />
  84. <link rel=\"SHORTCUT ICON\" href=\"/org-mode-unicorn.ico\" type=\"image/x-icon\" />
  85. <link rel=\"icon\" href=\"/org-mode-unicorn.ico\" type=\"image/ico\" />"
  86. :recursive t
  87. :html-preamble ,(org-get-file-contents (concat worg-base "preamble.html"))
  88. :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>"
  89. )
  90. ("worg-code"
  91. :base-directory ,worg-base-code-directory
  92. :base-extension "html\\|css\\|png\\|js\\|bz2\\|el\\|sty\\|awk\\|pl"
  93. :html-extension "html"
  94. :publishing-directory ,(concat worg-htmlroot "/code/")
  95. :recursive t
  96. :publishing-function org-publish-attachment)
  97. ("worg-color-themes"
  98. :base-directory ,worg-base-color-themes-directory
  99. :base-extension "el"
  100. :html-extension "html"
  101. :publishing-directory ,(concat worg-htmlroot "/code/elisp/")
  102. :recursive t
  103. :publishing-function org-publish-attachment)
  104. ("worg-images-dir"
  105. :base-directory ,worg-base-images-directory
  106. :base-extension "png\\|jpg\\|gif\\|pdf\\|cvs\\|css"
  107. :publishing-directory ,(concat worg-htmlroot "/images/")
  108. :recursive t
  109. :publishing-function org-publish-attachment)
  110. ("worg-images"
  111. :base-directory ,worg-base-directory
  112. :base-extension "png\\|jpg\\|gif\\|pdf\\|csv\\|css\\|tex"
  113. :publishing-directory ,worg-publish-directory
  114. :recursive t
  115. :publishing-function org-publish-attachment)
  116. ("worg-sources"
  117. :base-directory ,worg-base-directory
  118. :base-extension "org"
  119. :publishing-directory ,(concat worg-htmlroot "/sources/")
  120. :recursive t
  121. :publishing-function org-publish-attachment)
  122. ("worg-extra"
  123. :base-directory ,worg-base-directory
  124. :base-extension "css"
  125. :publishing-directory ,worg-publish-directory
  126. :publishing-function org-publish-attachment)
  127. ("worg-bibtex"
  128. :base-directory ,(concat worg-base "org-contrib/bibtex/")
  129. :base-extension "bib"
  130. :publishing-directory ,(concat worg-htmlroot "/org-contrib/bibtex/")
  131. :recursive nil
  132. :publishing-function org-publish-attachment)
  133. )))
  134. (setq worg-base-directory worg-base)
  135. (setq worg-base-code-directory (concat worg-base "code/"))
  136. (setq worg-base-color-themes-directory (concat worg-base "code/elisp/"))
  137. (setq worg-base-images-directory (concat worg-base "images/"))
  138. (setq worg-publish-directory worg-htmlroot)
  139. (set-org-publish-project-alist)
  140. (defun worg-fix-symbol-table ()
  141. (when (string-match "org-symbols\\.html" buffer-file-name)
  142. (goto-char (point-min))
  143. (while (re-search-forward "<td>&amp;\\([^<;]+;\\)" nil t)
  144. (replace-match (concat "<td>&" (match-string 1)) t t))))
  145. (defun publish-worg-old nil
  146. "Publish Worg."
  147. (interactive)
  148. (add-hook 'org-publish-after-export-hook 'worg-fix-symbol-table)
  149. (let ((org-format-latex-signal-error nil)
  150. (worg-base-directory worg-base)
  151. (worg-base-code-directory (concat worg-base "code/"))
  152. (worg-base-color-themes-directory (concat worg-base "code/elisp/"))
  153. (worg-base-images-directory (concat worg-base "images/"))
  154. (worg-publish-directory worg-htmlroot))
  155. (set-org-publish-project-alist)
  156. (org-publish-project "worg")))
  157. (defun publish-worg nil
  158. "Publish Worg."
  159. (interactive)
  160. (add-hook 'org-publish-after-export-hook 'worg-fix-symbol-table)
  161. (let ((org-format-latex-signal-error nil)
  162. (worg-base-directory worg-base)
  163. (worg-base-code-directory (concat worg-base "code/"))
  164. (worg-base-color-themes-directory (concat worg-base "code/elisp/"))
  165. (worg-base-images-directory (concat worg-base "images/"))
  166. (worg-publish-directory worg-htmlroot))
  167. (set-org-publish-project-alist)
  168. (message "Emacs %s" emacs-version)
  169. (org-version)
  170. (org-publish-project "worg")))
  171. (defun parse-org-quotes ()
  172. "Create ~/orgmode.org/org-quotes.js from org-quotes.org."
  173. (interactive)
  174. (load (concat worg-base "code/elisp/worg-fortune.el"))
  175. (worg-write-fortune-file
  176. (concat worg-base "org-quotes.org")
  177. "~/orgmode.org/org-quotes.js"
  178. 120
  179. "r_text[%d] = \"%s\";" "\n"
  180. 'worg-fortune-insert-javascript-pre
  181. 'worg-fortune-insert-javascript-post))