org-e-odt.el: Fix example, fixed width, QUOTE and verse blocks
This commit is contained in:
parent
8f2a921cf9
commit
8ee5ce1d2b
|
@ -1056,6 +1056,7 @@ ATTR is a string of other attributes of the a element."
|
||||||
(setq hfy-user-sheet-assoc nil)
|
(setq hfy-user-sheet-assoc nil)
|
||||||
|
|
||||||
;; init conten.xml
|
;; init conten.xml
|
||||||
|
(require 'nxml-mode)
|
||||||
(with-current-buffer
|
(with-current-buffer
|
||||||
(let ((nxml-auto-insert-xml-declaration-flag nil))
|
(let ((nxml-auto-insert-xml-declaration-flag nil))
|
||||||
(find-file-noselect content-file t))
|
(find-file-noselect content-file t))
|
||||||
|
@ -2975,10 +2976,8 @@ contextual information."
|
||||||
(defun org-e-odt-example-block (example-block contents info)
|
(defun org-e-odt-example-block (example-block contents info)
|
||||||
"Transcode a EXAMPLE-BLOCK element from Org to ODT.
|
"Transcode a EXAMPLE-BLOCK element from Org to ODT.
|
||||||
CONTENTS is nil. INFO is a plist holding contextual information."
|
CONTENTS is nil. INFO is a plist holding contextual information."
|
||||||
(let* ((options (or (org-element-property :options example-block) ""))
|
(org-e-odt--wrap-label
|
||||||
(value (org-export-handle-code example-block info nil nil t)))
|
example-block (org-e-odt-format-code example-block info)))
|
||||||
(org-e-odt--wrap-label
|
|
||||||
example-block (org-e-odt-format-source-code-or-example value nil))))
|
|
||||||
|
|
||||||
|
|
||||||
;;;; Export Snippet
|
;;;; Export Snippet
|
||||||
|
@ -3005,9 +3004,8 @@ CONTENTS is nil. INFO is a plist holding contextual information."
|
||||||
"Transcode a FIXED-WIDTH element from Org to ODT.
|
"Transcode a FIXED-WIDTH element from Org to ODT.
|
||||||
CONTENTS is nil. INFO is a plist holding contextual information."
|
CONTENTS is nil. INFO is a plist holding contextual information."
|
||||||
(org-e-odt--wrap-label
|
(org-e-odt--wrap-label
|
||||||
fixed-width
|
fixed-width (org-e-odt-do-format-code
|
||||||
(org-e-odt-format-source-code-or-example
|
(org-element-property :value fixed-width))))
|
||||||
(org-element-property :value fixed-width) nil)))
|
|
||||||
|
|
||||||
|
|
||||||
;;;; Footnote Definition
|
;;;; Footnote Definition
|
||||||
|
@ -3754,7 +3752,7 @@ holding contextual information."
|
||||||
CONTENTS is nil. INFO is a plist holding contextual information."
|
CONTENTS is nil. INFO is a plist holding contextual information."
|
||||||
(let ((value (org-remove-indentation
|
(let ((value (org-remove-indentation
|
||||||
(org-element-property :value quote-section))))
|
(org-element-property :value quote-section))))
|
||||||
(when value (org-e-odt-format-source-code-or-example value nil))))
|
(when value (org-e-odt-do-format-code value))))
|
||||||
|
|
||||||
|
|
||||||
;;;; Section
|
;;;; Section
|
||||||
|
@ -4109,22 +4107,15 @@ channel."
|
||||||
"Transcode a VERSE-BLOCK element from Org to ODT.
|
"Transcode a VERSE-BLOCK element from Org to ODT.
|
||||||
CONTENTS is verse block contents. INFO is a plist holding
|
CONTENTS is verse block contents. INFO is a plist holding
|
||||||
contextual information."
|
contextual information."
|
||||||
;; Replace each newline character with line break. Also replace
|
;; Add line breaks to each line of verse.
|
||||||
;; each blank line with a line break.
|
|
||||||
(setq contents (replace-regexp-in-string
|
(setq contents (replace-regexp-in-string
|
||||||
"^ *\\\\\\\\$" "<br/>\n"
|
"\\(<text:line-break/>\\)?[ \t]*\n"
|
||||||
(replace-regexp-in-string
|
"<text:line-break/>" contents))
|
||||||
"\\(\\\\\\\\\\)?[ \t]*\n" " <br/>\n" contents)))
|
;; Replace tabs and spaces.
|
||||||
|
(setq contents (org-e-odt-fill-tabs-and-spaces contents))
|
||||||
;; Replace each white space at beginning of a line with a
|
;; Surround it in a verse environment.
|
||||||
;; non-breaking space.
|
|
||||||
(while (string-match "^[ \t]+" contents)
|
|
||||||
(let ((new-str (org-e-odt-format-spaces
|
|
||||||
(length (match-string 0 contents)))))
|
|
||||||
(setq contents (replace-match new-str nil t contents))))
|
|
||||||
|
|
||||||
(org-e-odt--wrap-label
|
(org-e-odt--wrap-label
|
||||||
verse-block (format "<p class=\"verse\">\n%s</p>" contents)))
|
verse-block (org-e-odt-format-stylized-paragraph 'verse contents)))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue