;; -*- coding: utf-8; -*- ;;; Require: (require 'org) (require 'ox-publish) ;;; Code: (defun ld-org-update-lastupdate-property () "If '#+LASTUPDATE' is in org file, update it to the current date/time." (when (eq major-mode 'org-mode) (save-excursion (widen) (goto-char (point-min)) (when (re-search-forward "^#\\+LASTUPDATE:" (point-max) t) (progn (setq lastupdate-point (point)) (if (not (equal lastupdate-point (line-end-position))) (delete-region lastupdate-point (line-end-position))) (insert (format-time-string " %Y/%m/%d %H:%M"))))))) (add-hook 'before-save-hook #'ld-org-update-lastupdate-property) (setq org-startup-indented nil) ;; enable org-indent-mode at start, default nil. (setq org-goto-auto-isearch nil) (setq org-support-shift-select t) (setq org-use-sub-superscripts '{}) (setq org-export-with-sub-superscripts '{}) ;; If it is not nil, strings below will be interpreted in exporting as ;; Org HTML LaTeX UTF-8 ;; -----+----------+--------+------- ;; \- \- ;; -- – -- – ;; --- — --- — ;; ... … \ldots … (setq org-export-with-special-strings nil) ;; (set-face-attribute 'org-level-1 nil ;; :background "#fdf0ff" ;; :foreground "#000000" ;; :overline "#bcbcbc" ;; :bold t ;; :height 1.3) ;; (set-face-attribute 'org-level-2 nil ;; :foreground "#8f0075" ;; :overline "#bcbcbc" ;; :bold t ;; :height 1.1) ;; (set-face-attribute 'org-level-3 nil ;; :foreground "#093060" ;; :weight 'semi-bold) ;; (set-face-attribute 'org-level-4 nil ;; :foreground "#184034" ;; :weight 'semi-bold) ;; (set-face-attribute 'org-level-5 nil ;; :foreground "#61284f" ;; :weight 'semi-bold) ;; (set-face-attribute 'org-level-6 nil ;; :foreground "#3f3000" ;; :weight 'semi-bold) ;; (set-face-attribute 'org-level-7 nil ;; :foreground "#5f0000" ;; :weight 'semi-bold) ;; (set-face-attribute 'org-level-8 nil ;; :foreground "#541f4f" ;; :weight 'semi-bold) ;; (set-face-attribute 'org-block-begin-line nil ;; :background "#f0f0f0" ;; :foreground "#505050" ;; :extend t) ;; (set-face-attribute 'org-block nil ;; :background "#f8f8f8" ;; :foreground "#000000" ;; :extend t ;; ) ;; (set-face-attribute 'org-block-end-line nil ;; :background "#f0f0f0" ;; :foreground "#505050" ;; :extend t) ;; (set-face-attribute 'org-code nil ;; :background "#f0f0f0" ;; :foreground "#005a5f" ;; :extend t) ;; (set-face-attribute 'org-verbatim nil ;; :background "#f0f0f0" ;; :foreground "#8f0075" ;; :extend t) (defun ld-org-custom-html-src-block (src-block _contents info) "Transcode a SRC-BLOCK element from Org to HTML. CONTENTS holds the contents of the item. INFO is a plist holding contextual information. MAKE FINAL HTML TO BE COMPATIBLE WITH highlight.js" (if (org-export-read-attribute :attr_html src-block :textarea) (org-html--textarea-block src-block) (let ((lang (org-element-property :language src-block)) (caption (org-export-get-caption src-block)) (code (org-html-format-code src-block info)) (label (let ((lbl (and (org-element-property :name src-block) (org-export-get-reference src-block info)))) (if lbl (format " id=\"%s\"" lbl) "")))) (if (not lang) (format "
\n%s" label code) (format "
%s
"
lang label lang code))))))
(advice-add 'org-html-src-block :override 'ld-org-custom-html-src-block)
(defun ld-org-custom-html-format-list-item (contents type checkbox info
&optional term-counter-id
headline)
"Format a list item into HTML."
(let ((class (if checkbox
(format " class=\"%s\""
(symbol-name checkbox)) ""))
(checkbox (concat (org-html-checkbox checkbox info)
(and checkbox " ")))
(br (org-html-close-tag "br" nil info))
(extra-newline (if (and (org-string-nw-p contents) headline) "\n" "")))
(concat
(pcase type
(`ordered
(let* ((counter term-counter-id)
(extra (if counter (format " value=\"%s\"" counter) "")))
(concat
(format "")))) (unless (eq type 'descriptive) checkbox) extra-newline (and (org-string-nw-p contents) (org-trim contents)) extra-newline (pcase type (`ordered "