emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Jambunathan K <kjambunathan@gmail.com>
To: Carsten Dominik <carsten.dominik@gmail.com>
Cc: Sebastien Vauban <wxhgmqzgwmuf@spammotel.com>, emacs-orgmode@gnu.org
Subject: Re: Org-special-blogs does not make well-formed xhtml
Date: Tue, 04 Oct 2011 20:06:36 +0530	[thread overview]
Message-ID: <81ipo4u8ln.fsf@gmail.com> (raw)
In-Reply-To: <BC7DC1E0-4705-476D-833E-EC02B6462897@gmail.com> (Carsten Dominik's message of "Tue, 4 Oct 2011 13:23:35 +0200")


Carsten Dominik <carsten.dominik@gmail.com> writes:

> On Oct 3, 2011, at 3:26 PM, Sebastien Vauban wrote:
>
>> Hi Christian Moe,
>> 
>> Christian Moe wrote:
>>> Hi,
>>> 
>>> XHTML produced with Org-special-blocks is not well-formed; <div> tags 
>>> get wrapped in <p> tags. Example:
>>> 
>>>    Some text.
>>> 
>>>    #+begin_sidebar
>>>      Some details left out of the main text.
>>> 
>>>      Some more details.
>>>    #+end_sidebar
>>> 
>>>    Some more text.
>>> 
>>> This results in the following html, which causes XML processors to fail.
>>> 
>>>    <p>
>>>    <div class="sidebar">
>>>      Some details left out of the main text.
>>>    </p>
>>>    <p>
>>>      Some more details.
>>>    </div>
>>>    </p>
>>>    <p>
>>>    Some more text.
>>>    </p></div>
>>> 
>>> The problem seems to be fixed by un-commenting the fifth line in the 
>>> below function in org-special-blocks.el:
>>> 
>>>    (defun org-special-blocks-convert-html-special-cookies ()
>>>      "Converts the special cookies into div blocks."
>>>      ;; Uses the dynamically-bound variable `line'.
>>>      (when (string-match "^ORG-\\(.*\\)-\\(START\\|END\\)$" line)
>>>    ;    (org-close-par-maybe)
>>>        (message "%s" (match-string 1))
>>>        (if (equal (match-string 2 line) "START")
>>> 	   (insert "<div class=\"" (match-string 1 line) "\">\n")
>>> 	 (insert "</div>\n"))
>>>        (throw 'nextline nil)))
>>> 
>>> Does anyone know if that was commented out for a reason?
>> 
>> git blame suggests it was there since that file org-special-blocks.el has been
>> added (in contrib/lisp, by Carsten, on 2009-05-07 13:53)...
>> 
>> Best regards,
>>  Seb
>> 
>> -- 
>> Sebastien Vauban
>> 
>> 
>
> I see no reason to not uncomment this line.  Shall we just do this?

Shouldn't a paragraph be opened/closed while entering/leaving the div.

,---- See org-xhtml-format-environment
|     (center
|      (case beg-end
|        (BEGIN
| 	(org-lparse-end-paragraph)
| 	(insert "\n<div style=\"text-align: center\">")
| 	(org-lparse-begin-paragraph))
|        (END
| 	(org-lparse-end-paragraph)
| 	(insert "\n</div>")
| 	(org-lparse-begin-paragraph))))
`----

We can always open a paragraph gratis, because empty paragraphs are
pruned at the end of export.

ps: I haven't gotten myself to understand when paragraphs are opened and
closed in the html exporter. So we can take a leaf out of the centering
environment and mimic the same behaviour with the special blocks as
well.

> - Carsten
>
>
>
>
>

-- 

  parent reply	other threads:[~2011-10-04 14:37 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-03 12:44 Org-special-blogs does not make well-formed xhtml Christian Moe
2011-10-03 13:26 ` Sebastien Vauban
2011-10-04 11:23   ` Carsten Dominik
2011-10-04 12:45     ` Christian Moe
2011-10-04 14:22       ` Carsten Dominik
2011-10-04 14:36     ` Jambunathan K [this message]
2011-10-04 19:01       ` Christian Moe
2011-10-04 21:33         ` Carsten Dominik
2011-10-06 10:17           ` Christian Moe

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=81ipo4u8ln.fsf@gmail.com \
    --to=kjambunathan@gmail.com \
    --cc=carsten.dominik@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=wxhgmqzgwmuf@spammotel.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).