forked from mirrors/org-mode
Merge branch 'master' of orgmode.org:org-mode
This commit is contained in:
commit
88fd65f251
|
@ -511,7 +511,8 @@ title."
|
||||||
(mapconcat 'identity tag-list ":"))))))
|
(mapconcat 'identity tag-list ":"))))))
|
||||||
(priority
|
(priority
|
||||||
(and (plist-get info :with-priority)
|
(and (plist-get info :with-priority)
|
||||||
(concat (org-element-property :priority element) " ")))
|
(let ((char (org-element-property :priority element)))
|
||||||
|
(and char (format "(#%c) " char)))))
|
||||||
(first-part (concat numbers todo priority text)))
|
(first-part (concat numbers todo priority text)))
|
||||||
(concat
|
(concat
|
||||||
first-part
|
first-part
|
||||||
|
|
|
@ -32,6 +32,24 @@
|
||||||
(require 'org-e-html)
|
(require 'org-e-html)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
;;; User-Configurable Variables
|
||||||
|
|
||||||
|
(defgroup org-export-md nil
|
||||||
|
"Options specific to Markdown export back-end."
|
||||||
|
:tag "Org Markdown"
|
||||||
|
:group 'org-export
|
||||||
|
:version "24.2")
|
||||||
|
|
||||||
|
(defcustom org-md-headline-style 'atx
|
||||||
|
"Style used to format headlines.
|
||||||
|
This variable can be set to either `atx' or `setext'."
|
||||||
|
:group 'org-export-md
|
||||||
|
:type '(choice
|
||||||
|
(const :tag "Use \"atx\" style" atx)
|
||||||
|
(const :tag "Use \"Setext\" style" setext)))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
;;; Define Back-End
|
;;; Define Back-End
|
||||||
|
|
||||||
|
@ -129,22 +147,47 @@ channel."
|
||||||
CONTENTS is the headline contents. INFO is a plist used as
|
CONTENTS is the headline contents. INFO is a plist used as
|
||||||
a communication channel."
|
a communication channel."
|
||||||
(unless (org-element-property :footnote-section-p headline)
|
(unless (org-element-property :footnote-section-p headline)
|
||||||
(let ((level (org-export-get-relative-level headline info))
|
(let* ((level (org-export-get-relative-level headline info))
|
||||||
(title (org-export-data (org-element-property :title headline) info))
|
(title (org-export-data (org-element-property :title headline) info))
|
||||||
(todo (and (plist-get info :with-todo-keywords)
|
(todo (and (plist-get info :with-todo-keywords)
|
||||||
(let ((todo (org-element-property :todo-keyword headline)))
|
(let ((todo (org-element-property :todo-keyword
|
||||||
(and todo (org-export-data todo info)))))
|
headline)))
|
||||||
|
(and todo (concat (org-export-data todo info) " ")))))
|
||||||
(tags (and (plist-get info :with-tags)
|
(tags (and (plist-get info :with-tags)
|
||||||
(org-export-get-tags headline info)))
|
(let ((tag-list (org-export-get-tags headline info)))
|
||||||
(priority (and (plist-get info :with-priority)
|
(and tag-list
|
||||||
(org-element-property :priority headline))))
|
(format " :%s:"
|
||||||
(concat (make-string level ?#)
|
(mapconcat 'identity tag-list ":"))))))
|
||||||
(and todo (concat " " todo))
|
(priority
|
||||||
(and priority (concat " " priority))
|
(and (plist-get info :with-priority)
|
||||||
" " title
|
(let ((char (org-element-property :priority headline)))
|
||||||
(and tags (format " :%s:"
|
(and char (format "[#%c] " char)))))
|
||||||
(mapconcat 'identity tags ":")))
|
;; Headline text without tags.
|
||||||
"\n\n" contents))))
|
(heading (concat todo priority title)))
|
||||||
|
(cond
|
||||||
|
;; Cannot create an headline. Fall-back to a list.
|
||||||
|
((or (org-export-low-level-p headline info)
|
||||||
|
(not (memq org-md-headline-style '(atx setext)))
|
||||||
|
(and (eq org-md-headline-style 'atx) (> level 6))
|
||||||
|
(and (eq org-md-headline-style 'setext) (> level 2)))
|
||||||
|
(let ((bullet
|
||||||
|
(if (not (org-export-numbered-headline-p headline info)) "-"
|
||||||
|
(concat (number-to-string
|
||||||
|
(car (last (org-export-get-headline-number
|
||||||
|
headline info))))
|
||||||
|
"."))))
|
||||||
|
(concat bullet (make-string (- 4 (length bullet)) ? ) heading tags
|
||||||
|
"\n\n"
|
||||||
|
(and contents
|
||||||
|
(replace-regexp-in-string "^" " " contents)))))
|
||||||
|
;; Use "Setext" style.
|
||||||
|
((eq org-md-headline-style 'setext)
|
||||||
|
(concat heading tags "\n"
|
||||||
|
(make-string (length heading) (if (= level 1) ?= ?-))
|
||||||
|
"\n\n"
|
||||||
|
contents))
|
||||||
|
;; Use "atx" style.
|
||||||
|
(t (concat (make-string level ?#) " " heading tags "\n\n" contents))))))
|
||||||
|
|
||||||
|
|
||||||
;;;; Horizontal Rule
|
;;;; Horizontal Rule
|
||||||
|
|
Loading…
Reference in New Issue