Dear gang,
Ok, I'm rolling up my sleeves and taking another stab at exporting to
xhtml (maybe even epub). Major project, so taking this one small step at a
time.
The immediate aim is to get correct output in a browser (I use Opera, and
Chrome as a control). Test files attached.
Immediate problem is highlights.
export-highlight.tex==
\setupbackend
[export=yes,css=highlight.css]
\definehighlight[emphasis] [style=italic]
\definehighlight[important][style=bold]
\definehighlight[regular][style=\tf]
\starttext
\startchapter[title=Highlights]
\startparagraph
This is \emphasis{emphasis}. This is \important{important}. This is
\regular{regular}.
This is \emphasis{some emphasized text, with \regular{regular} in between}.
This is \important{some important text, with \regular{regular} in between}.
\stopparagraph
\stopchapter
\stoptext
===
In highlight.css (copied from export-sample.css and modified) I added
these lines:
==
highlight [detail=emphasis]{
font-weight : italic ;
}
highlight [detail=important]{
font-weight : bold ;
}
highlight [detail=regular]{
font-weight : regular ;
}
==
Results:
===export-highlight-tag.xhtml
sectioncontent
paragraphThis is highlight detail=emphasisemphasis/highlight.
This is highlight detail=importantimportant/highlight. This is
highlight detail=regularregular/highlight.break/
This is highlight detail=emphasissome emphasized text, with highlight
detail=regularregular/highlight in between/highlight.break/
This is highlight detail=importantsome important text, with highlight
detail=regularregular/highlight in between/highlight./paragraph
/sectioncontent
===export-highlight-div.xhtml
div class=paragraphThis is div class=highlight
emphasisemphasis/div. This is div class=highlight
importantimportant/div. This is div class=highlight
regularregular/div.div class=break!--empty--/div
This is div class=highlight emphasissome emphasized text, with div
class=highlight regularregular/div in between/div.div
class=break!--empty--/div
This is div class=highlight importantsome important text, with div
class=highlight regularregular/div in between/div./div
=
Observation: Opera won't render *-raw.xml, so we ignore that file.
In a browser we have
Challenge 1:
Neither export-highlight-tag.xhtml nor export-highlight-div.xhtml renders
the highlights. What do we need to do?
Challenge 2:
export-highlight-div.xhtml breaks the line before a highlight as well as
after a highlight. What is missing here?
Aim: To turn my current project into an epub, or at least something that
can be viewed in a browser (xhtml).
Caveat: I don't know much web development (css, xhtml, div, etc) but am
willing to work with what I have... but only IF there is a finish line. If
there is no finish line (i.e., things are too broken at the moment to get
the mission accomplished via what ConTeXt and CSS provide) kindly let me
know so I can stop now!
Henning Hraban Ramm and Aditya Mahajan mentioned XSLT stylesheets, but
this is probably way above my paygrade, unless someone can give me very
simple newbie pointers.
Thanks to all in advance and
Best wishes
Idris
--
Idris Samawi Hamid
Professor of Philosophy
Colorado State University
Fort Collins, CO 80523
export-highlight.tex
Description: TeX document
export-highlight.pdf
Description: Adobe PDF document
/*
author: Hans Hagen, PRAGMA-ADE, Hasselt NL
copyright : PRAGMA ADE / ConTeXt Development Team
license : see context related readme files
comment : companion to context.mkiv
*/
/* ignore : mixed */
/* metadata: display */
ignore {
display : none ;
}
xmetadata {
display : none ;
}
xmetavariable {
display : none ;
}
/* document : display */
document:before {
content : attr(title) ;
font-size : 44pt ;
font-weight : bold ;
margin-bottom : 1em ;
}
document {
font-family : DejaVu Serif, Lucida Bright, serif ;
font-size: 12pt ;
max-width: 50em ;
padding : 1em ;
/* text-align : justify ;*/
/* hyphens : manual ; */
/* text-justify : inter-word ; */
}
documentmetadata {
font-family : Lucida Console, DejaVu Sans Mono, monospace ;
margin-bottom : 2em ;
}
documentmetadatametavariable[name=title]:before {
content : title\00A0\00A0\00A0:\00A0 ;
}
documentmetadatametavariable[name=author]:before {
content : author\00A0\00A0:\00A0 ;
}
documentmetadatametavariable[name=version]:before {
content : version\00A0:\00A0 ;
}
documentmetadatametavariable[name=title], documentmetadatametavariable[name=author], documentmetadatametavariable[name=version] {
display : block ;
}
/* paragraph : mixed */
/* p : mixed */
paragraph, p {
display : block ;
margin-top: 0.5em ;
margin-bottom : 0.5em ;
}
/* break : display