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

Go Back   MobileRead Forums > E-Book Software > Sigil

Notices

Reply
 
Thread Tools Search this Thread
Old 06-10-2012, 09:17 PM   #1
roger64
Wizard
roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.
 
Posts: 1,310
Karma: 846401
Join Date: Jan 2009
Device: KoboGlo
Alphabetize and clean a style sheet

The last question of this kind I asked for allowed me to find a very useful tool, so I try again...

Two days ago, I naively asked meme which tool he used to produce such a clean style sheet for his Sigil user guide. The reply was sweat, blood and tears (nearly ).
Quote:
Originally Posted by meme View Post
Entirely manually, and gradually building up by adding, and removing, as needed.
The converter I use produce automatically CSS style sheets of this kind (see spoiler). As you can see, styles are placed, each on their own line, and sometimes this line can be un-pretty long, which creates blocks difficult to read and debug.
I would like to use a tool to do three things:
1. - Put this style sheet in alphabetical order.
2. - Processing style after style, provoke a line change (like \n in OO) after these two signs: { ; and before and after this tricky one: }
3. - Any other idea(s) to improve it further, including skipping a line after each style.

Has anybody already realized such a tool?

Spoiler:

Code:
body {font-family:'Times New Roman'}
span.smcpIncise {font-family: 'LinuxLibertineOCRegular';font-style:normal}
span.smcpTypeA {font-family: 'LinuxLibertineOCRegular';font-style:normal; margin-left: -1em}
span.smcpTypeV {font-family: 'LinuxLibertineOCRegular';font-style:normal;margin-left: 0em}
a:link {color:#000080;text-decoration:underline}
p.smcpCentrage {margin-left:0.0cm;margin-right:0.0cm;margin-top:0.499cm;margin-bottom:0.499cm;border:none;padding:0;text-indent:0.0cm;text-align:center;font-family: 'LinuxLibertineOCRegular';font-size:83%}
p.Italdroite {margin-left:0.0cm;margin-right0.499cm;margin-top:0.499cm;margin-bottom:0.499cm;border:none;padding:0;text-indent:0.0cm;text-align:right;font-style:italic;font-weight:normal;font-size:83%}
p.let {margin-left:0.0cm;margin-right:0.0cm;margin-top:0.0cm;margin-bottom:0.0cm;border:none;padding:0;background-color:transparent;text-indent:0.0cm;text-align:justify}
p.smcpDroite {margin-left:0.0cm;margin-right:0.499cm;margin-top:0.499cm;margin-bottom:0.499cm;border:none;padding:0;text-indent:0.0cm;text-align:right;font-family: 'LinuxLibertineOCRegular';font-style:normal;font-weight:normal;font-size:83%}
p.Centrage {margin-left:0.0cm;margin-right:0.0cm;margin-top:0.499cm;margin-bottom:0.499cm;border:none;padding:0;text-indent:0.0cm;text-align:center;font-size:83%}
p.Textbody {margin-left:0.0cm;margin-right:0.0cm;margin-top:0.0cm;margin-bottom:0.0cm;border:none;padding:0;background-color:transparent;text-indent:0.9cm;text-align:justify}
p.Header {margin-left:0;margin-right:0;margin-top:0.6cm;margin-bottom:0.6cm;border:none;padding:0;text-align:center;font-style:italic;font-weight:normal;font-size:83%}
h2 {page-break-before:always;margin-left:0.0cm;margin-right:0.0cm;margin-top:1.499cm;margin-bottom:0.601cm;border:none;padding:0.0cm;text-indent:0.0cm;text-align:center;font-family:'Times New Roman',serif;font-style:normal;font-variant:normal;font-weight:normal;text-decoration:none;text-transform:none;clear:left}
.frameGraphics {margin-left:0;margin-right:0;margin-top:0;margin-bottom:1em;border:none;padding:0}
.frameFrame {margin-left:0.201cm;margin-right:0.201cm;margin-top:0.201cm;margin-bottom:0.201cm;border:0.05cm solid #000000;padding:0.15cm}
.frameGraphics p {margin-left:0;margin-right:0;margin-top:0;margin-bottom:0}
.frameFrame p {margin-left:0.201cm;margin-right:0.201cm;margin-top:0.201cm;margin-bottom:0.201cm}
body {background-color:transparent}

As you all know better than me, the target would thus be like this
Code:
span.smcpIncise {
  font-family: 'LinuxLibertineOCRegular';
  font-style:normal
}

Last edited by roger64; 06-11-2012 at 03:01 AM. Reason: sweat
roger64 is online now   Reply With Quote
Old 06-11-2012, 01:19 AM   #2
cybmole
Wizard
cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.
 
Posts: 2,354
Karma: 1048182
Join Date: Sep 2010
Device: Kobo aura HD, Kobo Arc, Sony T2, Kindle Fire HDX 8.9 , Kindle for PC
run your book through an epub to epub conversion in calibre - that puts all styles in alphabetic order & I think it also tidies the display.

it may do other things you don't want - like renaming some styles - though
cybmole is offline   Reply With Quote
Old 06-11-2012, 02:28 AM   #3
roger64
Wizard
roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.
 
Posts: 1,310
Karma: 846401
Join Date: Jan 2009
Device: KoboGlo
A solution from a Linux forum. The style sheet to be cleaned is named Brute and is sitting on my Desktop (Bureau).

Code:
roger@lmde64 ~ $ cd ~/Bureau
roger@lmde64 ~/Bureau $ sort Brute -o Brute
roger@lmde64 ~/Bureau $ sed -i 's/{/{\n\t/;s/:/: /g;s/;/;\n\t/g;s/}/;\n}\n/' Brute
roger@lmde64 ~/Bureau $
And here is the instant result (long life Linux!): Compare with the spoiler in the first message.
Spoiler:

Code:
a: link {
	color: #000080;
	text-decoration: underline;
}

body {
	background-color: transparent;
}

body {
	font-family: 'Times New Roman';
}

.frameFrame {
	margin-left: 0.201cm;
	margin-right: 0.201cm;
	margin-top: 0.201cm;
	margin-bottom: 0.201cm;
	border: 0.05cm solid #000000;
	padding: 0.15cm;
}

.frameFrame p {
	margin-left: 0.201cm;
	margin-right: 0.201cm;
	margin-top: 0.201cm;
	margin-bottom: 0.201cm;
}

.frameGraphics {
	margin-left: 0;
	margin-right: 0;
	margin-top: 0;
	margin-bottom: 1em;
	border: none;
	padding: 0;
}

.frameGraphics p {
	margin-left: 0;
	margin-right: 0;
	margin-top: 0;
	margin-bottom: 0;
}

h2 {
	page-break-before: always;
	margin-left: 0.0cm;
	margin-right: 0.0cm;
	margin-top: 1.499cm;
	margin-bottom: 0.601cm;
	border: none;
	padding: 0.0cm;
	text-indent: 0.0cm;
	text-align: center;
	font-family: 'Times New Roman',serif;
	font-style: normal;
	font-variant: normal;
	font-weight: normal;
	text-decoration: none;
	text-transform: none;
	clear: left;
}

p.Centrage {
	margin-left: 0.0cm;
	margin-right: 0.0cm;
	margin-top: 0.499cm;
	margin-bottom: 0.499cm;
	border: none;
	padding: 0;
	text-indent: 0.0cm;
	text-align: center;
	font-size: 83%;
}

p.Header {
	margin-left: 0;
	margin-right: 0;
	margin-top: 0.6cm;
	margin-bottom: 0.6cm;
	border: none;
	padding: 0;
	text-align: center;
	font-style: italic;
	font-weight: normal;
	font-size: 83%;
}

p.Italdroite {
	margin-left: 0.0cm;
	margin-right0.499cm;
	margin-top: 0.499cm;
	margin-bottom: 0.499cm;
	border: none;
	padding: 0;
	text-indent: 0.0cm;
	text-align: right;
	font-style: italic;
	font-weight: normal;
	font-size: 83%;
}

p.let {
	margin-left: 0.0cm;
	margin-right: 0.0cm;
	margin-top: 0.0cm;
	margin-bottom: 0.0cm;
	border: none;
	padding: 0;
	background-color: transparent;
	text-indent: 0.0cm;
	text-align: justify;
}

p.smcpCentrage {
	margin-left: 0.0cm;
	margin-right: 0.0cm;
	margin-top: 0.499cm;
	margin-bottom: 0.499cm;
	border: none;
	padding: 0;
	text-indent: 0.0cm;
	text-align: center;
	font-family:  'LinuxLibertineOCRegular';
	font-size: 83%;
}

p.smcpDroite {
	margin-left: 0.0cm;
	margin-right: 0.499cm;
	margin-top: 0.499cm;
	margin-bottom: 0.499cm;
	border: none;
	padding: 0;
	text-indent: 0.0cm;
	text-align: right;
	font-family:  'LinuxLibertineOCRegular';
	font-style: normal;
	font-weight: normal;
	font-size: 83%;
}

p.Textbody {
	margin-left: 0.0cm;
	margin-right: 0.0cm;
	margin-top: 0.0cm;
	margin-bottom: 0.0cm;
	border: none;
	padding: 0;
	background-color: transparent;
	text-indent: 0.9cm;
	text-align: justify;
}

span.smcpIncise {
	font-family:  'LinuxLibertineOCRegular';
	font-style: normal;
}

span.smcpTypeA {
	font-family:  'LinuxLibertineOCRegular';
	font-style: normal;
	 margin-left:  -1em;
}

span.smcpTypeV {
	font-family:  'LinuxLibertineOCRegular';
	font-style: normal;
	margin-left:  0em;
}

To install in the Sigil of tomorrow?

Note: The above command adds one ; before the } to make editing easier. Pay attention to this because it could trigger some silent mistakes. If you are unhappy with this, easy, just take out the last ; in the command (the one before the sign } )

