Improve consistency in the usage of empty lines

This commit is contained in:
Jonas Bernoulli 2023-06-26 14:07:35 +02:00
parent 46faa67dbb
commit 4eaf2adf29
No known key found for this signature in database
GPG Key ID: 230C2EFBB326D927

View File

@ -29,6 +29,7 @@
(require 'ox-md) (require 'ox-md)
(require 'ox-publish) (require 'ox-publish)
;;; User-Configurable Variables ;;; User-Configurable Variables
@ -62,7 +63,6 @@
(table-row . org-gfm-table-row) (table-row . org-gfm-table-row)
(table . org-gfm-table))) (table . org-gfm-table)))
;;; Transcode Functions ;;; Transcode Functions
@ -80,7 +80,6 @@ communication channel."
(replace-regexp-in-string "\\`#" "\\#" contents nil t) (replace-regexp-in-string "\\`#" "\\#" contents nil t)
contents))) contents)))
;;;; Src Block ;;;; Src Block
(defun org-gfm-src-block (src-block contents info) (defun org-gfm-src-block (src-block contents info)
@ -97,7 +96,6 @@ channel."
(defalias 'org-gfm-example-block #'org-gfm-src-block) (defalias 'org-gfm-example-block #'org-gfm-src-block)
;;;; Strike-Through ;;;; Strike-Through
(defun org-gfm-strike-through (strike-through contents info) (defun org-gfm-strike-through (strike-through contents info)
@ -106,7 +104,6 @@ CONTENTS is the text with strike-through markup. INFO is a plist
holding contextual information." holding contextual information."
(format "~~%s~~" contents)) (format "~~%s~~" contents))
;;;; Table-Common ;;;; Table-Common
(defvar width-cookies nil) (defvar width-cookies nil)
@ -149,7 +146,6 @@ the column."
info) info)
(puthash column max-width width-cookies)))))) (puthash column max-width width-cookies))))))
(defun org-gfm-make-hline-builder (table info char) (defun org-gfm-make-hline-builder (table info char)
"Return a function to build horizontal line in TABLE with given "Return a function to build horizontal line in TABLE with given
CHAR. INFO is a plist used as a communication channel." CHAR. INFO is a plist used as a communication channel."
@ -159,7 +155,6 @@ CHAR. INFO is a plist used as a communication channel."
(setq max-width 1)) (setq max-width 1))
(make-string max-width ,char)))) (make-string max-width ,char))))
;;;; Table-Cell ;;;; Table-Cell
(defun org-gfm-table-cell (table-cell contents info) (defun org-gfm-table-cell (table-cell contents info)
@ -177,7 +172,6 @@ of the cell. INFO is a plist used as a communication channel."
?\s))) ?\s)))
(concat left-border contents right-border))) (concat left-border contents right-border)))
;;;; Table-Row ;;;; Table-Row
(defun org-gfm-table-row (table-row contents info) (defun org-gfm-table-row (table-row contents info)
@ -202,8 +196,6 @@ channel."
gfm-table-right-border)))) gfm-table-right-border))))
contents)) contents))
;;;; Table ;;;; Table
(defun org-gfm-table (table contents info) (defun org-gfm-table (table contents info)
@ -231,7 +223,6 @@ contextual information."
(concat (when no-header (funcall build-dummy-header)) (concat (when no-header (funcall build-dummy-header))
(replace-regexp-in-string "\n\n" "\n" contents)))) (replace-regexp-in-string "\n\n" "\n" contents))))
;;;; Table of contents ;;;; Table of contents
(defun org-gfm-format-toc (headline) (defun org-gfm-format-toc (headline)
@ -245,7 +236,6 @@ plist used as a communication channel."
(org-export-get-reference headline info)))) (org-export-get-reference headline info))))
(concat indent "- [" title "]" "(#" anchor ")"))) (concat indent "- [" title "]" "(#" anchor ")")))
;;;; Footnote section ;;;; Footnote section
(defun org-gfm-footnote-section (info) (defun org-gfm-footnote-section (info)
@ -277,7 +267,6 @@ INFO is a plist used as a communication channel."
fn-alist fn-alist
"\n")))))) "\n"))))))
;;;; Template ;;;; Template
(defun org-gfm-inner-template (contents info) (defun org-gfm-inner-template (contents info)
@ -290,9 +279,6 @@ holding export options."
(toc-tail (if headlines "\n\n" ""))) (toc-tail (if headlines "\n\n" "")))
(org-trim (concat toc-string toc-tail contents "\n" (org-gfm-footnote-section info))))) (org-trim (concat toc-string toc-tail contents "\n" (org-gfm-footnote-section info)))))
;;; Interactive function ;;; Interactive function
@ -323,7 +309,6 @@ non-nil."
(org-export-to-buffer 'gfm "*Org GFM Export*" (org-export-to-buffer 'gfm "*Org GFM Export*"
async subtreep visible-only nil nil (lambda () (text-mode)))) async subtreep visible-only nil nil (lambda () (text-mode))))
;;;###autoload ;;;###autoload
(defun org-gfm-convert-region-to-md () (defun org-gfm-convert-region-to-md ()
"Assume the current region has org-mode syntax, and convert it "Assume the current region has org-mode syntax, and convert it
@ -333,7 +318,6 @@ a Markdown buffer and use this command to convert it."
(interactive) (interactive)
(org-export-replace-region-by 'gfm)) (org-export-replace-region-by 'gfm))
;;;###autoload ;;;###autoload
(defun org-gfm-export-to-markdown (&optional async subtreep visible-only) (defun org-gfm-export-to-markdown (&optional async subtreep visible-only)
"Export current buffer to a Github Flavored Markdown file. "Export current buffer to a Github Flavored Markdown file.