View Single Post
Old 01-21-2020, 01:39 PM   #7
thiago.eec
Wizard
thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.
 
Posts: 1,218
Karma: 1419583
Join Date: Dec 2016
Location: Goiânia - Brazil
Device: iPad, Kindle Paperwhite, Kindle Oasis
Quote:
Originally Posted by Brett Merkey View Post
That is precisely why the "clean CSS" Calibre tool will remove all the interesting structural code added in the conversion.
I just did a conversion here, from EPUB to AZW3.

This is the original style sheet:
Spoiler:

.tp {
margin-top: 1em;
text-align: center;
}

h1.otherbooks
{
text-align: center;
font-size: medium;
margin-bottom: 1em;
margin-top: 4em;
}

div.otherbooks
{
margin-top: 4em;
font-size: small;
margin-left: 2em;
margin-right: 2em;
}

div.copyright
{
font-size: small;
text-align: center;
margin-top: 4em;
}

div.dedication
{
font-size: small;
margin-top: 8em;
}

div.epigraph
{
font-size: medium;
margin-left: 12em;
margin-right: 4em;
margin-bottom: 2em;
margin-top: 2em;
}

div.epigraphsource
{
font-size: x-small;
text-align: right;
font-style: italic;
margin-bottom: 12em;
margin-right: 2em;
}

h1.acknowledgments
{
font-size: medium;
margin-top: 4em;
text-align: center;
font-weight: bold;
}

div.acknowledgments
{
font-size: small;
text-align: justify;
margin-left: 2em;
margin-right: 2em;
}

h1.authorsnote
{
font-size: medium;
text-align: center;
font-style: italic;
font-weight: bold;
}

div.authorsnote
{
font-size: small;
text-align: justify;
}

h1.listoffigures
{
font-size: medium;
text-align: center;
font-style: italic;
font-weight: bold;
}

div.listoffigures
{
font-size: small;
text-align: left;
}

h1.chronology
{
font-size: medium;
text-align: center;
font-style: italic;
font-weight: bold;
}

h1.geneology
{
font-size: medium;
text-align: center;
font-style: italic;
font-weight: bold;
}

h1.foreword
{
font-size: medium;
text-align: center;
font-style: italic;
font-weight: bold;
}

h1.preface
{
font-size: medium;
text-align: center;
font-style: italic;
font-weight: bold;
}

h1.introduction
{
font-size: medium;
text-align: center;
font-style: italic;
font-weight: bold;
}

h1.prologue
{
font-size: medium;
text-align: center;
font-style: italic;
font-weight: bold;
}

h1.part
{
line-height: 2em;
margin-top: 4em;
margin-bottom: 1em;
font-size: large;
text-align: center;
font-weight: bold;
}

h1.chapter
{
font-size: 110%;
text-align: center;
font-weight: normal;
line-height: 1.5em;
margin-top: 4em;
margin-bottom: 6em;
}

h1.subchapter
{
font-size: medium;
text-align: center;
font-style: italic;
font-weight: bold;
}

h1.epilogue
{
font-size: medium;
text-align: center;
font-style: italic;
font-weight: bold;
}

h1.coda
{
font-size: medium;
text-align: center;
font-style: italic;
font-weight: bold;
}

h1.conclusion
{
font-size: medium;
text-align: center;
font-style: italic;
font-weight: bold;
}

h1.afterward
{
font-size: medium;
text-align: center;
font-style: italic;
font-weight: bold;
}

h1.permission
{
font-size: medium;
text-align: center;
font-style: italic;
font-weight: bold;
}

h1.glossary
{
font-size: medium;
text-align: center;
font-style: italic;
font-weight: bold;
}

span.glosaryterm
{
font-size: small;
text-align: left;
margin-right: 1em;
}

span.glosarydef
{
font-size: small;
text-align: left;
margin-right: 1em;
}

h1.appendix
{
font-size: medium;
text-align: center;
font-style: italic;
font-weight: bold;
}

h1.resource
{
font-size: medium;
text-align: center;
font-style: italic;
font-weight: bold;
}

h1.notes
{
font-size: medium;
text-align: center;
font-style: italic;
font-weight: bold;
}

div.note
{
font-size: x-small;
text-align: justify;
margin-left: 1em;
}

h1.source
{
font-size: medium;
text-align: center;
font-style: italic;
font-weight: bold;
}

h1.bibliography
{
font-size: medium;
text-align: center;
font-style: italic;
font-weight: bold;
}

div.bibliography
{
font-size: x-small;
text-align: justify;
margin-left: 2em;
font-weight: bold;
}

h1.suggestedreading
{
font-size: medium;
text-align: center;
font-style: italic;
font-weight: bold;
}

