Sequence function call for site Sequence function call for post Descrizione funzioni
Home
Descrizione
Questo tutorial vuole essere una guida per il file publish.el
I diagrammi UML sono stati realizzati con plantuml e qui trovate alcuni esempi.
L’utente avvia il file build.bat op. build.sh a seconda del sistema operativo in uso richiamando la funzione utente duncan-publish-all che a sua volta richiamala funzione nativa org-publish-all iniziando l’esportazione delle varie parti del sito secondo l’ordine indicato nella variabile duncan–publish-project-alist.
Blog
Funzioni
duncan–publish-project-alist
Imposta in una lista le ozioni di pubblicazioni per le varie parti del sito
1: defvar duncan--publish-project-alist 2: (list 3: ;; generates the main site, and as side-effect, the sitemap for the latest 5 posts 4: (list "blog" 5: :base-directory "./posts" 6: :exclude (regexp-opt '("posts.org" "archive.org" "rss.org")) 7: :base-extension "org" 8: :recursive t 9: :publishing-directory (expand-file-name "public/posts" (projectile-project-root)) 10: :publishing-function 'duncan/org-html-publish-post-to-html 11: :section-numbers nil 12: :with-toc nil 13: :html-preamble t 14: :html-preamble-format (duncan--pre/postamble-format 'preamble) 15: :html-postamble t 16: :html-postamble-format (duncan--pre/postamble-format 'postamble) 17: :html-head-include-scripts nil 18: :html-head-include-default-style nil 19: :auto-sitemap t 20: :sitemap-filename "posts.org" 21: :sitemap-style 'list 22: :sitemap-title nil 23: :sitemap-sort-files 'anti-chronologically 24: :sitemap-function 'duncan/latest-posts-sitemap-function 25: :sitemap-format-entry 'duncan/archive-sitemap-format-entry) 26: (list "archive" 27: :base-directory "./posts" 28: :recursive t 29: :exclude (regexp-opt '("posts.org" "archive.org" "rss.org")) 30: :base-extension "org" 31: :publishing-directory "./public" 32: :publishing-function 'ignore 33: ;;:publishing-function 'duncan/org-rss-publish-to-rss 34: :html-link-home "http://localhost/graval/" 35: :html-link-use-abs-url t 36: :auto-sitemap t 37: :sitemap-style 'list 38: :sitemap-filename "archive.org" 39: :sitemap-sort-files 'anti-chronologically 40: :sitemap-function 'duncan/archive-sitemap-function 41: :sitemap-format-entry 'duncan/archive-sitemap-format-entry) 42: ;; Generate a org sitemap to use later for rss, ignoring publishing the site again 43: (list "sitemap-for-rss" 44: :base-directory "./posts" 45: :recursive t 46: :exclude (regexp-opt '("posts.org" "archive.org" "rss.org")) 47: :base-extension "org" 48: :publishing-directory "./public" 49: :publishing-function 'ignore 50: :auto-sitemap t 51: :sitemap-style 'list 52: :sitemap-filename "rss.org" 53: :sitemap-function 'duncan/sitemap-for-rss-sitemap-function 54: :sitemap-format-entry 'duncan/sitemap-for-rss-sitemap-format-entry) 55: ;; generates the rss.xml file from the rss sitemap 56: (list "rss" 57: :base-directory "./" 58: :recursive t 59: :exclude "." 60: :include '("posts/rss.org") 61: :exclude (regexp-opt '("posts.org" "archive.org" "rss.org")) 62: :base-extension "org" 63: :publishing-directory "./public" 64: :publishing-function 'duncan/org-rss-publish-to-rss 65: :html-link-home "http://localhost/graval" 66: :html-link-use-abs-url t) 67: (list "site" 68: :base-directory "./" 69: :include '("posts/archive.org" "README.org") 70: :base-extension "org" 71: :publishing-directory (expand-file-name "public" (projectile-project-root)) 72: :publishing-function 'duncan/org-html-publish-site-to-html 73: :section-numbers nil 74: :html-preamble t 75: :html-preamble-format (duncan--pre/postamble-format 'preamble) 76: :html-postamble t 77: :html-postamble-format (duncan--pre/postamble-format 'postamble) 78: :html-validation-link nil 79: :html-head-include-scripts nil 80: :html-head-include-default-style nil) 81: (list "tutorials" 82: :base-directory "./tutorials" 83: :base-extension "org" 84: :recursive t 85: :publishing-directory "./public/tutorials" 86: :publishing-function 'org-html-publish-to-html 87: :section-numbers nil 88: :with-toc t) 89: (list "assets" 90: :base-directory "./" 91: :exclude (regexp-opt '("assets" "public")) 92: :include '("CNAME" "keybase.txt" "LICENSE" ".nojekyll" "publish.el") 93: :recursive t 94: :base-extension (regexp-opt '("jpg" "gif" "png" "js" "svg" "css")) 95: :publishing-directory "./public" 96: :publishing-function 'org-publish-attachment))) 97:
duncan/org-html-publish-post-to-html
Overload di org-html-publish-to-html. Aggiungi la data del post come sottotitolo ai post della variabile PLIST. FILENAME e PUB-DIR vengono passati.
(defun duncan/org-html-publish-post-to-html (plist filename pub-dir) "Wraps org-html-publish-to-html. Append post date as subtitle to PLIST. FILENAME and PUB-DIR are passed." (let ((project (cons 'blog plist))) (plist-put plist :subtitle (format-time-string "%d %b %Y" (org-publish-find-date filename project))) (duncan/org-html-publish-to-html plist filename pub-dir)))