forked from mirrors/org-mode
Prettify inlinetasks in odt and (x)html backends
* lisp/org-inlinetask.el (org-inlinetask-export-templates): Fixed template for html so that the exported file is valid xhtml. Added template for odt. (org-inlinetask-export-handler): Fix typo in the regexp that trims content. Make sure that the content is flanked by paragraph boundaries on either side. * lisp/org-html.el (org-export-html-style-default): Add style for inlinetask. * contrib/lisp/org-xhtml.el (org-export-xhtml-style-default): Add style for inlinetask. * contrib/odt/styles/OrgOdtStyles.xml: Added following custom styles: OrgInlineTaskHeading and OrgInlineTaskFrame. * contrib/lisp/org-odt.el (org-odt-format-textbox) (org-odt-format-inlinetask): Added Refer following threads: 1. http://lists.gnu.org/archive/html/emacs-orgmode/2011-08/msg00238.html 2. http://lists.gnu.org/archive/html/emacs-orgmode/2011-08/msg00154.html Thanks to Suvayu Ali for reporting this issue and suggesting improvements.
This commit is contained in:
parent
9d5c5c3d26
commit
395a816a18
|
@ -1076,6 +1076,28 @@ MAY-INLINE-P allows inlining it as an image."
|
|||
|
||||
(org-export-odt-do-format-image embed-as caption attr label
|
||||
size href))))
|
||||
(defun org-odt-format-textbox (text style)
|
||||
(let ((draw-frame-pair
|
||||
'("<draw:frame draw:style-name=\"%s\"
|
||||
text:anchor-type=\"paragraph\"
|
||||
style:rel-width=\"100%%\"
|
||||
draw:z-index=\"0\">" . "</draw:frame>")))
|
||||
(org-odt-format-tags
|
||||
draw-frame-pair
|
||||
(org-odt-format-tags
|
||||
'("<draw:text-box fo:min-height=\"%dcm\">" . "</draw:text-box>")
|
||||
text 0) style)))
|
||||
|
||||
(defun org-odt-format-inlinetask (heading content
|
||||
&optional todo priority tags)
|
||||
(org-odt-format-stylized-paragraph
|
||||
nil (org-odt-format-textbox
|
||||
(concat (org-odt-format-stylized-paragraph
|
||||
"OrgInlineTaskHeading"
|
||||
(org-lparse-format
|
||||
'HEADLINE (concat (org-lparse-format-todo todo) " " heading)
|
||||
nil tags))
|
||||
content) "OrgInlineTaskFrame")))
|
||||
|
||||
(defun org-export-odt-do-format-image (embed-as caption attr label
|
||||
size href)
|
||||
|
|
|
@ -165,6 +165,12 @@ not be modified."
|
|||
dt { font-weight: bold; }
|
||||
div.figure { padding: 0.5em; }
|
||||
div.figure p { text-align: center; }
|
||||
div.inlinetask {
|
||||
padding:10px;
|
||||
border:2px solid gray;
|
||||
margin:10px;
|
||||
background: #ffffcc;
|
||||
}
|
||||
textarea { overflow-x: auto; }
|
||||
.linenr { font-size:smaller }
|
||||
.code-highlighted {background-color:#ffff00;}
|
||||
|
|
|
@ -359,6 +359,17 @@
|
|||
<style:style style:name="Frame" style:family="graphic">
|
||||
<style:graphic-properties text:anchor-type="paragraph" svg:x="0cm" svg:y="0cm" fo:margin-left="0.201cm" fo:margin-right="0.201cm" fo:margin-top="0.201cm" fo:margin-bottom="0.201cm" style:wrap="parallel" style:number-wrapped-paragraphs="no-limit" style:wrap-contour="false" style:vertical-pos="top" style:vertical-rel="paragraph-content" style:horizontal-pos="center" style:horizontal-rel="paragraph-content" fo:padding="0.15cm" fo:border="0.002cm solid #000000"/>
|
||||
</style:style>
|
||||
|
||||
<!-- Inline Tasks -->
|
||||
<style:style style:name="OrgInlineTaskHeading" style:family="paragraph" style:parent-style-name="Caption" style:next-style-name="Text_20_body">
|
||||
<style:text-properties style:font-name="Arial1" fo:font-style="normal" fo:font-weight="bold"/>
|
||||
</style:style>
|
||||
<style:style style:name="OrgInlineTaskFrame" style:family="graphic" style:parent-style-name="Frame">
|
||||
<style:graphic-properties svg:x="0cm" svg:y="0cm" style:wrap="none" style:vertical-pos="top" style:vertical-rel="paragraph-content" style:horizontal-pos="center" style:horizontal-rel="paragraph-content" fo:background-color="#ffffcc" style:background-transparency="0%" fo:padding="0.15cm" fo:border="0.26pt solid #000000" style:shadow="none">
|
||||
<style:background-image/>
|
||||
</style:graphic-properties>
|
||||
</style:style>
|
||||
|
||||
<text:list-style style:name="Numbering_20_1" style:display-name="Numbering 1">
|
||||
<text:list-level-style-number text:level="1" text:style-name="Numbering_20_Symbols" style:num-suffix="." style:num-format="1">
|
||||
<style:list-level-properties text:list-level-position-and-space-mode="label-alignment">
|
||||
|
|
|
@ -157,6 +157,12 @@ not be modified."
|
|||
dt { font-weight: bold; }
|
||||
div.figure { padding: 0.5em; }
|
||||
div.figure p { text-align: center; }
|
||||
div.inlinetask {
|
||||
padding:10px;
|
||||
border:2px solid gray;
|
||||
margin:10px;
|
||||
background: #ffffcc;
|
||||
}
|
||||
textarea { overflow-x: auto; }
|
||||
.linenr { font-size:smaller }
|
||||
.code-highlighted {background-color:#ffff00;}
|
||||
|
|
|
@ -107,11 +107,14 @@ When nil, they will not be exported."
|
|||
:type 'boolean)
|
||||
|
||||
(defvar org-inlinetask-export-templates
|
||||
'((html "<pre class=\"inlinetask\"><b>%s%s</b><br />%s</pre>"
|
||||
'((html "<div class=\"inlinetask\"><b>%s%s</b><br />%s</div>"
|
||||
'((unless (eq todo "")
|
||||
(format "<span class=\"%s %s\">%s%s</span> "
|
||||
class todo todo priority))
|
||||
heading content))
|
||||
(odt "%s" '((org-odt-format-inlinetask heading content
|
||||
todo priority tags)))
|
||||
|
||||
(latex "\\begin\{description\}\n\\item[%s%s]~%s\\end\{description\}"
|
||||
'((unless (eq todo "") (format "\\textsc\{%s%s\} " todo priority))
|
||||
heading content))
|
||||
|
@ -349,12 +352,14 @@ Either remove headline and meta data, or do special formatting."
|
|||
;; Ensure CONTENT has minimal indentation, a single
|
||||
;; newline character at its boundaries, and isn't
|
||||
;; protected.
|
||||
(when (string-match "`\\([ \t]*\n\\)+" content)
|
||||
(when (string-match "\\`\\([ \t]*\n\\)+" content)
|
||||
(setq content (substring content (match-end 0))))
|
||||
(when (string-match "[ \t\n]+\\'" content)
|
||||
(setq content (substring content 0 (match-beginning 0))))
|
||||
(org-add-props (concat "\n" (org-remove-indentation content) "\n")
|
||||
'(org-protected nil))))
|
||||
(org-add-props
|
||||
(concat "\n\n" (org-remove-indentation content) "\n\n")
|
||||
'(org-protected nil org-native-text nil))))
|
||||
|
||||
(when (string-match org-complex-heading-regexp headline)
|
||||
(let* ((nil-to-str
|
||||
(function
|
||||
|
@ -371,7 +376,7 @@ Either remove headline and meta data, or do special formatting."
|
|||
(backend-spec (assq org-export-current-backend
|
||||
org-inlinetask-export-templates))
|
||||
(format-str (org-add-props (nth 1 backend-spec)
|
||||
'(org-protected t)))
|
||||
'(org-protected t org-native-text t)))
|
||||
(tokens (cadr (nth 2 backend-spec)))
|
||||
;; Build export string. Ensure it won't break
|
||||
;; surrounding lists by giving it arbitrary high
|
||||
|
|
Loading…
Reference in New Issue