[NTG-context] Exporting highlights

Idris Samawi Hamid ادريس سماوي حامد ishamid at colostate.edu
Mon Mar 16 00:01:16 CET 2015


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>
    <paragraph>This is <highlight detail="emphasis">emphasis</highlight>.  
This is <highlight detail="important">important</highlight>. This is  
<highlight detail="regular">regular</highlight>.    <break/>
This is <highlight detail="emphasis">some emphasized text, with <highlight  
detail="regular">regular</highlight> in between</highlight>.    <break/>
This is <highlight detail="important">some important text, with <highlight  
detail="regular">regular</highlight> in between</highlight>.</paragraph>
   </sectioncontent>
=======export-highlight-div.xhtml========
    <div class="paragraph">This is <div class="highlight  
emphasis">emphasis</div>. This is <div class="highlight  
important">important</div>. This is <div class="highlight  
regular">regular</div>.    <div class="break"><!--empty--></div>
This is <div class="highlight emphasis">some emphasized text, with <div  
class="highlight regular">regular</div> in between</div>.    <div  
class="break"><!--empty--></div>
This is <div class="highlight important">some important text, with <div  
class="highlight regular">regular</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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: export-highlight.tex
Type: application/x-tex
Size: 510 bytes
Desc: not available
URL: <http://www.ntg.nl/pipermail/ntg-context/attachments/20150315/96c37d35/attachment-0001.tex>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: export-highlight.pdf
Type: application/pdf
Size: 15293 bytes
Desc: not available
URL: <http://www.ntg.nl/pipermail/ntg-context/attachments/20150315/96c37d35/attachment-0001.pdf>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: highlight.css
Type: text/css
Size: 13020 bytes
Desc: not available
URL: <http://www.ntg.nl/pipermail/ntg-context/attachments/20150315/96c37d35/attachment-0001.css>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: export-highlight-tag.xhtml
Type: application/xhtml+xml
Size: 1333 bytes
Desc: not available
URL: <http://www.ntg.nl/pipermail/ntg-context/attachments/20150315/96c37d35/attachment-0002.xhtml>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: export-highlight-div.xhtml
Type: application/xhtml+xml
Size: 1521 bytes
Desc: not available
URL: <http://www.ntg.nl/pipermail/ntg-context/attachments/20150315/96c37d35/attachment-0003.xhtml>


More information about the ntg-context mailing list