emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [PATCH] ox-md.el: fixed an issue where exporting markdown ToC would fail if heading numbering is not enabled
@ 2018-04-20 15:05 Yue Zhu
  2018-04-21  9:14 ` Nicolas Goaziou
  0 siblings, 1 reply; 2+ messages in thread
From: Yue Zhu @ 2018-04-20 15:05 UTC (permalink / raw)
  To: emacs-orgmode


[-- Attachment #1.1: Type: text/plain, Size: 405 bytes --]

When exporting markdown with ToC, if heading numbering is not enabled, it
would fail with the attached backtrace. The cause is that the function
`org-md--build-toc' in `ox-md.el' does not properly handle this case which
effectively results in a function call `(format "%d." nil)'. In my patch,
when exporting markdown with ToC, if heading numbering is not enabled, ToC
will be shown as an unordered list.

[-- Attachment #1.2: Type: text/html, Size: 464 bytes --]

[-- Attachment #2: 0001-ox-md.el-fixed-an-issue-where-exporting-markdown-ToC.patch --]
[-- Type: application/octet-stream, Size: 1168 bytes --]

From 095a3fe74fe4794fa0257c78a063973b48763a00 Mon Sep 17 00:00:00 2001
From: Yue Zhu <yuezhu3@gmail.com>
Date: Fri, 20 Apr 2018 10:49:44 -0400
Subject: [PATCH] ox-md.el: fixed an issue where exporting markdown ToC would
 fail if heading numbering is not enabled

(org-md--build-toc): When exporting markdown with ToC, if heading
numbering is not enabled, ToC will be shown as an unordered list.

TINYCHANGE
---
 lisp/ox-md.el | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/lisp/ox-md.el b/lisp/ox-md.el
index 960407aca..fa7260903 100644
--- a/lisp/ox-md.el
+++ b/lisp/ox-md.el
@@ -574,9 +574,9 @@ contents according to the current headline."
 	      (make-string
 	       (* 4 (1- (org-export-get-relative-level headline info)))
 	       ?\s))
-	     (number (format "%d."
-			     (org-last
-			      (org-export-get-headline-number headline info))))
+	     (heading-number (org-last
+			      (org-export-get-headline-number headline info)))
+	     (number (if heading-number (format "%s." heading-number) "- "))
 	     (bullet (concat number (make-string (- 4 (length number)) ?\s)))
 	     (title
 	      (format "[%s](#%s)"
-- 
2.17.0


[-- Attachment #3: backtrace.log --]
[-- Type: application/octet-stream, Size: 35089 bytes --]

Debugger entered--Lisp error: (error "Format specifier doesn’t match argument type")
  format("%d." "nil")
  #[257 "\301\302�\300\"S\303_\304\"\305\306\307�\300\"\310�!@\262�\"\211\301\303�GZ\304\"P\305\311\312\313��\300\"\314\315!\300#\316��\211;\203=�\317\320��#\202C�\321�A@�\"\266\202\206M�\322��\300\"#\321\300\323\"\205q�\321\300\323\"\324=?\205q�\325�\300\"\211\205o�\305\326\327\330�\331#\"\262�����R\207" [(:export-options nil :back-end [cl-struct-org-export-backend md html ((bold . org-md-bold) (code . org-md-verbatim) (example-block . org-md-example-block) (export-block . org-md-export-block) (fixed-width . org-md-example-block) (headline . org-md-headline) (horizontal-rule . org-md-horizontal-rule) (inline-src-block . org-md-verbatim) (inner-template . org-md-inner-template) (italic . org-md-italic) (item . org-md-item) (keyword . org-md-keyword) (line-break . org-md-line-break) (link . org-md-link) (node-property . org-md-node-property) (paragraph . org-md-paragraph) (plain-list . org-md-plain-list) (plain-text . org-md-plain-text) (property-drawer . org-md-property-drawer) (quote-block . org-md-quote-block) (section . org-md-section) (src-block . org-md-example-block) (template . org-md-template) (verbatim . org-md-verbatim)) ((:md-footnote-format nil nil org-md-footnote-format) (:md-footnotes-section nil nil org-md-footnotes-section) (:md-headline-style nil nil org-md-headline-style)) ((:filter-parse-tree . org-md-separate-elements)) nil (109 "Export to Markdown" ((77 "To temporary buffer" (lambda ... ...)) (109 "To file" (lambda ... ...)) (111 "To file and open" (lambda ... ...))))] :translate-alist ((bold . org-md-bold) (code . org-md-verbatim) (example-block . org-md-example-block) (export-block . org-md-export-block) (fixed-width . org-md-example-block) (headline . org-md-headline) (horizontal-rule . org-md-horizontal-rule) (inline-src-block . org-md-verbatim) (inner-template . org-md-inner-template) (italic . org-md-italic) (item . org-md-item) (keyword . org-md-keyword) (line-break . org-md-line-break) (link . org-md-link) (node-property . org-md-node-property) (paragraph . org-md-paragraph) (plain-list . org-md-plain-list) (plain-text . org-md-plain-text) (property-drawer . org-md-property-drawer) (quote-block . org-md-quote-block) (section . org-md-section) (src-block . org-md-example-block) (template . org-md-template) (verbatim . org-md-verbatim) (bold . org-html-bold) (center-block . org-html-center-block) (clock . org-html-clock) (code . org-html-code) (drawer . org-html-drawer) (dynamic-block . org-html-dynamic-block) (entity . org-html-entity) (example-block . org-html-example-block) (export-block . org-html-export-block) (export-snippet . org-html-export-snippet) (fixed-width . org-html-fixed-width) (footnote-definition . org-html-footnote-definition) (footnote-reference . org-html-footnote-reference) (headline . org-html-headline) (horizontal-rule . org-html-horizontal-rule) (inline-src-block . org-html-inline-src-block) (inlinetask . org-html-inlinetask) (inner-template . org-html-inner-template) (italic . org-html-italic) (item . org-html-item) (keyword . org-html-keyword) (latex-environment . org-html-latex-environment) (latex-fragment . org-html-latex-fragment) (line-break . org-html-line-break) (link . org-html-link) (node-property . org-html-node-property) ...) :exported-data #s(hash-table size 4001 test eq rehash-size 1.5 rehash-threshold 0.8 data ((keyword (:key "TITLE" :value "TEST" :begin 1 :end 15 :post-blank 1 :post-affiliated 1 :parent (section (:begin 1 :end 32 :contents-begin 1 :contents-end 32 :post-blank 1 :post-affiliated 1 :parent ...) #4 (keyword ...)))) "" (keyword (:key "OPTIONS" :value "toc:t" :begin 15 :end 32 :post-blank 1 :post-affiliated 15 :parent (section (:begin 1 :end 32 :contents-begin 1 :contents-end 32 :post-blank 1 :post-affiliated 1 :parent ...) (keyword ...) #4))) "" (section (:begin 1 :end 32 :contents-begin 1 :contents-end 32 :post-blank 1 :post-affiliated 1 :parent (org-data nil #4 (headline ...))) (keyword (:key "TITLE" :value "TEST" :begin 1 :end 15 :post-blank 1 :post-affiliated 1 :parent #4)) (keyword (:key "OPTIONS" :value "toc:t" :begin 15 :end 32 :post-blank 1 :post-affiliated 15 :parent #4))) "\n" #("Headline 1" 0 10 (:parent (headline (:raw-value "Headline 1" :begin 32 :end 44 :pre-blank 0 :contents-begin nil :contents-end nil :level 1 :priority nil :tags nil :todo-keyword nil :todo-type nil :post-blank 1 :footnote-section-p nil :archivedp nil :commentedp nil :post-affiliated 32 :title ... :parent ...)))) #("Headline 1" 0 10 (:parent (headline (:raw-value "Headline 1" :begin 32 :end 44 :pre-blank 0 :contents-begin nil :contents-end nil :level 1 :priority nil :tags nil :todo-keyword nil :todo-type nil :post-blank 1 :footnote-section-p nil :archivedp nil :commentedp nil :post-affiliated 32 :title ... :parent ...)))) (#("Headline 1" 0 10 (:parent (headline ...)))) #("Headline 1" 0 10 (:parent (headline (:raw-value "Headline 1" :begin 32 :end 44 :pre-blank 0 :contents-begin nil :contents-end nil :level 1 :priority nil :tags nil :todo-keyword nil :todo-type nil :post-blank 1 :footnote-section-p nil :archivedp nil :commentedp nil :post-affiliated 32 :title ... :parent ...)))) (headline (:raw-value "Headline 1" :begin 32 :end 44 :pre-blank 0 :contents-begin nil :contents-end nil :level 1 :priority nil :tags nil :todo-keyword nil :todo-type nil :post-blank 1 :footnote-section-p nil :archivedp nil :commentedp nil :post-affiliated 32 :title (#("Headline 1" 0 10 ...)) :parent (org-data nil (section ... ... ...) #4))) #("\n<a id=\"org30c3ef9\"></a>\n\n# Headline 1\n\n" 28 38 (:parent (headline (:raw-value "Headline 1" :begin 32 :end 44 :pre-blank 0 :contents-begin nil :contents-end nil :level 1 :priority nil :tags nil :todo-keyword nil :todo-type nil :post-blank 1 :footnote-section-p nil :archivedp nil :commentedp nil :post-affiliated 32 :title ... :parent ...)))) (org-data nil (section (:begin 1 :end 32 :contents-begin 1 :contents-end 32 :post-blank 1 :post-affiliated 1 :parent #4) (keyword (:key "TITLE" :value "TEST" :begin 1 :end 15 :post-blank 1 :post-affiliated 1 :parent #5)) (keyword (:key "OPTIONS" :value "toc:t" :begin 15 :end 32 :post-blank 1 :post-affiliated 15 :parent #5))) (headline (:raw-value "Headline 1" :begin 32 :end 44 :pre-blank 0 :contents-begin nil :contents-end nil :level 1 :priority nil :tags nil :todo-keyword nil :todo-type nil :post-blank 1 :footnote-section-p nil :archivedp nil :commentedp nil :post-affiliated 32 :title (#("Headline 1" 0 10 ...)) :parent #4))) #("\n\n<a id=\"org30c3ef9\"></a>\n\n# Headline 1\n\n" 29 39 (:parent (headline (:raw-value "Headline 1" :begin 32 :end 44 :pre-blank 0 :contents-begin nil :contents-end nil :level 1 :priority nil :tags nil :todo-keyword nil :todo-type nil :post-blank 1 :footnote-section-p nil :archivedp nil :commentedp nil :post-affiliated 32 :title ... :parent ...)))) ...)) :input-buffer "test.org" :input-file "/Users/yuezhu/test.org" :md-footnote-format "<sup>%s</sup>" :md-footnotes-section "%s%s" :md-headline-style atx :html-doctype "xhtml-strict" :html-container "div" :description nil :keywords nil :html-html5-fancy nil :html-link-use-abs-url nil :html-link-home "" :html-link-up "" :html-mathjax "" :html-postamble auto :html-preamble t :html-head "" :html-head-extra "" :subtitle nil :html-head-include-default-style t :html-head-include-scripts t ...) make-string org-export-get-relative-level 4 32 format "%d." org-export-get-headline-number last "[%s](#%s)" org-export-data-with-backend org-export-get-alt-title org-export-toc-entry-backend md :CUSTOM_ID get-text-property 0 plist-get org-export-get-reference :with-tags not-in-toc org-export-get-tags ":%s:" mapconcat identity ":"] 13 "\n\n(fn HEADLINE)"]((headline (:raw-value "Headline 1" :begin 32 :end 44 :pre-blank 0 :contents-begin nil :contents-end nil :level 1 :priority nil :tags nil :todo-keyword nil :todo-type nil :post-blank 1 :footnote-section-p nil :archivedp nil :commentedp nil :post-affiliated 32 :title (#("Headline 1" 0 10 (:parent #0))) :parent (org-data nil (section (:begin 1 :end 32 :contents-begin 1 :contents-end 32 :post-blank 1 :post-affiliated 1 :parent #2) (keyword (:key "TITLE" :value "TEST" :begin 1 :end 15 :post-blank 1 :post-affiliated 1 :parent #3)) (keyword (:key "OPTIONS" :value "toc:t" :begin 15 :end 32 :post-blank 1 :post-affiliated 15 :parent #3))) #0))))
  mapconcat(#[257 "\301\302�\300\"S\303_\304\"\305\306\307�\300\"\310�!@\262�\"\211\301\303�GZ\304\"P\305\311\312\313��\300\"\314\315!\300#\316��\211;\203=�\317\320��#\202C�\321�A@�\"\266\202\206M�\322��\300\"#\321\300\323\"\205q�\321\300\323\"\324=?\205q�\325�\300\"\211\205o�\305\326\327\330�\331#\"\262�����R\207" [(:export-options nil :back-end [cl-struct-org-export-backend md html ((bold . org-md-bold) (code . org-md-verbatim) (example-block . org-md-example-block) (export-block . org-md-export-block) (fixed-width . org-md-example-block) (headline . org-md-headline) (horizontal-rule . org-md-horizontal-rule) (inline-src-block . org-md-verbatim) (inner-template . org-md-inner-template) (italic . org-md-italic) (item . org-md-item) (keyword . org-md-keyword) (line-break . org-md-line-break) (link . org-md-link) (node-property . org-md-node-property) (paragraph . org-md-paragraph) (plain-list . org-md-plain-list) (plain-text . org-md-plain-text) (property-drawer . org-md-property-drawer) (quote-block . org-md-quote-block) (section . org-md-section) (src-block . org-md-example-block) (template . org-md-template) (verbatim . org-md-verbatim)) ((:md-footnote-format nil nil org-md-footnote-format) (:md-footnotes-section nil nil org-md-footnotes-section) (:md-headline-style nil nil org-md-headline-style)) ((:filter-parse-tree . org-md-separate-elements)) nil (109 "Export to Markdown" ((77 "To temporary buffer" (lambda ... ...)) (109 "To file" (lambda ... ...)) (111 "To file and open" (lambda ... ...))))] :translate-alist ((bold . org-md-bold) (code . org-md-verbatim) (example-block . org-md-example-block) (export-block . org-md-export-block) (fixed-width . org-md-example-block) (headline . org-md-headline) (horizontal-rule . org-md-horizontal-rule) (inline-src-block . org-md-verbatim) (inner-template . org-md-inner-template) (italic . org-md-italic) (item . org-md-item) (keyword . org-md-keyword) (line-break . org-md-line-break) (link . org-md-link) (node-property . org-md-node-property) (paragraph . org-md-paragraph) (plain-list . org-md-plain-list) (plain-text . org-md-plain-text) (property-drawer . org-md-property-drawer) (quote-block . org-md-quote-block) (section . org-md-section) (src-block . org-md-example-block) (template . org-md-template) (verbatim . org-md-verbatim) (bold . org-html-bold) (center-block . org-html-center-block) (clock . org-html-clock) (code . org-html-code) (drawer . org-html-drawer) (dynamic-block . org-html-dynamic-block) (entity . org-html-entity) (example-block . org-html-example-block) (export-block . org-html-export-block) (export-snippet . org-html-export-snippet) (fixed-width . org-html-fixed-width) (footnote-definition . org-html-footnote-definition) (footnote-reference . org-html-footnote-reference) (headline . org-html-headline) (horizontal-rule . org-html-horizontal-rule) (inline-src-block . org-html-inline-src-block) (inlinetask . org-html-inlinetask) (inner-template . org-html-inner-template) (italic . org-html-italic) (item . org-html-item) (keyword . org-html-keyword) (latex-environment . org-html-latex-environment) (latex-fragment . org-html-latex-fragment) (line-break . org-html-line-break) (link . org-html-link) (node-property . org-html-node-property) ...) :exported-data #s(hash-table size 4001 test eq rehash-size 1.5 rehash-threshold 0.8 data ((keyword (:key "TITLE" :value "TEST" :begin 1 :end 15 :post-blank 1 :post-affiliated 1 :parent (section (:begin 1 :end 32 :contents-begin 1 :contents-end 32 :post-blank 1 :post-affiliated 1 :parent ...) #4 (keyword ...)))) "" (keyword (:key "OPTIONS" :value "toc:t" :begin 15 :end 32 :post-blank 1 :post-affiliated 15 :parent (section (:begin 1 :end 32 :contents-begin 1 :contents-end 32 :post-blank 1 :post-affiliated 1 :parent ...) (keyword ...) #4))) "" (section (:begin 1 :end 32 :contents-begin 1 :contents-end 32 :post-blank 1 :post-affiliated 1 :parent (org-data nil #4 (headline ...))) (keyword (:key "TITLE" :value "TEST" :begin 1 :end 15 :post-blank 1 :post-affiliated 1 :parent #4)) (keyword (:key "OPTIONS" :value "toc:t" :begin 15 :end 32 :post-blank 1 :post-affiliated 15 :parent #4))) "\n" #("Headline 1" 0 10 (:parent (headline (:raw-value "Headline 1" :begin 32 :end 44 :pre-blank 0 :contents-begin nil :contents-end nil :level 1 :priority nil :tags nil :todo-keyword nil :todo-type nil :post-blank 1 :footnote-section-p nil :archivedp nil :commentedp nil :post-affiliated 32 :title ... :parent ...)))) #("Headline 1" 0 10 (:parent (headline (:raw-value "Headline 1" :begin 32 :end 44 :pre-blank 0 :contents-begin nil :contents-end nil :level 1 :priority nil :tags nil :todo-keyword nil :todo-type nil :post-blank 1 :footnote-section-p nil :archivedp nil :commentedp nil :post-affiliated 32 :title ... :parent ...)))) (#("Headline 1" 0 10 (:parent (headline ...)))) #("Headline 1" 0 10 (:parent (headline (:raw-value "Headline 1" :begin 32 :end 44 :pre-blank 0 :contents-begin nil :contents-end nil :level 1 :priority nil :tags nil :todo-keyword nil :todo-type nil :post-blank 1 :footnote-section-p nil :archivedp nil :commentedp nil :post-affiliated 32 :title ... :parent ...)))) (headline (:raw-value "Headline 1" :begin 32 :end 44 :pre-blank 0 :contents-begin nil :contents-end nil :level 1 :priority nil :tags nil :todo-keyword nil :todo-type nil :post-blank 1 :footnote-section-p nil :archivedp nil :commentedp nil :post-affiliated 32 :title (#("Headline 1" 0 10 ...)) :parent (org-data nil (section ... ... ...) #4))) #("\n<a id=\"org30c3ef9\"></a>\n\n# Headline 1\n\n" 28 38 (:parent (headline (:raw-value "Headline 1" :begin 32 :end 44 :pre-blank 0 :contents-begin nil :contents-end nil :level 1 :priority nil :tags nil :todo-keyword nil :todo-type nil :post-blank 1 :footnote-section-p nil :archivedp nil :commentedp nil :post-affiliated 32 :title ... :parent ...)))) (org-data nil (section (:begin 1 :end 32 :contents-begin 1 :contents-end 32 :post-blank 1 :post-affiliated 1 :parent #4) (keyword (:key "TITLE" :value "TEST" :begin 1 :end 15 :post-blank 1 :post-affiliated 1 :parent #5)) (keyword (:key "OPTIONS" :value "toc:t" :begin 15 :end 32 :post-blank 1 :post-affiliated 15 :parent #5))) (headline (:raw-value "Headline 1" :begin 32 :end 44 :pre-blank 0 :contents-begin nil :contents-end nil :level 1 :priority nil :tags nil :todo-keyword nil :todo-type nil :post-blank 1 :footnote-section-p nil :archivedp nil :commentedp nil :post-affiliated 32 :title (#("Headline 1" 0 10 ...)) :parent #4))) #("\n\n<a id=\"org30c3ef9\"></a>\n\n# Headline 1\n\n" 29 39 (:parent (headline (:raw-value "Headline 1" :begin 32 :end 44 :pre-blank 0 :contents-begin nil :contents-end nil :level 1 :priority nil :tags nil :todo-keyword nil :todo-type nil :post-blank 1 :footnote-section-p nil :archivedp nil :commentedp nil :post-affiliated 32 :title ... :parent ...)))) ...)) :input-buffer "test.org" :input-file "/Users/yuezhu/test.org" :md-footnote-format "<sup>%s</sup>" :md-footnotes-section "%s%s" :md-headline-style atx :html-doctype "xhtml-strict" :html-container "div" :description nil :keywords nil :html-html5-fancy nil :html-link-use-abs-url nil :html-link-home "" :html-link-up "" :html-mathjax "" :html-postamble auto :html-preamble t :html-head "" :html-head-extra "" :subtitle nil :html-head-include-default-style t :html-head-include-scripts t ...) make-string org-export-get-relative-level 4 32 format "%d." org-export-get-headline-number last "[%s](#%s)" org-export-data-with-backend org-export-get-alt-title org-export-toc-entry-backend md :CUSTOM_ID get-text-property 0 plist-get org-export-get-reference :with-tags not-in-toc org-export-get-tags ":%s:" mapconcat identity ":"] 13 "\n\n(fn HEADLINE)"] ((headline (:raw-value "Headline 1" :begin 32 :end 44 :pre-blank 0 :contents-begin nil :contents-end nil :level 1 :priority nil :tags nil :todo-keyword nil :todo-type nil :post-blank 1 :footnote-section-p nil :archivedp nil :commentedp nil :post-affiliated 32 :title (#("Headline 1" 0 10 (:parent #1))) :parent (org-data nil (section (:begin 1 :end 32 :contents-begin 1 :contents-end 32 :post-blank 1 :post-affiliated 1 :parent #3) (keyword (:key "TITLE" :value "TEST" :begin 1 :end 15 :post-blank 1 :post-affiliated 1 :parent #4)) (keyword (:key "OPTIONS" :value "toc:t" :begin 15 :end 32 :post-blank 1 :post-affiliated 15 :parent #4))) #1)))) "\n")
  org-md--build-toc((:export-options nil :back-end [cl-struct-org-export-backend md html ((bold . org-md-bold) (code . org-md-verbatim) (example-block . org-md-example-block) (export-block . org-md-export-block) (fixed-width . org-md-example-block) (headline . org-md-headline) (horizontal-rule . org-md-horizontal-rule) (inline-src-block . org-md-verbatim) (inner-template . org-md-inner-template) (italic . org-md-italic) (item . org-md-item) (keyword . org-md-keyword) (line-break . org-md-line-break) (link . org-md-link) (node-property . org-md-node-property) (paragraph . org-md-paragraph) (plain-list . org-md-plain-list) (plain-text . org-md-plain-text) (property-drawer . org-md-property-drawer) (quote-block . org-md-quote-block) (section . org-md-section) (src-block . org-md-example-block) (template . org-md-template) (verbatim . org-md-verbatim)) ((:md-footnote-format nil nil org-md-footnote-format) (:md-footnotes-section nil nil org-md-footnotes-section) (:md-headline-style nil nil org-md-headline-style)) ((:filter-parse-tree . org-md-separate-elements)) nil (109 "Export to Markdown" ((77 "To temporary buffer" (lambda (a s v b) (org-md-export-as-markdown a s v))) (109 "To file" (lambda (a s v b) (org-md-export-to-markdown a s v))) (111 "To file and open" (lambda (a s v b) (if a (org-md-export-to-markdown t s v) (org-open-file ...))))))] :translate-alist ((bold . org-md-bold) (code . org-md-verbatim) (example-block . org-md-example-block) (export-block . org-md-export-block) (fixed-width . org-md-example-block) (headline . org-md-headline) (horizontal-rule . org-md-horizontal-rule) (inline-src-block . org-md-verbatim) (inner-template . org-md-inner-template) (italic . org-md-italic) (item . org-md-item) (keyword . org-md-keyword) (line-break . org-md-line-break) (link . org-md-link) (node-property . org-md-node-property) (paragraph . org-md-paragraph) (plain-list . org-md-plain-list) (plain-text . org-md-plain-text) (property-drawer . org-md-property-drawer) (quote-block . org-md-quote-block) (section . org-md-section) (src-block . org-md-example-block) (template . org-md-template) (verbatim . org-md-verbatim) (bold . org-html-bold) (center-block . org-html-center-block) (clock . org-html-clock) (code . org-html-code) (drawer . org-html-drawer) (dynamic-block . org-html-dynamic-block) (entity . org-html-entity) (example-block . org-html-example-block) (export-block . org-html-export-block) (export-snippet . org-html-export-snippet) (fixed-width . org-html-fixed-width) (footnote-definition . org-html-footnote-definition) (footnote-reference . org-html-footnote-reference) (headline . org-html-headline) (horizontal-rule . org-html-horizontal-rule) (inline-src-block . org-html-inline-src-block) (inlinetask . org-html-inlinetask) (inner-template . org-html-inner-template) (italic . org-html-italic) (item . org-html-item) (keyword . org-html-keyword) (latex-environment . org-html-latex-environment) (latex-fragment . org-html-latex-fragment) (line-break . org-html-line-break) (link . org-html-link) (node-property . org-html-node-property) ...) :exported-data #s(hash-table size 4001 test eq rehash-size 1.5 rehash-threshold 0.8 data ((keyword (:key "TITLE" :value "TEST" :begin 1 :end 15 :post-blank 1 :post-affiliated 1 :parent (section (:begin 1 :end 32 :contents-begin 1 :contents-end 32 :post-blank 1 :post-affiliated 1 :parent (org-data nil #4 (headline ...))) #2 (keyword (:key "OPTIONS" :value "toc:t" :begin 15 :end 32 :post-blank 1 :post-affiliated 15 :parent #4))))) "" (keyword (:key "OPTIONS" :value "toc:t" :begin 15 :end 32 :post-blank 1 :post-affiliated 15 :parent (section (:begin 1 :end 32 :contents-begin 1 :contents-end 32 :post-blank 1 :post-affiliated 1 :parent (org-data nil #4 (headline ...))) (keyword (:key "TITLE" :value "TEST" :begin 1 :end 15 :post-blank 1 :post-affiliated 1 :parent #4)) #2))) "" (section (:begin 1 :end 32 :contents-begin 1 :contents-end 32 :post-blank 1 :post-affiliated 1 :parent (org-data nil #2 (headline (:raw-value "Headline 1" :begin 32 :end 44 :pre-blank 0 :contents-begin nil :contents-end nil :level 1 :priority nil :tags nil :todo-keyword nil :todo-type nil :post-blank 1 :footnote-section-p nil :archivedp nil :commentedp nil :post-affiliated 32 :title (#("Headline 1" 0 10 ...)) :parent #4)))) (keyword (:key "TITLE" :value "TEST" :begin 1 :end 15 :post-blank 1 :post-affiliated 1 :parent #2)) (keyword (:key "OPTIONS" :value "toc:t" :begin 15 :end 32 :post-blank 1 :post-affiliated 15 :parent #2))) "\n" #("Headline 1" 0 10 (:parent (headline (:raw-value "Headline 1" :begin 32 :end 44 :pre-blank 0 :contents-begin nil :contents-end nil :level 1 :priority nil :tags nil :todo-keyword nil :todo-type nil :post-blank 1 :footnote-section-p nil :archivedp nil :commentedp nil :post-affiliated 32 :title (#2) :parent (org-data nil (section ... ... ...) #4))))) #("Headline 1" 0 10 (:parent (headline (:raw-value "Headline 1" :begin 32 :end 44 :pre-blank 0 :contents-begin nil :contents-end nil :level 1 :priority nil :tags nil :todo-keyword nil :todo-type nil :post-blank 1 :footnote-section-p nil :archivedp nil :commentedp nil :post-affiliated 32 :title (#("Headline 1" 0 10 ...)) :parent (org-data nil (section ... ... ...) #4))))) (#("Headline 1" 0 10 (:parent (headline (:raw-value "Headline 1" :begin 32 :end 44 :pre-blank 0 :contents-begin nil :contents-end nil :level 1 :priority nil :tags nil :todo-keyword nil :todo-type nil :post-blank 1 :footnote-section-p nil :archivedp nil :commentedp nil :post-affiliated 32 :title #2 :parent (org-data nil ... #5)))))) #("Headline 1" 0 10 (:parent (headline (:raw-value "Headline 1" :begin 32 :end 44 :pre-blank 0 :contents-begin nil :contents-end nil :level 1 :priority nil :tags nil :todo-keyword nil :todo-type nil :post-blank 1 :footnote-section-p nil :archivedp nil :commentedp nil :post-affiliated 32 :title (#("Headline 1" 0 10 ...)) :parent (org-data nil (section ... ... ...) #4))))) (headline (:raw-value "Headline 1" :begin 32 :end 44 :pre-blank 0 :contents-begin nil :contents-end nil :level 1 :priority nil :tags nil :todo-keyword nil :todo-type nil :post-blank 1 :footnote-section-p nil :archivedp nil :commentedp nil :post-affiliated 32 :title (#("Headline 1" 0 10 (:parent #2))) :parent (org-data nil (section (:begin 1 :end 32 :contents-begin 1 :contents-end 32 :post-blank 1 :post-affiliated 1 :parent #4) (keyword (:key "TITLE" :value "TEST" :begin 1 :end 15 :post-blank 1 :post-affiliated 1 :parent #5)) (keyword (:key "OPTIONS" :value "toc:t" :begin 15 :end 32 :post-blank 1 :post-affiliated 15 :parent #5))) #2))) #("\n<a id=\"org30c3ef9\"></a>\n\n# Headline 1\n\n" 28 38 (:parent (headline (:raw-value "Headline 1" :begin 32 :end 44 :pre-blank 0 :contents-begin nil :contents-end nil :level 1 :priority nil :tags nil :todo-keyword nil :todo-type nil :post-blank 1 :footnote-section-p nil :archivedp nil :commentedp nil :post-affiliated 32 :title (#("Headline 1" 0 10 ...)) :parent (org-data nil (section ... ... ...) #4))))) (org-data nil (section (:begin 1 :end 32 :contents-begin 1 :contents-end 32 :post-blank 1 :post-affiliated 1 :parent #2) (keyword (:key "TITLE" :value "TEST" :begin 1 :end 15 :post-blank 1 :post-affiliated 1 :parent #3)) (keyword (:key "OPTIONS" :value "toc:t" :begin 15 :end 32 :post-blank 1 :post-affiliated 15 :parent #3))) (headline (:raw-value "Headline 1" :begin 32 :end 44 :pre-blank 0 :contents-begin nil :contents-end nil :level 1 :priority nil :tags nil :todo-keyword nil :todo-type nil :post-blank 1 :footnote-section-p nil :archivedp nil :commentedp nil :post-affiliated 32 :title (#("Headline 1" 0 10 (:parent #3))) :parent #2))) #("\n\n<a id=\"org30c3ef9\"></a>\n\n# Headline 1\n\n" 29 39 (:parent (headline (:raw-value "Headline 1" :begin 32 :end 44 :pre-blank 0 :contents-begin nil :contents-end nil :level 1 :priority nil :tags nil :todo-keyword nil :todo-type nil :post-blank 1 :footnote-section-p nil :archivedp nil :commentedp nil :post-affiliated 32 :title (#("Headline 1" 0 10 ...)) :parent (org-data nil (section ... ... ...) #4))))) ...)) :input-buffer "test.org" :input-file "/Users/yuezhu/test.org" :md-footnote-format "<sup>%s</sup>" :md-footnotes-section "%s%s" :md-headline-style atx :html-doctype "xhtml-strict" :html-container "div" :description nil :keywords nil :html-html5-fancy nil :html-link-use-abs-url nil :html-link-home "" :html-link-up "" :html-mathjax "" :html-postamble auto :html-preamble t :html-head "" :html-head-extra "" :subtitle nil :html-head-include-default-style t :html-head-include-scripts t ...) nil)
  org-md-inner-template(#("\n\n<a id=\"org30c3ef9\"></a>\n\n# Headline 1\n" 29 39 (:parent (headline (:raw-value "Headline 1" :begin 32 :end 44 :pre-blank 0 :contents-begin nil :contents-end nil :level 1 :priority nil :tags nil :todo-keyword nil :todo-type nil :post-blank 1 :footnote-section-p nil :archivedp nil :commentedp nil :post-affiliated 32 :title (#("Headline 1" 0 10 (:parent #2))) :parent (org-data nil (section (:begin 1 :end 32 :contents-begin 1 :contents-end 32 :post-blank 1 :post-affiliated 1 :parent #4) (keyword (:key "TITLE" :value "TEST" :begin 1 :end 15 :post-blank 1 :post-affiliated 1 :parent #5)) (keyword (:key "OPTIONS" :value "toc:t" :begin 15 :end 32 :post-blank 1 :post-affiliated 15 :parent #5))) #2))))) (:export-options nil :back-end [cl-struct-org-export-backend md html ((bold . org-md-bold) (code . org-md-verbatim) (example-block . org-md-example-block) (export-block . org-md-export-block) (fixed-width . org-md-example-block) (headline . org-md-headline) (horizontal-rule . org-md-horizontal-rule) (inline-src-block . org-md-verbatim) (inner-template . org-md-inner-template) (italic . org-md-italic) (item . org-md-item) (keyword . org-md-keyword) (line-break . org-md-line-break) (link . org-md-link) (node-property . org-md-node-property) (paragraph . org-md-paragraph) (plain-list . org-md-plain-list) (plain-text . org-md-plain-text) (property-drawer . org-md-property-drawer) (quote-block . org-md-quote-block) (section . org-md-section) (src-block . org-md-example-block) (template . org-md-template) (verbatim . org-md-verbatim)) ((:md-footnote-format nil nil org-md-footnote-format) (:md-footnotes-section nil nil org-md-footnotes-section) (:md-headline-style nil nil org-md-headline-style)) ((:filter-parse-tree . org-md-separate-elements)) nil (109 "Export to Markdown" ((77 "To temporary buffer" (lambda (a s v b) (org-md-export-as-markdown a s v))) (109 "To file" (lambda (a s v b) (org-md-export-to-markdown a s v))) (111 "To file and open" (lambda (a s v b) (if a (org-md-export-to-markdown t s v) (org-open-file ...))))))] :translate-alist ((bold . org-md-bold) (code . org-md-verbatim) (example-block . org-md-example-block) (export-block . org-md-export-block) (fixed-width . org-md-example-block) (headline . org-md-headline) (horizontal-rule . org-md-horizontal-rule) (inline-src-block . org-md-verbatim) (inner-template . org-md-inner-template) (italic . org-md-italic) (item . org-md-item) (keyword . org-md-keyword) (line-break . org-md-line-break) (link . org-md-link) (node-property . org-md-node-property) (paragraph . org-md-paragraph) (plain-list . org-md-plain-list) (plain-text . org-md-plain-text) (property-drawer . org-md-property-drawer) (quote-block . org-md-quote-block) (section . org-md-section) (src-block . org-md-example-block) (template . org-md-template) (verbatim . org-md-verbatim) (bold . org-html-bold) (center-block . org-html-center-block) (clock . org-html-clock) (code . org-html-code) (drawer . org-html-drawer) (dynamic-block . org-html-dynamic-block) (entity . org-html-entity) (example-block . org-html-example-block) (export-block . org-html-export-block) (export-snippet . org-html-export-snippet) (fixed-width . org-html-fixed-width) (footnote-definition . org-html-footnote-definition) (footnote-reference . org-html-footnote-reference) (headline . org-html-headline) (horizontal-rule . org-html-horizontal-rule) (inline-src-block . org-html-inline-src-block) (inlinetask . org-html-inlinetask) (inner-template . org-html-inner-template) (italic . org-html-italic) (item . org-html-item) (keyword . org-html-keyword) (latex-environment . org-html-latex-environment) (latex-fragment . org-html-latex-fragment) (line-break . org-html-line-break) (link . org-html-link) (node-property . org-html-node-property) ...) :exported-data #s(hash-table size 4001 test eq rehash-size 1.5 rehash-threshold 0.8 data ((keyword (:key "TITLE" :value "TEST" :begin 1 :end 15 :post-blank 1 :post-affiliated 1 :parent (section (:begin 1 :end 32 :contents-begin 1 :contents-end 32 :post-blank 1 :post-affiliated 1 :parent (org-data nil #4 (headline ...))) #2 (keyword (:key "OPTIONS" :value "toc:t" :begin 15 :end 32 :post-blank 1 :post-affiliated 15 :parent #4))))) "" (keyword (:key "OPTIONS" :value "toc:t" :begin 15 :end 32 :post-blank 1 :post-affiliated 15 :parent (section (:begin 1 :end 32 :contents-begin 1 :contents-end 32 :post-blank 1 :post-affiliated 1 :parent (org-data nil #4 (headline ...))) (keyword (:key "TITLE" :value "TEST" :begin 1 :end 15 :post-blank 1 :post-affiliated 1 :parent #4)) #2))) "" (section (:begin 1 :end 32 :contents-begin 1 :contents-end 32 :post-blank 1 :post-affiliated 1 :parent (org-data nil #2 (headline (:raw-value "Headline 1" :begin 32 :end 44 :pre-blank 0 :contents-begin nil :contents-end nil :level 1 :priority nil :tags nil :todo-keyword nil :todo-type nil :post-blank 1 :footnote-section-p nil :archivedp nil :commentedp nil :post-affiliated 32 :title (#("Headline 1" 0 10 ...)) :parent #4)))) (keyword (:key "TITLE" :value "TEST" :begin 1 :end 15 :post-blank 1 :post-affiliated 1 :parent #2)) (keyword (:key "OPTIONS" :value "toc:t" :begin 15 :end 32 :post-blank 1 :post-affiliated 15 :parent #2))) "\n" #("Headline 1" 0 10 (:parent (headline (:raw-value "Headline 1" :begin 32 :end 44 :pre-blank 0 :contents-begin nil :contents-end nil :level 1 :priority nil :tags nil :todo-keyword nil :todo-type nil :post-blank 1 :footnote-section-p nil :archivedp nil :commentedp nil :post-affiliated 32 :title (#2) :parent (org-data nil (section ... ... ...) #4))))) #("Headline 1" 0 10 (:parent (headline (:raw-value "Headline 1" :begin 32 :end 44 :pre-blank 0 :contents-begin nil :contents-end nil :level 1 :priority nil :tags nil :todo-keyword nil :todo-type nil :post-blank 1 :footnote-section-p nil :archivedp nil :commentedp nil :post-affiliated 32 :title (#("Headline 1" 0 10 ...)) :parent (org-data nil (section ... ... ...) #4))))) (#("Headline 1" 0 10 (:parent (headline (:raw-value "Headline 1" :begin 32 :end 44 :pre-blank 0 :contents-begin nil :contents-end nil :level 1 :priority nil :tags nil :todo-keyword nil :todo-type nil :post-blank 1 :footnote-section-p nil :archivedp nil :commentedp nil :post-affiliated 32 :title #2 :parent (org-data nil ... #5)))))) #("Headline 1" 0 10 (:parent (headline (:raw-value "Headline 1" :begin 32 :end 44 :pre-blank 0 :contents-begin nil :contents-end nil :level 1 :priority nil :tags nil :todo-keyword nil :todo-type nil :post-blank 1 :footnote-section-p nil :archivedp nil :commentedp nil :post-affiliated 32 :title (#("Headline 1" 0 10 ...)) :parent (org-data nil (section ... ... ...) #4))))) (headline (:raw-value "Headline 1" :begin 32 :end 44 :pre-blank 0 :contents-begin nil :contents-end nil :level 1 :priority nil :tags nil :todo-keyword nil :todo-type nil :post-blank 1 :footnote-section-p nil :archivedp nil :commentedp nil :post-affiliated 32 :title (#("Headline 1" 0 10 (:parent #2))) :parent (org-data nil (section (:begin 1 :end 32 :contents-begin 1 :contents-end 32 :post-blank 1 :post-affiliated 1 :parent #4) (keyword (:key "TITLE" :value "TEST" :begin 1 :end 15 :post-blank 1 :post-affiliated 1 :parent #5)) (keyword (:key "OPTIONS" :value "toc:t" :begin 15 :end 32 :post-blank 1 :post-affiliated 15 :parent #5))) #2))) #("\n<a id=\"org30c3ef9\"></a>\n\n# Headline 1\n\n" 28 38 (:parent (headline (:raw-value "Headline 1" :begin 32 :end 44 :pre-blank 0 :contents-begin nil :contents-end nil :level 1 :priority nil :tags nil :todo-keyword nil :todo-type nil :post-blank 1 :footnote-section-p nil :archivedp nil :commentedp nil :post-affiliated 32 :title (#("Headline 1" 0 10 ...)) :parent (org-data nil (section ... ... ...) #4))))) (org-data nil (section (:begin 1 :end 32 :contents-begin 1 :contents-end 32 :post-blank 1 :post-affiliated 1 :parent #2) (keyword (:key "TITLE" :value "TEST" :begin 1 :end 15 :post-blank 1 :post-affiliated 1 :parent #3)) (keyword (:key "OPTIONS" :value "toc:t" :begin 15 :end 32 :post-blank 1 :post-affiliated 15 :parent #3))) (headline (:raw-value "Headline 1" :begin 32 :end 44 :pre-blank 0 :contents-begin nil :contents-end nil :level 1 :priority nil :tags nil :todo-keyword nil :todo-type nil :post-blank 1 :footnote-section-p nil :archivedp nil :commentedp nil :post-affiliated 32 :title (#("Headline 1" 0 10 (:parent #3))) :parent #2))) #("\n\n<a id=\"org30c3ef9\"></a>\n\n# Headline 1\n\n" 29 39 (:parent (headline (:raw-value "Headline 1" :begin 32 :end 44 :pre-blank 0 :contents-begin nil :contents-end nil :level 1 :priority nil :tags nil :todo-keyword nil :todo-type nil :post-blank 1 :footnote-section-p nil :archivedp nil :commentedp nil :post-affiliated 32 :title (#("Headline 1" 0 10 ...)) :parent (org-data nil (section ... ... ...) #4))))) ...)) :input-buffer "test.org" :input-file "/Users/yuezhu/test.org" :md-footnote-format "<sup>%s</sup>" :md-footnotes-section "%s%s" :md-headline-style atx :html-doctype "xhtml-strict" :html-container "div" :description nil :keywords nil :html-html5-fancy nil :html-link-use-abs-url nil :html-link-home "" :html-link-up "" :html-mathjax "" :html-postamble auto :html-preamble t :html-head "" :html-head-extra "" :subtitle nil :html-head-include-default-style t :html-head-include-scripts t ...))
  org-export-as(md nil nil nil (:output-file "test.md"))
  org-export-to-file(md "test.md" nil nil nil)
  org-md-export-to-markdown(nil nil nil)
  (lambda (a s v b) (org-md-export-to-markdown a s v))(nil nil nil nil)
  org-export-dispatch(nil)
  funcall-interactively(org-export-dispatch nil)
  call-interactively(org-export-dispatch nil nil)
  command-execute(org-export-dispatch)

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] ox-md.el: fixed an issue where exporting markdown ToC would fail if heading numbering is not enabled
  2018-04-20 15:05 [PATCH] ox-md.el: fixed an issue where exporting markdown ToC would fail if heading numbering is not enabled Yue Zhu
@ 2018-04-21  9:14 ` Nicolas Goaziou
  0 siblings, 0 replies; 2+ messages in thread
From: Nicolas Goaziou @ 2018-04-21  9:14 UTC (permalink / raw)
  To: Yue Zhu; +Cc: emacs-orgmode

Hello,

Yue Zhu <yuezhu3@gmail.com> writes:

> When exporting markdown with ToC, if heading numbering is not enabled, it
> would fail with the attached backtrace. The cause is that the function
> `org-md--build-toc' in `ox-md.el' does not properly handle this case which
> effectively results in a function call `(format "%d." nil)'. In my patch,
> when exporting markdown with ToC, if heading numbering is not enabled, ToC
> will be shown as an unordered list.

Applied. Thank you.

Regards,

-- 
Nicolas Goaziou

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-04-21  9:14 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-04-20 15:05 [PATCH] ox-md.el: fixed an issue where exporting markdown ToC would fail if heading numbering is not enabled Yue Zhu
2018-04-21  9:14 ` Nicolas Goaziou

Code repositories for project(s) associated with this inbox:

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).