h1.abouttheauthor
{
font-size: medium;
text-align: center;
font-style: italic;
font-weight: bold;
}

p.smallheight
{
margin-top: 1em;
margin-bottom: 1em;
}

p.mediumheight
{
margin-top: 2em;
margin-bottom: 2em;
}

p.attribution
{
text-align: center;
}


p.largeheight
{
margin-top: 3em;
margin-bottom: 3em;
}

div.list
{
font-size: small;
margin-left: 1em;
}


h1.box
{
font-size: medium;
font-style: italic;
text-align: center;
}

div.box
{
font-size: small;
margin-left: 1em;
}

p.caption
{
font-size: x-small;
font-style: italic;
text-align: center;
margin-bottom: 1em;
}


/* ===================== Added Styles ===================== */

p.indent
{
text-indent: 1.00em;
text-align: justify;
}

p.right
{
text-align: right;
}

p.center
{
margin-top: 1em;
text-align: center;
margin-bottom: 1em;
}

a.hlink
{
text-decoration: none;
}

p.figure
{
margin-top: 2em;
text-align: center;
margin-bottom: 2em;
}

h1.subtitle
{
font-size: x-large;
text-align: center;
font-weight: bold;
margin-bottom: 4em;
}


h1.contents
{
font-size: medium;
text-align: center;
font-style: italic;
font-weight: bold;
}

h2.title
{
font-size: medium;
text-align: center;
}

p.smallheight
{
margin-top: 1em;
}

p.mediumheight
{
margin-top: 2em;
}

p
{
margin-top: .3em;
margin-bottom: .3em;
}

div.cover
{
text-align: center;
height: 100%;
}

div.titlepage
{
text-align: center;
margin-top: 1.2em;
margin-left: -.4em;
}

a.pubhlink
{
text-decoration: none;
color: green;
}

p.extract
{
text-align: justify;
margin-top: 2em;
text-indent: 0;
}

p.extract1
{
text-align: justify;
margin-top: 2em;
text-indent: 0;
text-indent: 1.00em;
}

div.textbox
{
margin-top: 2em;
margin-bottom: 2em;
border-bottom: 2px solid;
border-top: 2px solid;
line-height: 1.7em;
text-align: center;
}

h1.caption
{
font-size: medium;
margin-bottom: 1em;
}

p.box
{
border-bottom: 1px double;
border-left: 1px double;
border-top: 1px double;
border-right: 1px double;
text-align: justify;
}

div.abstract
{
font-size: small;
text-align: justify;
margin-left: 2em;
margin-right: 2em;
}

div.appendix
{
font-size: small;
text-align: justify;
}

p.reference
{
text-align: justify;
text-indent: -1.00em;
margin-left: 1em;
}

div.biboliography
{
font-size: medium;
text-align: justify;
}

div.preface
{
font-size: small;
text-align: justify;
margin-left: 2em;
margin-right: 2em;
}

p.cop
{
margin-bottom: 1em;
}

p.nonindent
{
text-align: justify;
text-indent: 0;
}

span.small
{
font-size: x-small;
}

div.toc
{
font-size: medium;
text-align: center;
}

p.stanga
{
text-align: justify;
margin-top: 1em;
margin-bottom: 1em;
margin-left: 2em;
}

body
{
font-size: medium;
line-height: 1.2em;
margin-top: 1em;
margin-left: 1em;
margin-right: 2em;
font-family: Charis, "Times New Roman", Verdana, Arial;
}

@font-face
{
font-family: "Charis";
font-style: normal;
font-weight: normal;
src:url(fonts/CharisSILR.ttf);
}

@font-face
{
font-family: "Charis";
font-style: normal;
font-weight: bold;
src:url(fonts/CharisSILB.ttf);
}

@font-face
{
font-family: "Charis";
font-style: italic;
font-weight: normal;
src:url(fonts/CharisSILI.ttf);
}

@font-face
{
font-family: "Charis";
font-style: italic;
font-weight: bold;
src:url(fonts/CharisSILBI.ttf);
}

h3.title
{
font-size: medium;
text-align: center;
margin-bottom: 3em;
}

span.dropcaps
{
float: left;
font-size: 50px;
line-height: 50px;
padding-top: 1px;
margin-top: -.09em;
margin-right: .09em;
}

span.dropcaps3lines
{
float: left;
font-size: 80px;
line-height: 70px;
padding-top: 1px;
margin-top: -.09em;
margin-right: .09em;
}

sup.small
{
font-size: small;
line-height: 0.0em;
}

div.footnote
{
font-size: small;
border-style: solid;
border-width: 1px 0 0 0;
margin-top: 2em;
}

p.footnote
{
text-align: justify;
margin-left: 2em;
}

