> What I think is that, for now, we just should keep the existing facility
> and implement a working default template for HTML (and a new one for
> ODT).

I am attaching the patch and sample org/odt/doc/html files.

I have used the css style suggested by Suvayu Ali for inlinetask (but
with an yellow background). I have used text boxes for odt export [1].

Jambuanthan K.

Footnotes: 

[1] Initially I wanted to use Comments/Annotations for inlinetasks but
thanks to Suvayu's notings I have changed my mind.

1. It shows up in margin which has limited space. So the inline tasks
   have to be really small for pretty output.
2. Even though the spec says that <office:annotation>
   ... </office:annotation> can contain lists, LibreOffice render them
   lists/list-items as insipid paragraphs.
3. Body text in office annotations doesn't honor custom styles. It
   honors only automatic styles. (This seems more like a LibreOffice
   issue)

[2] Note that one can navigate just the Text Frames from within
LibreOffice UI and also create an index entry for it.

>From 6bbf2084d783726e05a2e006ea2f79017adf50d9 Mon Sep 17 00:00:00 2001
From: Jambunathan K <kjambunat...@gmail.com>
Date: Fri, 12 Aug 2011 01:37:45 +0530
Subject: [PATCH] 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.
---
 contrib/lisp/org-odt.el             |   22 ++++++++++++++++++++++
 contrib/lisp/org-xhtml.el           |    6 ++++++
 contrib/odt/styles/OrgOdtStyles.xml |   11 +++++++++++
 lisp/org-html.el                    |    6 ++++++
 lisp/org-inlinetask.el              |   15 ++++++++++-----
 5 files changed, 55 insertions(+), 5 deletions(-)

diff --git a/contrib/lisp/org-odt.el b/contrib/lisp/org-odt.el
index 88d1068..848bba3 100644
--- a/contrib/lisp/org-odt.el
+++ b/contrib/lisp/org-odt.el
@@ -1077,6 +1077,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)
diff --git a/contrib/lisp/org-xhtml.el b/contrib/lisp/org-xhtml.el
index 74ad64b..8a4a01f 100644
--- a/contrib/lisp/org-xhtml.el
+++ b/contrib/lisp/org-xhtml.el
@@ -166,6 +166,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;}
diff --git a/contrib/odt/styles/OrgOdtStyles.xml 
b/contrib/odt/styles/OrgOdtStyles.xml
index d7ec5ee..317a234 100644
--- a/contrib/odt/styles/OrgOdtStyles.xml
+++ b/contrib/odt/styles/OrgOdtStyles.xml
@@ -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">
diff --git a/lisp/org-html.el b/lisp/org-html.el
index c150b3d..bc45d73 100644
--- a/lisp/org-html.el
+++ b/lisp/org-html.el
@@ -158,6 +158,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;}
diff --git a/lisp/org-inlinetask.el b/lisp/org-inlinetask.el
index 57ab505..0eb7361 100644
--- a/lisp/org-inlinetask.el
+++ b/lisp/org-inlinetask.el
@@ -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
-- 
1.7.2.3

* TODO [#A] A regular todo                                           :boring:
  This is a regular todo.

*  Some topic                                                      :colorful:
blah blah blah blah blah blah blah blah blah blah blah blah blah blah
blah blah blah blah blah blah blah blah blah blah
*************** TODO [#B] A simple inline task:                      :simple:
continue blah continue blah continue blah continue blah continue blah
continue blah continue blah continue blah continue blah continue blah
continue blah continue blah continue blah continue blah continue blah
continue blah

*************** TODO [#C] An inline task with extra notes          :detailed:
1. note1 note1 note1 note1 note1 note1 note1 note1 note1 note1 note1
   note1 note1 note1
2. note2 note2 note2 note2 note2 note2 note2 note2 note2 note2 note2
   note2 note2
*************** END
again continue blah again continue blah again continue blah again
continue blah again continue blah again continue blah again continue
blah again continue blah again continue blah again continue blah again
continue blah again continue blah

Attachment: inlinetask.odt
Description: inlinetask.odt

Attachment: inlinetask.doc
Description: inlinetask.doc

Title: inlinetask

inlinetask

Table of Contents

1 TODO A regular todo    boring

This is a regular todo.

2 Some topic    colorful

blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah

TODO A simple inline task:

continue blah continue blah continue blah continue blah continue blah continue blah continue blah continue blah continue blah continue blah continue blah continue blah continue blah continue blah continue blah continue blah

TODO An inline task with extra notes
  1. note1 note1 note1 note1 note1 note1 note1 note1 note1 note1 note1 note1 note1 note1
  2. note2 note2 note2 note2 note2 note2 note2 note2 note2 note2 note2 note2 note2

again continue blah again continue blah again continue blah again continue blah again continue blah again continue blah again continue blah again continue blah again continue blah again continue blah again continue blah again continue blah

Date: 2011-08-12 01:43:06

Author: Jambunathan K

Org version 7.7 with Emacs version 24

Validate XHTML 1.0


















-- 

Reply via email to