View Single Post
Old 02-01-2011, 04:44 AM   #20
sherman
Addict
sherman is kind to children and small, furry animalssherman is kind to children and small, furry animalssherman is kind to children and small, furry animalssherman is kind to children and small, furry animalssherman is kind to children and small, furry animalssherman is kind to children and small, furry animalssherman is kind to children and small, furry animalssherman is kind to children and small, furry animalssherman is kind to children and small, furry animalssherman is kind to children and small, furry animalssherman is kind to children and small, furry animals
 
Posts: 262
Karma: 6566
Join Date: Aug 2008
Location: New Plymouth - NZ
Device: Sony PRS-505/SC, B&N Nook, Sony PRS-650/BC, Kobo Glo
Quote:
Originally Posted by kiwidude View Post
Good old Palmy North eh? Grew up near Stratford in Taranaki myself...

I don't have a need for such a plugin myself but I can understand the issue and technically there is no great difficulty. One question that comes to mind if someone was to assist you with writing it is the nature of the find/replace operations and how those are specified. Could you get away with substituting an entire css file? Or do you substitute just specific styles? Maybe if you could list (as an example) all of the substitutions you do currently that you require, put them either in an attachment or spoiler section for someone to take a look at.

If the find/replace operations are quite complex then you are probably going to want them specified using regular expressions for instance.
The 'naki eh? I was born and raised in New Plymouth -- Bell Block to be exact. Just shifted back actually, need to update my profile


But anyway, back on topic...

I tend to prefer replacing specific styles rather than substituting in a new stylesheet.
It wouldn't need anything too exotic, basic search is all that's necessary, although regular expressions would be much more flexible and powerful.

My idea was to use a basic text file with a series of search/replace terms that the plugin would perform on the .css and .xpgt files found in the epub.

So, for the Penguin example, the text file could look a little something like this:
Spoiler:

[css]
(search)font-size: x-large (replace)font-size: xx-large
(search)font-size: large (replace)font-size: x-large
(search)font-size: medium (replace)font-size: large
(search)font-size: small (replace)
(search)font-size: xx-small (replace)-small
(search)font-size: x-small (replace)small
(search)font-size: -small (replace)x-small
(search)text-indent: 15px (replace)text-indent: 1.3em
(search)margin-right: 25px (replace)

[xpgt]
(search)20px or 30px (replace)5px


//of course, this wouldn't be the syntax actually used
sherman is offline   Reply With Quote