p.question
{
text-align: justify;
margin-top: 1em;
}

div.small-page
{
margin-top: 2em;
font-size: medium;
margin-left: 12em;
margin-right: 6em;
}

h1.toc
{
text-align: center;
font-size: 110%;
margin-top: 3em;
margin-bottom: 2em;
font-weight: normal;
}

ol.upperalpha
{
text-align: justify;
list-style-type: upper-alpha;
}

ol.upperroman
{
text-align: justify;
list-style-type: upper-roman;
}

ol.lowerroman
{
text-align: justify;
list-style-type: lower-roman;
}

ol.loweralpha
{
text-align: justify;
list-style-type: lower-alpha;
}


ol.arabic
{
text-align: justify;
}
ul.bullet
{
list-style-type: disc;
}

ul.none
{
text-align: justify;
list-style-type: none;
}

p.hanging
{
text-indent: -1em;
font-size: medium;
margin-left: 2.5em;
margin-top: 0.5em;
}

h1.section
{
text-align: left;
font-size: medium;
margin-bottom: 1em;
margin-top: 4em;
}

h2.section
{
text-align: center;
font-size: medium;
margin-bottom: 1em;
margin-top: 4em;
}

h3.section
{
text-align: left;
font-size: medium;
margin-bottom: 1em;
margin-top: 4em;
}

h4.section
{
text-align: left;
font-size: medium;
margin-bottom: 1em;
margin-top: 4em;
}

h5.section
{
text-align: left;
font-size: medium;
margin-bottom: 1em;
margin-top: 4em;
}

span.underline
{
text-decoration: underline;
}

span.big
{
font-size: large;
}

p.crt
{
margin-top: 1em;
text-align: center;
margin-bottom: 1em;
}

span.overline
{
text-decoration: overline;
}

p.textbox
{
text-align: justify;
margin-left: 1em;
margin-right: 1em;

}

p.textbox1
{
text-indent: 1.00em;
text-align: justify;
margin-left: 1em;
margin-right: 1em;
}

div.chapter
{
margin-top: 2em;
margin-left: 0.5em;
margin-right: 0.5em;
}

span.strike
{
text-decoration: line-through;
}

img
{
max-height: 100%;
max-width: 100%;
}


sup
{
vertical-align: 4px;
}

sup.frac, sub.frac
{
font-size: 0.7em;
}

p.pagebreak
{
page-break-before: always;
}

p.textboxextract
{
margin-top: 2em;
text-align: justify;
margin-left: 1em;
margin-right: 1em;
}

/* =============== New Style added =============== */

/* == For TOC == */

div.toc_fm
{
margin-top:1em;
margin-bottom:1em;
margin-left:1.5em;
font-size:.9em;
line-height:1em;
}

div.toc_bm
{
margin-top:1em;
margin-bottom:1em;
margin-left:1.5em;
font-size:.9em;
line-height:1em;
}

div.toc_chap
{
margin-left:1.5em;
font-size:1em;
line-height:1.4em;
}

div.toc_sub
{
margin-left:2em;
font-size:smaller;
line-height:1.4em;
}

div.toc_part
{
margin-left:1.5em;
line-height:1.5em;
font-size:1.2em;
}

.toc_part .toc_chap
{
font-size:medium;
margin-left:1.5em;
}

.toc_part .toc_chap .toc_sub
{
font-size:smaller;
margin-left:1.5em;
}


/* == For Block Quotes == */

div.block
{
margin-left: 0em;
margin-right: 0em;
text-align:justify;
margin-top: 1em;
margin-bottom: 1em;
font-size: small;
}

p.bl_nonindent
{
margin-left:2.5em;
margin-right:2.5em;
text-align:justify;
}

p.bl_indent
{
text-indent:1em;
margin-left:2.5em;
margin-right:2.5em;
text-align:justify;
}

p.bl_extract
{
margin-left:2.5em;
margin-right:2.5em;
text-align:justify;
margin-top: 2em;
}

p.bl_center
{
margin-left:2.5em;
margin-right:2.5em;
text-align: center;
}

p.bl_right
{
text-align: right;
margin-left:2.5em;
margin-right:2.5em;
}

p.bl_hanging
{
text-indent: -1em;
font-size: medium;
margin-left: 2.5em;
margin-top: 0.5em;
}


/* For Hanging Paragraphs */

div.hanging
{
margin-left: 1.0em;
}

/* For Dialogue Text */

div.dialogue
{
margin-left: 4.2em;
margin-bottom: 2em;
margin-top: 1.5em;
font-size: small;
}

p.d_hanging
{
text-indent: -4.2em;
font-size: small;
margin-top: 0.5em;
}

