summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJambunathan K <kjambunathan@gmail.com>2012-04-11 01:01:50 +0530
committerJambunathan K <kjambunathan@gmail.com>2012-04-11 01:04:31 +0530
commitbb291df2966eaa47fc69a1551adf8275e4f67623 (patch)
tree27742cbf16cf9111c26f17712a4669cc16f7301d
parent5841dbd5ec40a31cc7b8b7291cb7fad6fd59ad8b (diff)
downloadorg-mode-bb291df2966eaa47fc69a1551adf8275e4f67623.tar.gz
org-e-odt: Handle caption/label for src blocks.
Add Listing-related entries to OrgOdtContentTemplate.xml, OrgOdtStyles.xml.
-rw-r--r--EXPERIMENTAL/org-e-odt.el20
-rw-r--r--etc/styles/OrgOdtContentTemplate.xml1
-rw-r--r--etc/styles/OrgOdtStyles.xml5
3 files changed, 23 insertions, 3 deletions
diff --git a/EXPERIMENTAL/org-e-odt.el b/EXPERIMENTAL/org-e-odt.el
index 6a251a3..bf5bb8f 100644
--- a/EXPERIMENTAL/org-e-odt.el
+++ b/EXPERIMENTAL/org-e-odt.el
@@ -1149,7 +1149,7 @@ ATTR is a string of other attributes of the a element."
;; grok language setting
(en-strings (assoc-default "en" org-e-odt-category-strings))
(lang (plist-get info :language)) ; FIXME
- (lang-strings (assoc-default lang org-export-odt-category-strings))
+ (lang-strings (assoc-default lang org-e-odt-category-strings))
;; retrieve localized category sting
(pos (- (length org-e-odt-category-map-alist)
(length (memq label-props org-e-odt-category-map-alist))))
@@ -1799,6 +1799,7 @@ standard Emacs.")
(src . "OrgSrcBlock")
(illustration . "Illustration")
(table . "Table")
+ (listing . "Listing")
(definition-term . "Text_20_body_20_bold")
(horizontal-line . "Horizontal_20_Line")))
(character . ((bold . "Bold")
@@ -1974,7 +1975,7 @@ specifiers - %e and %n. %e is replaced with the CATEGORY-NAME.
`org-e-odt-format-label-reference'.")
(defcustom org-e-odt-category-strings
- '(("en" "Table" "Figure" "Equation" "Equation"))
+ '(("en" "Table" "Figure" "Equation" "Equation" "Listing"))
"Specify category strings for various captionable entities.
Captionable entity can be one of a Table, an Embedded Image, a
LaTeX fragment (generated with dvipng) or a Math Formula.
@@ -2002,6 +2003,9 @@ below.
(string :tag "Category string"))
(choice :tag "Dvipng Image"
(const :tag "Use Default" nil)
+ (string :tag "Category string"))
+ (choice :tag "Listing"
+ (const :tag "Use Default" nil)
(string :tag "Category string")))))
(defvar org-e-odt-category-map-alist
@@ -2009,6 +2013,7 @@ below.
("__Figure__" "Illustration" "value")
("__MathFormula__" "Text" "math-formula")
("__DvipngImage__" "Equation" "value")
+ ("__Listing__" "Listing" "value")
;; ("__Table__" "Table" "category-and-value")
;; ("__Figure__" "Figure" "category-and-value")
;; ("__DvipngImage__" "Equation" "category-and-value")
@@ -3866,6 +3871,8 @@ INFO is a plist holding contextual information. See
; FIXME: Check if it is
; acutally latex eqn.
"__MathFormula__")
+ ((eq (org-element-type destination) 'src-block)
+ "__Listing__")
(t (error "Handle enumeration of %S" destination)))))
(org-e-odt-format-label-reference label default-category number)))))))
;; Coderef: replace link with the reference name or the
@@ -4065,13 +4072,20 @@ CONTENTS holds the contents of the item. INFO is a plist holding
contextual information."
(let* ((lang (org-element-property :language src-block))
(caption (org-element-property :caption src-block))
+ (short-caption (and (cdr caption) (org-export-secondary-string
+ (cdr caption) 'e-odt info)))
+ (caption (and (car caption) (org-export-secondary-string
+ (car caption) 'e-odt info)))
(label (org-element-property :name src-block)))
;; FIXME: Handle caption
;; caption-str (when caption)
;; (main (org-export-secondary-string (car caption) 'e-odt info))
;; (secondary (org-export-secondary-string (cdr caption) 'e-odt info))
;; (caption-str (org-e-odt--caption/label-string caption label info))
- (org-e-odt-format-code src-block info)))
+ (concat
+ (org-e-odt-format-stylized-paragraph
+ 'listing (org-e-odt-format-entity-caption label caption "__Listing__"))
+ (org-e-odt-format-code src-block info))))
;;;; Statistics Cookie
diff --git a/etc/styles/OrgOdtContentTemplate.xml b/etc/styles/OrgOdtContentTemplate.xml
index cd7ff0e..55e1b78 100644
--- a/etc/styles/OrgOdtContentTemplate.xml
+++ b/etc/styles/OrgOdtContentTemplate.xml
@@ -256,6 +256,7 @@
<text:sequence-decl text:display-outline-level="0" text:name="Drawing"/>
<text:sequence-decl text:display-outline-level="0" text:name="Equation"/>
<text:sequence-decl text:display-outline-level="0" text:name="Figure"/>
+ <text:sequence-decl text:display-outline-level="0" text:name="Listing"/>
</text:sequence-decls>
</office:text>
</office:body>
diff --git a/etc/styles/OrgOdtStyles.xml b/etc/styles/OrgOdtStyles.xml
index 470b7b1..b2f9a85 100644
--- a/etc/styles/OrgOdtStyles.xml
+++ b/etc/styles/OrgOdtStyles.xml
@@ -319,6 +319,11 @@
<style:style style:name="Table" style:family="paragraph" style:parent-style-name="Caption" style:class="extra">
<style:paragraph-properties fo:text-align="center" style:justify-single-word="false"/>
</style:style>
+ <style:style style:name="Listing" style:family="paragraph" style:parent-style-name="Caption" style:class="extra">
+ <style:paragraph-properties fo:margin-left="0cm" fo:margin-right="0cm" fo:text-indent="0cm" style:auto-text-indent="false" fo:keep-with-next="always">
+ <style:tab-stops/>
+ </style:paragraph-properties>
+ </style:style>
<style:style style:name="Horizontal_20_Line" style:display-name="Horizontal Line" style:family="paragraph" style:parent-style-name="Standard" style:next-style-name="Text_20_body" style:class="html">
<style:paragraph-properties fo:margin-top="0cm" fo:margin-bottom="0.499cm" style:border-line-width-bottom="0.002cm 0.035cm 0.002cm" fo:padding="0cm" fo:border-left="none" fo:border-right="none" fo:border-top="none" fo:border-bottom="0.039cm double #808080" text:number-lines="false" text:line-number="0" style:join-border="false"/>
<style:text-properties fo:font-size="6pt" style:font-size-asian="6pt" style:font-size-complex="6pt"/>