Re: [O] Making ePub books

2011-12-11 Thread Alan L Tyree
On 11/12/11 18:42:10, Nick Dokos wrote:
 Alan L Tyree alanty...@gmail.com 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.
 
 Have you tried submitting an enhancement request to the calibre
 people?
 It sounds (from my vantage point of a million miles away...) like a
 simple
 thing for them to do and it might be a good thing for them as well as
 for you: they can integrate the validation step in their testing and
 catch errors that might be difficult to catch any other way. And it
 seems to be a very active project, so you might get results pronto.

Good idea! That would certainly be the nicest way since Calibre is a 
very nice piece of work. 

Alan

 
 Nick
 
 



-- 
Alan L Tyreehttp://www2.austlii.edu.au/~alan
Tel:  04 2748 6206  sip:172...@iptel.org





Re: [O] Making ePub books: further report

2011-12-11 Thread Alan L Tyree
On 11/12/11 18:42:10, Nick Dokos wrote:
 Alan L Tyree alanty...@gmail.com 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?

Thanks,
Alan

-- 
Alan L Tyreehttp://www2.austlii.edu.au/~alan
Tel:  04 2748 6206  sip:172...@iptel.org





Re: [O] Making ePub books: further report

2011-12-11 Thread Alan L Tyree
On 11/12/11 20:41:18, Alan L Tyree wrote:
 On 11/12/11 18:42:10, Nick Dokos wrote:
  Alan L Tyree alanty...@gmail.com 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.

Cheers,
Alan

 
 Thanks,
 Alan
 
 -- 
 Alan L Tyreehttp://www2.austlii.edu.au/~alan
 Tel:  04 2748 6206sip:172...@iptel.org
 
 
 



-- 
Alan L Tyreehttp://www2.austlii.edu.au/~alan
Tel:  04 2748 6206  sip:172...@iptel.org





Re: [O] Making ePub books: further report

2011-12-11 Thread Jambunathan K
Alan L Tyree alanty...@gmail.com 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 alanty...@gmail.com 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 Tyreehttp://www2.austlii.edu.au/~alan
 Tel:  04 2748 6206   sip:172...@iptel.org
 
 
 

-- 



Re: [O] Making ePub books: further report

2011-12-11 Thread Bastien
Hi Alan,

Alan L Tyree alanty...@gmail.com writes:

 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?

From latest git, can now set ̀org-export-html-headline-anchor-format' to
nil.  See the docstring of this new option.

Thanks,

-- 
 Bastien



Re: [O] Making ePub books: further report

2011-12-11 Thread Bastien
Alan L Tyree alanty...@gmail.com writes:

 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.

Thanks.  If you can, please document this on Worg.  This will be useful
when we will rewrite org-html.el using Nicolas new export engine.

Best,

-- 
 Bastien



Re: [O] Making ePub books: further report

2011-12-11 Thread Alan L Tyree
On 11/12/11 21:02:51, Jambunathan K wrote:
 Alan L Tyree alanty...@gmail.com 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 alanty...@gmail.com 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.

Thanks for this, Jambunathan. I'll give this a try.

Cheers,
Alan



 
  Cheers,
  Alan
 
  
  Thanks,
  Alan
  
  -- 
  Alan L Tyreehttp://www2.austlii.edu.au/~alan
  Tel:  04 2748 6206 sip:172...@iptel.org
  
  
  
 
 -- 
 



-- 
Alan L Tyreehttp://www2.austlii.edu.au/~alan
Tel:  04 2748 6206  sip:172...@iptel.org





Re: [O] Making ePub books: further report

2011-12-11 Thread Alan L Tyree
On 12/12/11 02:51:29, Bastien wrote:
 Hi Alan,
 
 Alan L Tyree alanty...@gmail.com writes:
 
  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?
 
 From latest git, can now set ̀org-export-html-headline-anchor-format'
 to
 nil.  See the docstring of this new option.

Thanks, Basien. I'll give it a try.

Alan

 
 Thanks,
 
 -- 
  Bastien
 



-- 
Alan L Tyreehttp://www2.austlii.edu.au/~alan
Tel:  04 2748 6206  sip:172...@iptel.org





[O] Making ePub books

2011-12-10 Thread Alan L Tyree
Debian Squeeze; org 7.7; emacs 23.2.1

I am back to trying to make ePub books from org articles/books. I am 
working on a book which currently produces about 100 pages in LaTeX 
export. It will be about 200 pages when finished.

ePub uses XHTML for the main content. So, I export the org file to 
HTML. It verifies as a valid XHTML1.0 file at the w3c verification 
site: http://validator.w3.org/

OK. Then wrap it up in the mess that is the ePub specification. It 
actually reads OK in FBReader and in Iceweasel with the ePub add on, 
BUT it does not validate. There are several problems, but most of the 
errors involve the name attribute. For example:

h2 id=historya name=sec-1 id=sec-1/aspan class=section-
number-21/span History/h2

ePub does not like the name in there. Wipe out all the name=xxx and 
the problem goes away. Everything else still works.