/* For bullet list */

ul.bullet
{
list-style-type: disc;
margin-top: 1em;
margin-bottom: 1em;
}
div.bullet
{
margin-left: .8em;
margin-top: 0;
margin-bottom: 0;
text-align: justify;
}

/* For Fractions */
.frac_num
{font-size:x-small; vertical-align:text-top;}
.frac_den
{font-size:x-small; vertical-align:text-bottom;}

div.floatleft
{
float: left;
}

div.floatright
{
float: right;
}

h1.chapter0
{
font-size: 110%;
text-align: center;
font-weight: normal;
line-height: 2em;
margin-top: 4em;
margin-bottom: 3em;
}

p.center0
{
margin-top: 1.5em;
text-align: center;
margin-bottom: 1.5em;
}

h1.chapter1
{
font-size: 100%;
text-align: center;
font-weight: normal;
line-height: 2em;
margin-top: 4em;
margin-bottom: 2em;
}

Now, this is the new style sheet after the conversion:
Spoiler:

.calibre {
display: block;
font-family: Charis, "Times New Roman", Verdana, Arial;
font-size: 1rem;
line-height: 1.2em;
padding-left: 0;
padding-right: 0;
margin: 0 5pt
}
.calibre1 {
font-style: italic
}
.calibre2 {
background-color: #FFF;
display: block;
font-family: Charis, "Times New Roman", Verdana, Arial;
font-size: 1rem;
line-height: 1.2em;
padding-left: 0;
padding-right: 0;
text-align: center;
margin: 0 5pt
}
.calibre3 {
height: auto;
max-height: 100%;
max-width: 100%;
width: auto
}
.calibre4 {
display: block
}
.calibre5 {
line-height: 1.2
}
.calibre6 {
font-style: italic;
line-height: 1.2
}
.calibre7 {
display: block;
line-height: 1.2
}
.center {
display: block;
text-align: center;
margin: 1em 0
}
.center1 {
display: block;
text-align: center;
margin: 1.5em 0
}
.chapter {
display: block;
font-size: 110%;
font-weight: normal;
line-height: 1.5em;
text-align: center;
margin: 4em 0 6em
}
.chapter1 {
display: block;
font-size: 110%;
font-weight: normal;
line-height: 2em;
text-align: center;
margin: 4em 0 3em
}
.chapter2 {
display: block;
font-size: 100%;
font-weight: normal;
line-height: 2em;
text-align: center;
margin: 4em 0 2em
}
.copyright {
display: block;
font-size: 0.8rem;
margin-top: 4em;
text-align: center
}
.dedication {
display: block;
font-size: 0.8rem;
margin-top: 8em
}
.extract {
display: block;
text-align: justify;
text-indent: 0;
margin: 2em 0 0.3em
}
.footnote {
border-bottom-style: solid;
border-bottom-width: 0;
border-left-style: solid;
border-left-width: 0;
border-right-style: solid;
border-right-width: 0;
border-top-style: solid;
border-top-width: 1px;
display: block;
font-size: 0.8rem;
margin-top: 2em
}
.footnote1 {
display: block;
text-align: justify;
margin: 0.3em 0 0.3em 2em
}
.frac {
font-size: 0.7em;
line-height: normal;
vertical-align: 4px
}
.hlink {
line-height: 1.2;
text-decoration: none
}
.hlink1 {
text-decoration: none
}
.indent {
display: block;
text-align: justify;
text-indent: 1em;
margin: 0.3em 0
}
.nonindent {
display: block;
line-height: 1.2;
text-align: justify;
text-indent: 0;
margin: 0.3em 0
}
.nonindent1 {
display: block;
text-align: justify;
text-indent: 0;
margin: 0.3em 0
}
.pubhlink {
color: green;
text-decoration: none
}
.small {
font-size: 0.6rem
}
.titlepage {
display: block;
margin-left: -0.4em;
margin-top: 1.2em;
text-align: center
}
.toc {
display: block;
font-size: 110%;
font-weight: normal;
line-height: 1.2;
text-align: center;
margin: 3em 0 2em
}
.toc_chap {
display: block;
font-size: 1em;
line-height: 1.4em;
margin-left: 1.5em
}
.toc_fm {
display: block;
font-size: 0.9em;
line-height: 1.2;
margin-bottom: 1em;
margin-left: 1.5em;
margin-top: 1em
}

The resulting css has a lot of classes called 'calibreXX', and some of the original names are lost. The XHTML files are now referring to this new names. So, if you just paste the old style sheet, and clean the unused rules/classes, all the rules mismatching the text will be deleted, and so will be the classes unused on the XHTML files. Information/formatting will be lost.
thiago.eec is offline   Reply With Quote