Last edited by roger64; 06-11-2012 at 10:48 AM.
roger64 is online now   Reply With Quote
Old 06-11-2012, 02:31 AM   #4
roger64
Wizard
roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.
 
Posts: 1,310
Karma: 846401
Join Date: Jan 2009
Device: KoboGlo
cancel

Last edited by roger64; 06-11-2012 at 02:43 AM.
roger64 is online now   Reply With Quote
Old 06-11-2012, 10:52 AM   #5
jbacelar
Connoisseur
jbacelar began at the beginning.
 
Posts: 60
Karma: 30
Join Date: Dec 2011
Location: Spain, south coast
Device: PocketBook 622
Only Windows: Free CSS Toolbox
http://www.blumentals.net/csstool/index.php
jbacelar is online now   Reply With Quote
Old 06-11-2012, 11:35 AM   #6
roger64
Wizard
roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.
 
Posts: 1,310
Karma: 846401
Join Date: Jan 2009
Device: KoboGlo
Quote:
Originally Posted by jbacelar View Post
Only Windows: Free CSS Toolbox
http://www.blumentals.net/csstool/index.php
Thanks for the tip. Works with Linux too, using Wine.
Attached Thumbnails
Click image for larger version

Name:	Capture du 2012-06-11 17:31:50.png
Views:	47
Size:	135.0 KB
ID:	87588  
roger64 is online now   Reply With Quote
Old 06-11-2012, 11:47 AM   #7
DaleDe
Grand Sorcerer
DaleDe ought to be getting tired of karma fortunes by now.DaleDe ought to be getting tired of karma fortunes by now.DaleDe ought to be getting tired of karma fortunes by now.DaleDe ought to be getting tired of karma fortunes by now.DaleDe ought to be getting tired of karma fortunes by now.DaleDe ought to be getting tired of karma fortunes by now.DaleDe ought to be getting tired of karma fortunes by now.DaleDe ought to be getting tired of karma fortunes by now.DaleDe ought to be getting tired of karma fortunes by now.DaleDe ought to be getting tired of karma fortunes by now.DaleDe ought to be getting tired of karma fortunes by now.
 
DaleDe's Avatar
 
Posts: 9,384
Karma: 4531750
Join Date: Aug 2007
Location: Grass Valley, CA
Device: EB 1150, EZ Reader, Literati, iPad 2
Nice free tool. I built a wiki page on our wiki for it.
DaleDe is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: Aldiko ignoring style sheet property? purcelljf ePub 6 11-19-2012 08:15 AM
How to link the style sheet in Sigil? JJ Joseph Sigil 6 06-15-2012 12:49 AM
Style Sheet editor? GraciousMe Sigil 6 06-04-2012 03:06 PM
An example file of your CSS style sheet roger64 Writer2ePub 6 04-11-2012 02:59 AM
Missing style sheet mauvais Barnes & Noble NOOK 3 12-05-2011 06:29 PM


All times are GMT -4. The time now is 03:27 AM.


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