forked from mirrors/org-mode
ox-texinfo: Handle listings with captions and list of listings
* lisp/ox-texinfo.el (org-texinfo-keyword): Handle "#+TOC: listings". (org-texinfo-src-block): Wrap listings with captions within @float.
This commit is contained in:
parent
e36139ea02
commit
4049c680fb
|
@ -932,7 +932,10 @@ CONTENTS is nil. INFO is a plist holding contextual information."
|
||||||
((string= key "TOC")
|
((string= key "TOC")
|
||||||
(cond ((org-string-match-p "\\<tables\\>" value)
|
(cond ((org-string-match-p "\\<tables\\>" value)
|
||||||
(concat "@listoffloats "
|
(concat "@listoffloats "
|
||||||
(org-export-translate "Table" :utf-8 info))))))))
|
(org-export-translate "Table" :utf-8 info)))
|
||||||
|
((org-string-match-p "\\<listings\\>" value)
|
||||||
|
(concat "@listoffloats "
|
||||||
|
(org-export-translate "Listing" :utf-8 info))))))))
|
||||||
|
|
||||||
;;;; Line Break
|
;;;; Line Break
|
||||||
|
|
||||||
|
@ -1305,11 +1308,22 @@ as a communication channel."
|
||||||
"Transcode a SRC-BLOCK element from Org to Texinfo.
|
"Transcode a SRC-BLOCK element from Org to Texinfo.
|
||||||
CONTENTS holds the contents of the item. INFO is a plist holding
|
CONTENTS holds the contents of the item. INFO is a plist holding
|
||||||
contextual information."
|
contextual information."
|
||||||
(let ((lispp (org-string-match-p "lisp"
|
(let* ((lisp (org-string-match-p "lisp"
|
||||||
(org-element-property :language src-block)))
|
(org-element-property :language src-block)))
|
||||||
(code (org-texinfo--sanitize-content
|
(code (org-texinfo--sanitize-content
|
||||||
(org-export-format-code-default src-block info))))
|
(org-export-format-code-default src-block info)))
|
||||||
(format (if lispp "@lisp\n%s@end lisp" "@example\n%s@end example") code)))
|
(value (format
|
||||||
|
(if lisp "@lisp\n%s@end lisp" "@example\n%s@end example")
|
||||||
|
code))
|
||||||
|
(caption (org-export-get-caption src-block))
|
||||||
|
(shortcaption (org-export-get-caption src-block t)))
|
||||||
|
(if (not (or caption shortcaption)) value
|
||||||
|
(org-texinfo--wrap-float value
|
||||||
|
info
|
||||||
|
(org-export-translate "Listing" :utf-8 info)
|
||||||
|
(org-element-property :name src-block)
|
||||||
|
caption
|
||||||
|
shortcaption))))
|
||||||
|
|
||||||
;;;; Statistics Cookie
|
;;;; Statistics Cookie
|
||||||
|
|
||||||
|
|
13
lisp/ox.el
13
lisp/ox.el
|
@ -5460,6 +5460,19 @@ them."
|
||||||
:utf-8 "Список таблиц")
|
:utf-8 "Список таблиц")
|
||||||
("sv" :default "Tabeller")
|
("sv" :default "Tabeller")
|
||||||
("zh-CN" :html "表格目录" :utf-8 "表格目录"))
|
("zh-CN" :html "表格目录" :utf-8 "表格目录"))
|
||||||
|
("Listing"
|
||||||
|
("da" :default "Program")
|
||||||
|
("de" :default "Programmlisting")
|
||||||
|
("es" :default "Listado de programa")
|
||||||
|
("et" :default "Loend")
|
||||||
|
("fr" :default "Programme" :html "Programme")
|
||||||
|
("ja" :default "ソースコード")
|
||||||
|
("no" :default "Dataprogram")
|
||||||
|
("nb" :default "Dataprogram")
|
||||||
|
("pt_BR" :default "Listagem")
|
||||||
|
("ru" :html "Распечатка"
|
||||||
|
:utf-8 "Распечатка")
|
||||||
|
("zh-CN" :html "代码" :utf-8 "代码"))
|
||||||
("Listing %d:"
|
("Listing %d:"
|
||||||
("da" :default "Program %d")
|
("da" :default "Program %d")
|
||||||
("de" :default "Programmlisting %d")
|
("de" :default "Programmlisting %d")
|
||||||
|
|
Loading…
Reference in New Issue