Re: [NTG-context] Exporting highlights

2015-03-16 Thread Idris Samawi Hamid ادريس سماوي حامد

Ok, I've made some progress:

On Sun, 15 Mar 2015 17:01:16 -0600, Idris Samawi Hamid ادريس سماوي حامد  
isha...@colostate.edu wrote:



export-highlight.tex==
\setupbackend
   [export=yes,css=highlight.css]


\setupexport[cssfile=highlight.css]
\setupbackend[export=yes]


\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 ;
}
==


Syntax correction (thanks Aditya!):

.highlight.emphasis {
  font-style: italic;
}

etc.


Challenge 1:
Neither export-highlight-tag.xhtml nor export-highlight-div.xhtml renders
the highlights. What do we need to do?


For italic, see above. For bold, we need

font-weight: bold;


Challenge 2:
export-highlight-div.xhtml breaks the line before a highlight as well as
after a highlight. What is missing here?


display: inline;

So here is exactly what we need:

.highlight.important {
   font-weight: bold;
  font-style: normal;
   display: inline;
}

.highlight.emphasis {
  font-weight: normal;
  font-style: italic;
  display: inline;
}

.highlight.regular {
  font-weight: normal;
  font-style: normal;
  display: inline;
}

Now export-highlight-div.xhtml renders in the browser exactly as in  
export-highlight.pdf.


This is progress: a first step!

Best wishes
Idris
--
Idris Samawi Hamid
Professor of Philosophy
Colorado State University
Fort Collins, CO 80523
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___

[NTG-context] Exporting highlights

2015-03-15 Thread Idris Samawi Hamid ادريس سماوي حامد

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 

Re: [NTG-context] Exporting highlights

2015-03-15 Thread Aditya Mahajan

On Sun, 15 Mar 2015, Idris Samawi Hamid ادريس سماوي حامد wrote:

[Dear Aditya, I sent this to the list; sending it to you to have a look as 
well. Any assistance is much appreciated, especially if I have to go the xslt 
route! Thanks in advance!!]


It has been almost 1.5 years since I had a serious look at XML generated 
by ConTeXt. At that time, ConTeXt did not generate XHTML, so I thought 
that one has to go through the XLST route. But, it looks that things have 
changed.



===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
=


This is very well formed XHTML. You just need a proper CSS stylesheet to 
do the correct rednering. Something like:


.highlight.important {
   font-weight: bold;
}

.highlight.emphasis {
  font-style: italic;
}

etc.

Aditya___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___