summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJambunathan K <kjambunathan@gmail.com>2011-10-07 19:02:04 +0530
committerJambunathan K <kjambunathan@gmail.com>2011-10-07 19:02:04 +0530
commitfec067a4057aa78510544e665c45b6a89a4b6fe2 (patch)
tree5aaefd1ec44168828c87ee768e881a3ee8f61517
parent13b4f6b2e06a76a52ff006e0a9960c4dcac79087 (diff)
downloadorg-mode-fec067a4057aa78510544e665c45b6a89a4b6fe2.tar.gz
org-odt.el: Add bottom margin to source or example blocks
* contrib/odt/styles/OrgOdtStyles.xml (OrgFixedWidthBlockLastLine, OrgSrcBlockLastLine): New styles to be applied to the last line of the source or example blocks. * contrib/lisp/org-odt.el (org-odt-format-source-code-or-example-plain) (org-odt-format-source-code-or-example-colored): Use above styles.
-rw-r--r--contrib/lisp/org-odt.el35
-rw-r--r--contrib/odt/styles/OrgOdtStyles.xml8
2 files changed, 30 insertions, 13 deletions
diff --git a/contrib/lisp/org-odt.el b/contrib/lisp/org-odt.el
index 15a2d89..4c516e1 100644
--- a/contrib/lisp/org-odt.el
+++ b/contrib/lisp/org-odt.el
@@ -999,14 +999,18 @@ to make available an enhanced version of `htmlfontify' library."
"Format source or example blocks much like fixedwidth blocks.
Use this when `org-export-odt-use-htmlfontify' option is turned
off."
- (mapconcat
- (lambda (line)
- (org-odt-format-source-line-with-line-number-and-label
- line rpllbl num (lambda (line)
- (org-odt-fill-tabs-and-spaces
- (org-xml-encode-plain-text line)))
- 'fixedwidth))
- (org-split-string lines "[\r\n]") "\n"))
+ (let* ((lines (org-split-string lines "[\r\n]"))
+ (line-count (length lines))
+ (i 0))
+ (mapconcat
+ (lambda (line)
+ (incf i)
+ (org-odt-format-source-line-with-line-number-and-label
+ line rpllbl num (lambda (line)
+ (org-odt-fill-tabs-and-spaces
+ (org-xml-encode-plain-text line)))
+ (if (= i line-count) "OrgFixedWidthBlockLastLine" "OrgFixedWidthBlock")))
+ lines "\n")))
(defvar org-src-block-paragraph-format
"<style:style style:name=\"OrgSrcBlock\" style:family=\"paragraph\" style:parent-style-name=\"Preformatted_20_Text\">
@@ -1117,11 +1121,16 @@ turned on."
(insert (format "<text:span text:style-name=\"%s\">" style))))
(hfy-end-span-handler (lambda nil (insert "</text:span>"))))
(when (fboundp 'htmlfontify-string)
- (mapconcat
- (lambda (line)
- (org-odt-format-source-line-with-line-number-and-label
- line rpllbl num 'htmlfontify-string 'src))
- (org-split-string lines "[\r\n]") "\n"))))
+ (let* ((lines (org-split-string lines "[\r\n]"))
+ (line-count (length lines))
+ (i 0))
+ (mapconcat
+ (lambda (line)
+ (incf i)
+ (org-odt-format-source-line-with-line-number-and-label
+ line rpllbl num 'htmlfontify-string
+ (if (= i line-count) "OrgSrcBlockLastLine" "OrgSrcBlock")))
+ lines "\n")))))
(defun org-odt-format-source-code-or-example (lines lang caption textareap
cols rows num cont
diff --git a/contrib/odt/styles/OrgOdtStyles.xml b/contrib/odt/styles/OrgOdtStyles.xml
index 1615190..5ec868a 100644
--- a/contrib/odt/styles/OrgOdtStyles.xml
+++ b/contrib/odt/styles/OrgOdtStyles.xml
@@ -251,6 +251,14 @@
</style:paragraph-properties>
</style:style>
+ <style:style style:name="OrgFixedWidthBlockLastLine" style:family="paragraph" style:parent-style-name="OrgFixedWidthBlock">
+ <style:paragraph-properties fo:margin-top="0cm" fo:margin-bottom="0.21cm"/>
+ </style:style>
+
+ <style:style style:name="OrgSrcBlockLastLine" style:family="paragraph" style:parent-style-name="OrgSrcBlock">
+ <style:paragraph-properties fo:margin-top="0cm" fo:margin-bottom="0.21cm"/>
+ </style:style>
+
<style:style style:name="OrgCenter" style:family="paragraph" style:parent-style-name="Text_20_body">
<style:paragraph-properties fo:text-align="center" style:justify-single-word="false"/>
</style:style>