From: Jambunathan K <kjambunathan@gmail.com>
To: Nicolas Goaziou <n.goaziou@gmail.com>,
Suvayu Ali <fatkasuvayu+linux@gmail.com>
Cc: emacs-orgmode@gnu.org
Subject: Re: [bug] org-inlinetask produces invalid xhtml
Date: Fri, 12 Aug 2011 02:08:44 +0530 [thread overview]
Message-ID: <8162m3wunf.fsf@gmail.com> (raw)
In-Reply-To: <871uwsl01h.fsf@gmail.com> (Nicolas Goaziou's message of "Thu, 11 Aug 2011 12:23:06 +0200")
[-- Attachment #1: Type: text/plain, Size: 1061 bytes --]
> 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.
[-- Attachment #2: 0001-Prettify-inlinetasks-in-odt-and-x-html-backends.patch --]
[-- Type: text/plain, Size: 7700 bytes --]
From 6bbf2084d783726e05a2e006ea2f79017adf50d9 Mon Sep 17 00:00:00 2001
From: Jambunathan K <kjambunathan@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
[-- Attachment #3: inlinetask.org --]
[-- Type: text/plain, Size: 1022 bytes --]
* 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 #4: inlinetask.odt --]
[-- Type: application/vnd.oasis.opendocument.text, Size: 8785 bytes --]
[-- Attachment #5: inlinetask.doc --]
[-- Type: application/msword, Size: 20480 bytes --]
[-- Attachment #6: inlinetask.html --]
[-- Type: text/html, Size: 4871 bytes --]
[-- Attachment #7: Type: text/plain, Size: 23 bytes --]
--
next prev parent reply other threads:[~2011-08-11 20:39 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-08-08 16:36 [bug] org-inlinetask produces invalid xhtml Jambunathan K
2011-08-08 16:51 ` Jambunathan K
2011-08-08 18:26 ` Nicolas Goaziou
2011-08-09 5:44 ` Jambunathan K
2011-08-09 11:42 ` Nicolas Goaziou
2011-08-09 21:51 ` Jambunathan K
2011-08-09 23:47 ` suvayu ali
2011-08-11 10:23 ` Nicolas Goaziou
2011-08-11 11:21 ` Jambunathan K
2011-08-11 11:21 ` Jambunathan K
2011-08-11 12:17 ` Nicolas Goaziou
2011-08-11 20:38 ` Jambunathan K [this message]
2011-08-16 19:30 ` Bastien
2011-08-16 19:21 ` Bastien
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.orgmode.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=8162m3wunf.fsf@gmail.com \
--to=kjambunathan@gmail.com \
--cc=emacs-orgmode@gnu.org \
--cc=fatkasuvayu+linux@gmail.com \
--cc=n.goaziou@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).