I'm also dealing with this. Perhaps it depends on your conversion method. 
Calibre conversions (ePub to mobi) keep more of the CSS intact in the mobi; 
KindleGen does not. This requires you to either postprocess the ePub HTML 
before conversion to mobi or add presentation-related tags to your XML (such as 
<para role="no-indent">). The neither option is appealing. 

I would be interested in seeing the scripts too, if they are available. 

Thanks,

jz

-----Original Message-----
From: Nic Gibson [mailto:[email protected]] 
Sent: Wednesday, August 03, 2011 11:29 AM
To: Robert Nagle
Cc: [email protected]
Subject: Re: [docbook-apps] how to add a style attribute inside a P element? 
(Kindle insanity!)

Hi Robert

I've been doing some of the same things you are doing here. I'm not convinced 
that are right about the Kindle indenting (I'm looking at some titles I worked 
on and we've used css classes for the indent and it's working just fine). 

For the width, I postprocess. I'm working on a set of scripts for a client at 
the moment that takes an EPUB and does some mappings for the Kindle. I may be 
able to make them available to you (the client is often happy for code written 
for them to be put into the public domain).

There is no reason why you couldn't do both the things you are discussing here 
using a customisation though. You could use a template that operates on role 
attributes perhaps.

nic

On 3 Aug 2011, at 12:47, Robert Nagle wrote:

> To add to my remarks:
> 
> one common Kindle formatting example is to output
> 
> to <p width=75"> or  <p width=-20">
> 
> so it would be nice if we could have a general way to add an attribute
> like "width" in some cases.
> 
> (I don't know if it would validate as XHTML though).
> 
> rj
> 
> On Wed, Aug 3, 2011 at 6:36 AM, Robert Nagle <[email protected]> 
> wrote:
>> I'm outputting a lot of epub and frequently I need to massage the
>> output so that the epub can be converted into the Kindle format.
>> 
>> One inherent problem with kindlegen is that it strips out most CSS
>> code and instead adds some formatting attributes inside individual
>> elements.
>> 
>> One example. You cannot turn off indenting in Kindle unless you
>> hardcode something like <p style="text-indent:0">
>> 
>> So I do post-processing, I would have to do a global search and replace:
>> 
>>    Change <p class="no-indent"> to <p style="text-indent:0"> in all 
>> instances.
>>    Change <div class="caption"><p> to <div.caption><p
>> style="text-indent:0"> in all instances.
>>    Change <p class="pullquote"> to <p style="text-indent:0"> in all 
>> instances.
>> 
>> I wouldn't even know how to get started to do this in customization layer.
>> 
>> I've seen this discussion
>> http://markmail.org/search/?q=class.attribute&q=list%3Aorg.oasis-open.lists.docbook-apps#query:class.attribute%20list%3Aorg.oasis-open.lists.docbook-apps%20from%3A%22Bob%20Stayton%22+page:1+mid:7jfjygrqiz5pc7bs+state:results
>> where css.decoration is mentioned as well as custom class values
>> http://www.sagehill.net/docbookxsl/HtmlCustomEx.html#CustomClassValues
>> 
>> I think the section on "custom class values" seems relevant, but I
>> can't follow the example.
>> 
>> YOu would need to add a custom attribute to these elements (style) as
>> well as values (text-indent:0).
>> 
>> Do you have an idea about how to attack this problem? Thanks.
>> 
>> --
>> Robert Nagle
>> 6121 Winsome Ln #56C, Houston TX 77057-5581
>> (H) 713 893 3424/ (W) 832-251-7522 Carbon Neutral Since Jan 2010
>> http://www.robertnagle.info
>> 
> 
> 
> 
> -- 
> Robert Nagle
> 6121 Winsome Ln #56C, Houston TX 77057-5581
> (H) 713 893 3424/ (W) 832-251-7522 Carbon Neutral Since Jan 2010
> http://www.robertnagle.info
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
> 

Nic Gibson
Corbas Consulting
Digital Publishing Consultancy and Training
http://www.corbas.co.uk, +44 (0)7718 906817     
        


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to