%s
\n" (concat "\n" (org-html-close-tag "br" nil info) "\n" "%s\n")) (org-export-data subtitle info)) ""))))) contents (format "%s>\n" (nth 1 (assq 'content (plist-get info :html-divs)))) ;; Postamble. (org-html--build-pre/postamble 'postamble info) ;; Possibly use the Klipse library live code blocks. (when (plist-get info :html-klipsify-src) (concat "")) ;; Closing document. "block in a" :around #'org-html-src-block (if (or (not org-fancy-html-export-mode) (bound-and-true-p org-msg-export-in-progress)) (funcall orig-fn src-block contents info) (let* ((properties (cadr src-block)) (lang (mode-name-to-lang-name (plist-get properties :language))) (name (plist-get properties :name)) (ref (org-export-get-reference src-block info)) (collapsed-p (member (or (org-export-read-attribute :attr_html src-block :collapsed) (plist-get info :collapsed)) '("y" "yes" "t" t "true" "all")))) (format "" ref (if collapsed-p "" " open") (if name " class='named'" "") (concat (when name (concat "" name "")) "" lang "") ref (if name (replace-regexp-in-string (format "%s
# \%s" ref) "" (funcall orig-fn src-block contents info)) (funcall orig-fn src-block contents info)))))) (defun mode-name-to-lang-name (mode) (or (cadr (assoc mode '(("asymptote" "Asymptote") ("awk" "Awk") ("C" "C") ("clojure" "Clojure") ("css" "CSS") ("D" "D") ("ditaa" "ditaa") ("dot" "Graphviz") ("calc" "Emacs Calc") ("emacs-lisp" "Emacs Lisp") ("fortran" "Fortran") ("gnuplot" "gnuplot") ("haskell" "Haskell") ("hledger" "hledger") ("java" "Java") ("js" "Javascript") ("latex" "LaTeX") ("ledger" "Ledger") ("lisp" "Lisp") ("lilypond" "Lilypond") ("lua" "Lua") ("matlab" "MATLAB") ("mscgen" "Mscgen") ("ocaml" "Objective Caml") ("octave" "Octave") ("org" "Org mode") ("oz" "OZ") ("plantuml" "Plantuml") ("processing" "Processing.js") ("python" "Python") ("R" "R") ("ruby" "Ruby") ("sass" "Sass") ("scheme" "Scheme") ("screen" "Gnu Screen") ("sed" "Sed") ("sh" "shell") ("sql" "SQL") ("sqlite" "SQLite") ("forth" "Forth") ("io" "IO") ("J" "J") ("makefile" "Makefile") ("maxima" "Maxima") ("perl" "Perl") ("picolisp" "Pico Lisp") ("scala" "Scala") ("shell" "Shell Script") ("ebnf2ps" "ebfn2ps") ("cpp" "C++") ("abc" "ABC") ("coq" "Coq") ("groovy" "Groovy") ("bash" "bash") ("csh" "csh") ("ash" "ash") ("dash" "dash") ("ksh" "ksh") ("mksh" "mksh") ("posh" "posh") ("ada" "Ada") ("asm" "Assembler") ("caml" "Caml") ("delphi" "Delphi") ("html" "HTML") ("idl" "IDL") ("mercury" "Mercury") ("metapost" "MetaPost") ("modula-2" "Modula-2") ("pascal" "Pascal") ("ps" "PostScript") ("prolog" "Prolog") ("simula" "Simula") ("tcl" "tcl") ("tex" "LaTeX") ("plain-tex" "TeX") ("verilog" "Verilog") ("vhdl" "VHDL") ("xml" "XML") ("nxml" "XML") ("conf" "Configuration File")))) mode)) (defun org-html-block-collapsable (orig-fn block contents info) "Wrap the usual block in a" (if (or (not org-fancy-html-export-mode) (bound-and-true-p org-msg-export-in-progress)) (funcall orig-fn block contents info) (let ((ref (org-export-get-reference block info)) (type (pcase (car block) ('property-drawer "Properties"))) (collapsed-default (pcase (car block) ('property-drawer t) (_ nil))) (collapsed-value (org-export-read-attribute :attr_html block :collapsed)) (collapsed-p (or (member (org-export-read-attribute :attr_html block :collapsed) '("y" "yes" "t" t "true")) (member (plist-get info :collapsed) '("all"))))) (format "" ref (if (or collapsed-p collapsed-default) "" " open") (if type " class='named'" "") (if type (format "%s" type) "") ref (funcall orig-fn block contents info))))) (advice-add 'org-html-example-block :around #'org-html-block-collapsable) (advice-add 'org-html-fixed-width :around #'org-html-block-collapsable) (advice-add 'org-html-property-drawer :around #'org-html-block-collapsable) (autoload #'highlight-numbers--turn-on "highlight-numbers") (add-hook 'htmlize-before-hook #'highlight-numbers--turn-on) (defadvice! org-html-table-wrapped (orig-fn table contents info) "Wrap the usual%s
\ # \%s\nin a
" :around #'org-html-table (if (or (not org-fancy-html-export-mode) (bound-and-true-p org-msg-export-in-progress)) (funcall orig-fn table contents info) (let* ((name (plist-get (cadr table) :name)) (ref (org-export-get-reference table info))) (format "" ref ref (if name (replace-regexp-in-string (format "%s\" id id (funcall orig-fn headline info))))) (defadvice! org-html--toc-text-stripped-leaves (orig-fn toc-entries) "Remove label" :around #'org-html--toc-text (if (or (not org-fancy-html-export-mode) (bound-and-true-p org-msg-export-in-progress)) (funcall orig-fn toc-entries) (replace-regexp-in-string "]+>" "\\1" (funcall orig-fn toc-entries)))) (setq org-html-text-markup-alist '((bold . "%s") (code . "
%s
") (italic . "%s") (strike-through . "%s") (underline . "%s") (verbatim . "%s"))) (appendq! org-html-checkbox-types '((html-span (on . "") (off . "") (trans . "")))) (setq org-html-checkbox-type 'html-span) (pushnew! org-html-special-string-regexps '("->" . "→") '("<-" . "←")) (defun org-export-html-headline-anchor (text backend info) (when (and (org-export-derived-backend-p backend 'html) (not (org-export-derived-backend-p backend 're-reveal)) org-fancy-html-export-mode) (unless (bound-and-true-p org-msg-export-in-progress) (replace-regexp-in-string "\\(.*[^ ]\\)<\\/h[0-9]>" ; this is quite restrictive, but due to `org-reference-contraction' I can do this " \\3# " text)))) (add-to-list 'org-export-filter-headline-functions 'org-export-html-headline-anchor) (org-link-set-parameters "Https" :follow (lambda (url arg) (browse-url (concat "https:" url) arg)) :export #'org-url-fancy-export) (defun org-url-fancy-export (url _desc backend) (let ((metadata (org-url-unfurl-metadata (concat "https:" url)))) (cond ((org-export-derived-backend-p backend 'html) (concat "")) (t url)))) (setq org-url-unfurl-metadata--cache nil) (defun org-url-unfurl-metadata (url) (cdr (or (assoc url org-url-unfurl-metadata--cache) (car (push (cons url (let* ((head-data (cl-remove-if-not #'listp (cdaddr (with-current-buffer (progn (message "Fetching metadata from %s" url) (if (executable-find "curl") (with-current-buffer (generate-new-buffer " *curl*") (call-process "curl" nil t nil "--max-time" "5" "-sSL" url) (current-buffer)) (url-retrieve-synchronously url t t 5))) (goto-char (point-min)) (delete-region (point-min) (- (search-forward "") (point-max)) (goto-char (point-min)) (while (re-search-forward " ") (provide 'config-ox-html) ;;; config-ox-html.el ends here