I know that I can do a post export clean up of the XHTML file, but I 
wonder if this is set in some variable that I cannot find.

And, as a general question, whay have both name=sec-1 and id=sec-1 
in the same element?

I would like to automate everything to go from org to ePub. It doesn't 
seem too hard, but I'm a legal academic, not a programmer :-). Any 
pointers appreciated.

Cheers,
Alan

-- 
Alan L Tyreehttp://www2.austlii.edu.au/~alan
Tel:  04 2748 6206  sip:172...@iptel.org





Re: [O] Making ePub books

2011-12-10 Thread Nick Dokos
Alan L Tyree alanty...@gmail.com wrote:

 Debian Squeeze; org 7.7; emacs 23.2.1
 
 I am back to trying to make ePub books from org articles/books. I am=20
 working on a book which currently produces about 100 pages in LaTeX=20
 export. It will be about 200 pages when finished.
 
 ePub uses XHTML for the main content. So, I export the org file to=20
 HTML. It verifies as a valid XHTML1.0 file at the w3c verification=20
 site: http://validator.w3.org/
 
 OK. Then wrap it up in the mess that is the ePub specification. It=20
 actually reads OK in FBReader and in Iceweasel with the ePub add on,=20
 BUT it does not validate. There are several problems, but most of the=20
 errors involve the name attribute. For example:
 
 h2 id=3Dhistorya name=3Dsec-1 id=3Dsec-1/aspan class=3Dsectio=
 n-
 number-21/span History/h2
 
 ePub does not like the name in there. Wipe out all the name=3Dxxx and=20
 the problem goes away. Everything else still works.
 
 I know that I can do a post export clean up of the XHTML file, but I=20
 wonder if this is set in some variable that I cannot find.
 
 And, as a general question, whay have both name=3Dsec-1 and id=3Dsec-1=20
 in the same element?
 
 I would like to automate everything to go from org to ePub. It doesn't=20
 seem too hard, but I'm a legal academic, not a programmer :-). Any=20
 pointers appreciated.
 

Back when Avdi Green was working on his book, there was some discussion
of this and Anthony Lander provided a pointer to  http://calibre-ebook.com/
- see 

  http://thread.gmane.org/gmane.emacs.orgmode/41826/focus=41849

Nick




Re: [O] Making ePub books

2011-12-10 Thread Alan L Tyree
On 11/12/11 18:07:48, Nick Dokos wrote:
 Alan L Tyree alanty...@gmail.com wrote:
 
  Debian Squeeze; org 7.7; emacs 23.2.1
  
  I am back to trying to make ePub books from org articles/books. I
 am=20
  working on a book which currently produces about 100 pages in
 LaTeX=20
  export. It will be about 200 pages when finished.
  
  ePub uses XHTML for the main content. So, I export the org file
 to=20
  HTML. It verifies as a valid XHTML1.0 file at the w3c
 verification=20
  site: http://validator.w3.org/
  
  OK. Then wrap it up in the mess that is the ePub specification.
 It=20
  actually reads OK in FBReader and in Iceweasel with the ePub add
 on,=20
  BUT it does not validate. There are several problems, but most of
 the=20
  errors involve the name attribute. For example:
  
  h2 id=3Dhistorya name=3Dsec-1 id=3Dsec-1/aspan
 class=3Dsectio=
  n-
  number-21/span History/h2
  
  ePub does not like the name in there. Wipe out all the name=3Dxxx
 and=20
  the problem goes away. Everything else still works.
  
  I know that I can do a post export clean up of the XHTML file, but
 I=20
  wonder if this is set in some variable that I cannot find.
  
  And, as a general question, whay have both name=3Dsec-1 and
 id=3Dsec-1=20
  in the same element?
  
  I would like to automate everything to go from org to ePub. It
 doesn't=20
  seem too hard, but I'm a legal academic, not a programmer :-).
 Any=20
  pointers appreciated.
  
 
 Back when Avdi Green was working on his book, there was some
 discussion
 of this and Anthony Lander provided a pointer to 
 http://calibre-ebook.com/
 - see 
 
   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.

Cheers,
Alan



 Nick
 
 



-- 
Alan L Tyreehttp://www2.austlii.edu.au/~alan
Tel:  04 2748 6206  sip:172...@iptel.org





Re: [O] Making ePub books

2011-12-10 Thread Nick Dokos
Alan L Tyree alanty...@gmail.com 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.

Have you tried submitting an enhancement request to the calibre people?
It sounds (from my vantage point of a million miles away...) like a simple
thing for them to do and it might be a good thing for them as well as
for you: they can integrate the validation step in their testing and
catch errors that might be difficult to catch any other way. And it
seems to be a very active project, so you might get results pronto.

Nick




Re: [O] Making ePub books

2011-12-10 Thread Nick Dokos
I said:

  Back when Avdi Green was working on his book, there was some

and I managed to mangle Avdi's name pretty badly: it is Avdi Grimm.

Apologies,
Nick