[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [O] Org-special-blogs does not make well-formed xhtml
From: |
Jambunathan K |
Subject: |
Re: [O] Org-special-blogs does not make well-formed xhtml |
Date: |
Tue, 04 Oct 2011 20:06:36 +0530 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (windows-nt) |
Carsten Dominik <address@hidden> 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
>
>
>
>
>
--