Merge branch 'master' of orgmode.org:org-mode

This commit is contained in:
Bastien Guerry 2012-07-28 00:57:14 +02:00
commit 88fd65f251
2 changed files with 61 additions and 17 deletions

View File

@ -511,7 +511,8 @@ title."
(mapconcat 'identity tag-list ":"))))))
(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)))
(concat
first-part

View File

@ -32,6 +32,24 @@
(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
@ -129,22 +147,47 @@ channel."
CONTENTS is the headline contents. INFO is a plist used as
a communication channel."
(unless (org-element-property :footnote-section-p headline)
(let ((level (org-export-get-relative-level headline info))
(title (org-export-data (org-element-property :title headline) info))
(todo (and (plist-get info :with-todo-keywords)
(let ((todo (org-element-property :todo-keyword headline)))
(and todo (org-export-data todo info)))))
(tags (and (plist-get info :with-tags)
(org-export-get-tags headline info)))
(priority (and (plist-get info :with-priority)
(org-element-property :priority headline))))
(concat (make-string level ?#)
(and todo (concat " " todo))
(and priority (concat " " priority))
" " title
(and tags (format " :%s:"
(mapconcat 'identity tags ":")))
"\n\n" contents))))
(let* ((level (org-export-get-relative-level headline info))
(title (org-export-data (org-element-property :title headline) info))
(todo (and (plist-get info :with-todo-keywords)
(let ((todo (org-element-property :todo-keyword
headline)))
(and todo (concat (org-export-data todo info) " ")))))
(tags (and (plist-get info :with-tags)
(let ((tag-list (org-export-get-tags headline info)))
(and tag-list
(format " :%s:"
(mapconcat 'identity tag-list ":"))))))
(priority
(and (plist-get info :with-priority)
(let ((char (org-element-property :priority headline)))
(and char (format "[#%c] " char)))))
;; Headline text without tags.
(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