org-web-wiki-template/build-site.el
2024-02-08 18:21:09 -03:00

53 lines
9.0 KiB
EmacsLisp

;; Set the package installation directory so that packages aren't stored in the
;; ~/.emacs.d/elpa path.
(require 'package)
(setq package-user-dir (expand-file-name "./.packages"))
(setq package-archives '(("melpa" . "https://melpa.org/packages/")
("elpa" . "https://elpa.gnu.org/packages/")))
;; Initialize the package system
(package-initialize)
(unless package-archive-contents
(package-refresh-contents))
;; Install dependencies
(package-install 'htmlize)
;; Load the publishing system
(require 'ox-publish)
;; Customize the HTML output
(setq org-html-validation-link nil ;; Don't show validation link
org-html-head-include-scripts nil ;; Use our own scripts
org-html-head-include-default-style nil ;; Use our own styles
org-html-head "<link rel=\"stylesheet\" href=\"https://cdn.simplecss.org/simple.min.css\" />")
;; Define the publishing project
(setq org-publish-project-alist
(list
(list "org-site:main"
:recursive t
:base-directory "./content"
:publishing-function 'org-html-publish-to-html
:publishing-directory "./public"
:with-author t
:with-creator t ;; Include Emacs and Org versions in footer
:with-toc t ;; Include a table of contents
:section-numbers nil ;; Don't include section numbers
:time-stamp-file nil))) ;; Don't include time stamp in file
(setq org-html-head "
<meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\">
<meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">
<style type=\"text/css\">
html,button,input,select,textarea { color: #484C66;}html { font-size: 90%; line-height: 1.4;}*,*:before,*:after { -moz-box-sizing: border-box; -webkit-box-sizing: border-box; box-sizing: border-box;}a { white-space: pre; white-space: pre-wrap; white-space: pre-line; white-space: -pre-wrap; white-space: -o-pre-wrap; white-space: -moz-pre-wrap; white-space: -hp-pre-wrap; word-wrap: break-word; text-decoration: none;}a:hover { color: #0A4C89;}/* * Remove text-shadow in selection highlight: h5bp.com/i * These selection rule sets have to be separate. * Customize the background color to match your design. */::-moz-selection { background: #0A4C89; color: #FFF; text-shadow: none;}::selection { background: #0A4C89; color: #FFF; text-shadow: none;}/* * A better looking default horizontal rule */hr { display: block; height: 1px; border: 0; border-top: 1px dashed #CCC; margin: 1em 0; padding: 0;}/* * Remove the gap between images, videos, audio and canvas and the bottom of * their containers: h5bp.com/i/440 */audio,canvas,img,video { vertical-align: middle;}/* * Remove default fieldset styles. */fieldset { border: 0; margin: 0; padding: 0;}/* * Allow only vertical resizing of textareas. */textarea { resize: vertical;}/* ========================================================================== Author's custom styles ========================================================================== */.todo,.done,.tag { font-family: \"Source Pro\", Monaco, \"Courier New\", monospace; padding: 0 0.3em; background-color: #EEE; border: 1px solid #CCC;}.todo { color: #DD4433;}.done { color: #44934B;}.tag { font-size: 80%; font-weight: normal; margin: 0 0.3em; display: none;}.timestamp { color: #BEBEBE;}.timestamp-kwd { color: #5F9EA0;}.right { margin-left: auto; margin-right: 0px; text-align: right;}.left { margin-left: 0px; margin-right: auto; text-align: left;}.center { margin-left: auto; margin-right: auto; text-align: center;}.underline { text-decoration: underline;}#postamble p,#preamble p { font-size: 90%; margin: .2em;}pre,code { font-family: \"Source Pro\", Monaco, \"Courier New\", monospace; padding-left: 0.3em; padding-right: 0.3em;}pre { font-size: 90%; padding: 8pt; overflow: auto; white-space: pre; word-wrap: normal;}pre.src { position: relative;}pre.src:before { display: none; position: absolute; background-color: #FFF; top: 0.5em; right: 0.5em; padding: 4px; border: 1px solid #CCC;}pre.src-sh:before { content: \"Shell Script\";}pre.src-bash:before { content: \"Bash Script\";}pre.src-emacs-lisp:before { content: \"Emacs Lisp\";}pre.src-R:before { content: \"R\";}pre.src-perl:before { content: \"Perl\";}pre.src-java:before { content: \"Java\";}pre.src-sql:before { content: \"SQL\";}pre.src-c:before { content: \"C\";}pre.src-cpp:before { content: \"C++\";}pre.src-html:before { content: \"HTML\";}table { border-collapse: collapse; display: block; overflow-x: auto;}caption.t-above { caption-side: top;}caption.t-bottom { caption-side: bottom;}td, th { vertical-align: top; border: 1px solid #CCC; padding: 0.5em;}th.right { text-align: center;}th.left { text-align: center;}th.center { text-align: center;}td.right { text-align: right;}td.left { text-align: left;}td.center { text-align: center;}dt { font-weight: bold;}#footnotes { border-top: 5px solid #0A4C89; margin-bottom: 5em;}#footnotes h2 { display: none;}#text-footnotes { margin-top: 1em;}.footpara:nth-child(2) { display: inline;}.footpara { display: block;}.footdef sup:before { content: \"[\";}.footdef sup:after { content: \"]\";}.footdef p { display: inline;}figure { margin: 0;}figure img { max-width: 100%;}figcaption { text-align: center; font-size: 0.8rem;}.inlinetask { padding: 10px; border: 2px solid gray; margin: 10px; background: #ffffcc;}#org-div-home-and-up { text-align: right; font-size: 70%; white-space: nowrap;}textarea { overflow-x: auto;}.linenr { font-size: smaller;}.code-highlighted { background-color: #ffff00;}.org-info-js_info-navigation { border-style: none;}#org-info-js_console-label { font-size: 10px; font-weight: bold; white-space: nowrap;}.org-info-js_search-highlight { background-color: #ffff00; color: #000000; font-weight: bold;}p.verse,blockquote { margin: 0; padding: 0; padding-left: 3%; border-left: 5px solid #0A4C89;}body { font-family: Lora, Palatino, Georgia, serif; width: 92%; max-width: 1024px; margin: 0 auto; background-color: #FFF;}h2 { line-height: 1.62em;}.title { margin: 0 0 2em 0; line-height: 2em; border-bottom: 5px solid #0A4C89; text-align: center;}#postamble { font-size: 80%; line-height: 1.4em; text-align: right;}h1, h2, h3, h4, h5, h6 { font-family: \"Source Sans Pro\", sans-serif; color: #222;}.outline-2 { margin-bottom: 4em;}.outline-2 h2 { border-bottom: 1px solid #CCC;}.outline-text-2 code, pre { background-color: #EEE;}#table-of-contents { display: none; margin-left: 0.5em;}#text-table-of-contents ul { padding-left: 1.8em;}#text-table-of-contents li { list-style-type: circle; margin: 0.4em 0;}#text-table-of-contents ul ul { margin: 0;}#text-table-of-contents li li { font-weight: normal; font-size: 90%; margin: 0;}#content { overflow: hidden; *zoom: 1;}/* ========================================================================== EXAMPLE Media Queries for Responsive Design. These examples override the primary ('mobile first') styles. Modify as content requires. ========================================================================== */@media only screen and (min-width: 35em) { /* Style adjustments for viewports that meet the condition */}@media print, (-o-min-device-pixel-ratio: 5 / 4), (-webkit-min-device-pixel-ratio: 1.25), (min-resolution: 120dpi) { /* Style adjustments for high resolution devices */}/* ========================================================================== Print styles. Inlined to avoid required HTTP connection: h5bp.com/r ========================================================================== */@media print { * { background: transparent !important; color: #000 !important; /* Black prints faster: h5bp.com/s */ box-shadow: none !important; text-shadow: none !important; } a, a:visited { text-decoration: underline; } a[href]:after { content: \" (\" attr(href) \")\"; } abbr[title]:after { content: \" (\" attr(title) \")\"; } /* * Don't show links for images, or javascript/internal links */ .ir a:after, a[href^=\"javascript:\"]:after, a[href^=\"#\"]:after { content: \"\"; } pre, blockquote { /* border: 1px solid #999; */ page-break-inside: avoid; } thead { display: table-header-group; /* h5bp.com/t */ } tr, img { page-break-inside: avoid; } img { max-width: 100% !important; } @page { margin: 0.5cm; } p, h2, h3 { orphans: 3; widows: 3; } h2, h3 { page-break-after: avoid; } #table-of-contents { display: block; width: initial; border: none; } #table-of-contents a { text-decoration: none; }}/* large screen */@media screen and (min-width: 40rem) { html { font-size: 100%; } #table-of-contents { display: block; padding: 1em; width: 32%; min-width: 18em; float: right; background-color: #EEE; position: relative; /* required by z-index */ z-index: 5000; border: 1px solid #CCC; } .tag { display: initial; }}
</style>
"
)
;; Generate the site output
(org-publish-all t)
(message "Build complete!")