~daviwil/ox-gemini-clean

21ec50c84cc8e7b9558fc6dbe5fe493500670454 — David Wilson 7 months ago 7adf7a1 master
Add support for link references, code blocks, and bold/italic text
1 files changed, 36 insertions(+), 2 deletions(-)

M ox-gemini-clean.el
M ox-gemini-clean.el => ox-gemini-clean.el +36 -2
@@ 1,5 1,7 @@
;; -*- lexical-binding: t; -*-

(require 'subr-x)

(defun org-gemini-template (contents info)
  (concat
   "# " (org-export-data (plist-get info :title) info) "\n\n"


@@ 8,8 10,12 @@
(defun org-gemini-section (_section contents _info)
  contents)

(defvar org-gemini--link-counter 0)

(defun org-gemini-paragraph (paragraph contents info)
  ;; TODO: Annotate links with indexes that refer to the link list
  ;; Reset the counter (needs to be updated for nested paragraphs!)
  (setq org-gemini--link-counter 0)

  (concat
   contents
   "\n"


@@ 23,12 29,36 @@
              paragraph
              "")))

(defun org-gemini-link (link description info)
  (setq org-gemini--link-counter (1+ org-gemini--link-counter))
  (format "%s [%d]"
          (or description
              "(see below)")
          org-gemini--link-counter))

(defun org-gemini-code (code contents _info)
  (format "`%s`" (org-element-property :value code)))

(defun org-gemini-src-block (src-block _contents info)
  (format "```\n%s\n```\n"
	        (string-trim (org-export-format-code-default src-block info))))

(defun org-gemini-bold (_bold contents _info)
  (format "**%s**" contents))

(defun org-gemini-italic (_italic contents _info)
  (format "_%s_" contents))

(defun org-gemini-verbatim (verbatim contents _info)
  (format "`%s`" (org-element-property :value verbatim)))

(defun org-gemini-plain-list (plain-list contents info)
  (mapconcat (lambda (item)
               (format "- %s\n"
                       (org-export-data (org-element-contents item) info)))
             (cddr plain-list)
             ""))

(defun org-gemini-headline (headline contents info)
  (let ((level (+ 1 (org-export-get-relative-level headline info))))
    (concat


@@ 44,7 74,11 @@
    (paragraph . org-gemini-paragraph)
    (code . org-gemini-code)
    (verbatim . org-gemini-verbatim)
    ;; (link . dw/org-html-link)
    (link . org-gemini-link)
    (src-block . org-gemini-src-block)
    (bold . org-gemini-bold)
    (italic . org-gemini-italic)
    (plain-list . org-gemini-plain-list)
    (headline . org-gemini-headline)))

(defun org-gemini-publish-to-gemini (plist filename pub-dir)