Register Guidelines E-Books Search Today's Posts Mark Forums Read

Go Back   MobileRead Forums > E-Book Formats > Workshop

Notices

Reply
 
Thread Tools Search this Thread
Old 02-21-2008, 08:46 AM   #1
IceHand
Linux User
IceHand is a rising star in the heavensIceHand is a rising star in the heavensIceHand is a rising star in the heavensIceHand is a rising star in the heavensIceHand is a rising star in the heavensIceHand is a rising star in the heavensIceHand is a rising star in the heavensIceHand is a rising star in the heavensIceHand is a rising star in the heavensIceHand is a rising star in the heavensIceHand is a rising star in the heavens
 
IceHand's Avatar
 
Posts: 323
Karma: 13682
Join Date: Aug 2007
Location: Germany
Device: Kindle 3
Beautify Baen e-books

I have quite a few e-books from Baen and noticed that they use straight quotes instead of curly quotes. So I searched for a script or program that automatically converts the quotes, but couldn't find one that I could use. Then I discovered the program "sed" and made a dirty little one-liner that converts the HTML file from the exploded Baen LIT:
Code:
#!/bin/bash
set -e

mv "$1" "$1.backup"
cat "$1.backup" | sed -e 's|"\([^"][^"]*\)"|“\1”|g' -e 's|"|“|g' -e 's|=“[^”]*”|="\0"|g' -e 's|=“||g' -e 's|”"|"|g' -e 's|=”[^“]*“|="\0"|g' -e 's|=”||g' -e 's|“"|"|g' -e "s| '| ‘|g" -e "s|'|’|g" -e "s|“|\“|g" -e "s|”|\”|g" -e "s|‘|\‘|g" -e "s|’|\’|g" -e "s|\. \. \.|\…|g" -e "s|\.\.\.|\…|g" -e "s|\.\ \.\ \.|\…|g" -e "s|\. \. \. \.|\…|g" -e "s|\.\.\.\.|\…|g" -e "s|\.\ \.\ \.\ \.|\…|g" -e 's|\“+//|"+//|g' -e 's|//EN\”|//EN"|g' -e 's|\“http://openebook|"http://openebook|g' -e 's|\.dtd\”>|\.dtd">|g' > "$1"

exit 0
Maybe someone will find this useful. It converts straight quotes to curly quotes and ". . ." and ". . . ." to "…" (…) – and of course it makes a backup of the original HTML file.
I haven't tried, but there's sed for Windows too.

Are there other – maybe nicer – ways to do this task? My one-liner works well with Baen books, but has some limitations.

By the way, why is it that Baen Mobipocket e-books look nicer when exploding the MS Reader LIT and converting to Mobipocket yourself?

Last edited by IceHand; 02-22-2008 at 12:30 PM.
IceHand is offline   Reply With Quote
Old 02-21-2008, 09:57 AM   #2
HarryT
eBook Enthusiast
HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.
 
HarryT's Avatar
 
Posts: 85,544
Karma: 93383043
Join Date: Nov 2006
Location: UK
Device: Kindle Oasis 2, iPad Pro 10.5", iPhone 6
Quote:
Originally Posted by IceHand View Post
By the way, why is it that Baen Mobipocket e-books look nicer when exploding the MS Reader LIT and converting to Mobipocket yourself?
Until a couple of months ago Baen used a pretty bad Mobipocket creator - those are the files you get with a ".prc" extension. They've now started to use a much better converter and the new files (which have a ".mobi" extension) are very nice.
HarryT is offline   Reply With Quote
Advert
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Baen Books CD 17 Ajax Deals and Resources (No Self-Promotion or Affiliate Links) 6 03-09-2009 08:20 AM
Format of Baen books radius Workshop 5 02-14-2008 02:08 AM
Baen Books Lameth iRex 10 08-23-2006 02:02 AM
Free Books from Baen cbarnett Deals and Resources (No Self-Promotion or Affiliate Links) 10 09-25-2003 08:50 PM


All times are GMT -4. The time now is 04:23 AM.


MobileRead.com is a privately owned, operated and funded community.