Alan L Tyree <[email protected]> writes:
> On 11/12/11 20:41:18, Alan L Tyree wrote:
>> On 11/12/11 18:42:10, Nick Dokos wrote:
>> > Alan L Tyree <[email protected]> wrote:
>> >
>> > > > http://thread.gmane.org/gmane.emacs.orgmode/41826/focus=41849
>> > >
>> > > Yes, Calibre does a nice job of converting XHTML to ePub; it can
>> be
>> > > read in all the readers that I use, but it won't pass the
>> > validation
>> > > tests. OK unless you want to publish on sites that require
>> > validation.
>> <SNIP>
>>
>> I was being unfair to Calibre. If I clean up the XHTML file produced
>> by
>> org (in the way indicated by my original post plus a couple of things
>> that I didn't mention), then Calibre produces an ePub book that
>> passes
>>
>> validation.
>>
>> So -- back to my original question: is there some variable somewhere
>> that puts in both name="xxx" and id="xxx" or do I need to write a
>> post
>>
>> export clean up function?
>
> Bad form to answer my own question: these seem to be hard coded in org-
> html.el along with the other items that give ePub validation a nervous
> breakdown. I'll post a full list of the offending items later.
If you use org-xhtml.el (in contrib/lisp/org-xhtml.el) then you can
re-define some aspects of html export selectively.
For example, you can redefine this to
,---- original
| (defun org-xhtml-format-anchor (text name &optional class)
| (let* ((id name)
| (extra (concat
| (when name (format " name=\"%s\"" name))
| (when id (format " id=\"%s\"" id))
| (when class (format " class=\"%s\"" class)))))
| (org-xhtml-format-tags '("<a%s>" . "</a>") text extra)))
`----
this
,---- modified
| (defun org-xhtml-format-anchor (text name &optional class)
| (let* ((id name)
| (extra (concat
| (when id (format " id=\"%s\"" id))
| (when class (format " class=\"%s\"" class)))))
| (org-xhtml-format-tags '("<a%s>" . "</a>") text extra)))
`----
to strip name from anchor.
I am not sure whether org-xhtml.el will minimize your efforts. Just a
suggestion.
ps: Add contrib/lisp to load-path and do org-export-as-xhtml.
> Cheers,
> Alan
>
>>
>> Thanks,
>> Alan
>>
>> --
>> Alan L Tyree http://www2.austlii.edu.au/~alan
>> Tel: 04 2748 6206 sip:[email protected]
>>
>>
>>
--