From d542f84db48a56392ac9bd7681043b9632a1c344 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fredrik=20H=C3=BCbinette=20=28Hubbe=29?= <hubbe@hubbe.net> Date: Wed, 28 Jul 1999 15:49:43 -0700 Subject: [PATCH] lots of fixes for pdf version of tutorial Rev: tutorial/.cvsignore:1.21 Rev: tutorial/Wmml.pmod:1.42 Rev: tutorial/html.pike:1.38 Rev: tutorial/idonex-fonts.tex:1.2 Rev: tutorial/latex.pike:1.16 Rev: tutorial/pdflatex.pike:1.8 Rev: tutorial/tutorial.wmml:1.141 --- tutorial/.cvsignore | 1 + tutorial/.gitignore | 1 + tutorial/Wmml.pmod | 25 +++++++++--------- tutorial/html.pike | 7 ++++- tutorial/idonex-fonts.tex | 2 ++ tutorial/latex.pike | 55 ++++++++++++++++++++++++++++++--------- tutorial/pdflatex.pike | 3 ++- tutorial/tutorial.wmml | 45 ++++++++++++++++---------------- 8 files changed, 90 insertions(+), 49 deletions(-) diff --git a/tutorial/.cvsignore b/tutorial/.cvsignore index 70f02a08f7..4ded68cf71 100644 --- a/tutorial/.cvsignore +++ b/tutorial/.cvsignore @@ -35,6 +35,7 @@ tutorial.dvi tutorial.html tutorial.log tutorial.mif +tutorial.out tutorial.pdf tutorial.pdftex tutorial.ps diff --git a/tutorial/.gitignore b/tutorial/.gitignore index bff8f2b6c0..81123b11fd 100644 --- a/tutorial/.gitignore +++ b/tutorial/.gitignore @@ -35,6 +35,7 @@ /tutorial.html /tutorial.log /tutorial.mif +/tutorial.out /tutorial.pdf /tutorial.pdftex /tutorial.ps diff --git a/tutorial/Wmml.pmod b/tutorial/Wmml.pmod index 6f2276e1a0..aa077bc1cc 100644 --- a/tutorial/Wmml.pmod +++ b/tutorial/Wmml.pmod @@ -872,19 +872,18 @@ SGML low_make_concrete_wmml(SGML data) last=reverse(array_sscanf(reverse(fullname),"%*[^.>]%s")[0]); } array res= - ({Tag("dl",([]),tag->pos, - ({Tag("man_title",(["title":upper_case(tag->tag)]), - tag->pos, - Array.map( - fullnames, - lambda(string name,int pos) - { return ({Tag("tt",([]),pos,({name}))}); }, - tag->pos) - *({ ",", Tag("br") }) - +({ (tag->params->title - ?" - "+tag->params->title - :"")})) - }) + tag->data ) }); + ({Tag("man_title",(["title":upper_case(tag->tag)]), + tag->pos, + Array.map( + fullnames, + lambda(string name,int pos) + { return ({Tag("tt",([]),pos,({name}))}); }, + tag->pos) + *({ ",", Tag("br") }) + +({ (tag->params->title + ?" - "+tag->params->title + :"")})) + }) + tag->data; res= ({Tag(tag->tag,(["name":fullnames*", ", diff --git a/tutorial/html.pike b/tutorial/html.pike index c8b848ae3e..1a595b2318 100644 --- a/tutorial/html.pike +++ b/tutorial/html.pike @@ -958,7 +958,12 @@ SGML convert(SGML data) case "class": case "module": // strip this metainformation - ret+=convert(data->data); + ret+= + ({Sgml.Tag("dl",([]),data->pos, + convert(data->data), + ) + }); + continue; } data->data=convert(data->data); diff --git a/tutorial/idonex-fonts.tex b/tutorial/idonex-fonts.tex index a3b942fd25..7ead06820e 100644 --- a/tutorial/idonex-fonts.tex +++ b/tutorial/idonex-fonts.tex @@ -1 +1,3 @@ % Stub file + +\newcommand\PikeHeaderFont{\normalfont} diff --git a/tutorial/latex.pike b/tutorial/latex.pike index 597b3a5636..7b0a4e8178 100644 --- a/tutorial/latex.pike +++ b/tutorial/latex.pike @@ -32,7 +32,8 @@ string packages = string latex = "latex"; - +// #define BORDERCOLOR "{0,0.2,0}" +#define BORDERCOLOR "{0.153,0.13,0.357}" object wcache=.Cache("latex_wcache"); @@ -758,7 +759,7 @@ string convert_table(TAG table) { if(head) { - color="\\rowcolor[rgb]{0.153,0.13,0.357}%%\n"; + color="\\rowcolor[rgb]" BORDERCOLOR "%%\n"; for(int e=0;e<sizeof(ltxrow);e++) ltxrow[e]="\\color[rgb]{1,1,1}%\n"+ltxrow[e]; ltxrow[-1]+="\\normalcolor "; @@ -874,7 +875,7 @@ string low_index_to_latex(INDEX data, string prefix, int indent) string index_to_latex(INDEX foo) { string ret=""; - ret+="\n\\twocolumn[\\begin{Huge}Index\\end{Huge}]\n\\begin{small}\n"; + ret+="\n\\twocolumn\n\\chapter*{Index}\n\\begin{small}\n"; // ret+="\\begin{Huge}Index\\end{Huge}\n\n"; @@ -907,6 +908,7 @@ int in_table; constant FLAG_TABLE=1; constant FLAG_LIST=2; +constant FLAG_MAN_HEAD=4; string convert_to_latex(SGML data, void|int flags) @@ -926,7 +928,15 @@ string convert_to_latex(SGML data, void|int flags) case "smallcaps": ret+="{\\sc "+convert_to_latex(tag->data)+"}"; break; - case "tt": ret+="{\\tt "+convert_to_latex(tag->data)+"}"; break; + case "tt": + if(flags & FLAG_MAN_HEAD) + { + ret+="\\begin{Large}\\PikeHeaderFont "+convert_to_latex(tag->data)+"\\end{Large}\\normalfont\\normalcolor "; + }else{ + ret+="{\\tt "+convert_to_latex(tag->data)+"}"; + } + break; + case "ex_keyword": case "b": ret+="\\textbf{"+convert_to_latex(tag->data)+"}"; break; case "ex_meta": @@ -962,12 +972,33 @@ string convert_to_latex(SGML data, void|int flags) break; case "man_title": - // FIXME encaps? - // FIXME indentation - ret+="\n\n"+ - latex_quote(tag->params->title)+"\\\\\n "+ - convert_to_latex(tag->data)+ - "\n"; + switch(lower_case(tag->params->title)) + { + case "function": + case "method": + case "constant": + case "variable": + case "module": + case "class": + case "name": + ret+="\n\n\\pagebreak[0]\n\\begin{tabular}{p{\\linewidth}}\n" + ""+convert_to_latex(tag->data,FLAG_MAN_HEAD)+"\\\\\n" + "\\hline\n" + "\\end{tabular}\\nopagebreak\n\n\\nopagebreak "; + break; + + case "syntax": + ret+="\\nopagebreak\n\n\\nopagebreak \\parbox{\\linewidth}{%\n"+ + convert_to_latex(tag->data)+ + "}\n\\nopagebreak\n"; + break; + + default: + ret+="\n\n"+ + "\\PikeHeaderFont "+latex_quote(tag->params->title)+":\\normalfont\\normalcolor\\\\\n "+ + convert_to_latex(tag->data)+ + "\n"; + } break; case "chapter": @@ -1080,9 +1111,9 @@ string convert_to_latex(SGML data, void|int flags) }else{ pre=1; // FIXME: we will have to remove all tags inside <pre> - ret+="{\\startcode\n\n"+ + ret+="\\begin{small}{\\startcode\n\n"+ convert_to_latex(tag->data)+ - "\n}\n"; + "\n}\\end{small}\n"; pre=0; } break; diff --git a/tutorial/pdflatex.pike b/tutorial/pdflatex.pike index 09b30bf06f..0720594020 100644 --- a/tutorial/pdflatex.pike +++ b/tutorial/pdflatex.pike @@ -21,6 +21,7 @@ string packages= \\usepackage[pdftex]{color} \\usepackage{colortbl} \\usepackage{parskip} +\\usepackage[pdftex,breaklinks,colorlinks,linkcolor=black]{hyperref} "; string latex="pdflatex"; @@ -74,9 +75,9 @@ string package(string x) \\pdfoutput=1 \\relax \\documentclass[twoside,a4paper]{book} +\\input{idonex-fonts.tex} "+packages+ #"\\begin{document} -\\input{idonex-fonts.tex} \\author{wmml2pdflatex} \\setlength{\\unitlength}{1mm} diff --git a/tutorial/tutorial.wmml b/tutorial/tutorial.wmml index 6066cf9aa0..26d3d67d63 100644 --- a/tutorial/tutorial.wmml +++ b/tutorial/tutorial.wmml @@ -6383,17 +6383,18 @@ array sum_arrays(function <I>fun</I>,array <I>arr1</I>,...); </man_syntax> <man_description> Works like this: -<p><tt>array sum_arrays(function fun,array arr1,...)<br> -{<br> -<dl><dt><dd>int e;<br> -array res=allocate(sizeof(arr1));<br> -for(e=0;e<sizeof(arr1);e++)<br> -{<br> -<dl><dt><dd>res[e]=fun(arr1[e],arr2[e],...);<br> -</dl>}<br> -return res;<br> -</dl>}<br> -</tt> +<example language=pike> +array sum_arrays(function fun,array arr1,...) +{ + int e; + array res=allocate(sizeof(arr1)); + for(e=0;e<sizeof(arr1);e++)<br> + { + res[e]=fun(arr1[e],arr2[e],...); + } + return res; +} +</example> <p>Simple ehh? </man_description> <man_see> @@ -10891,11 +10892,12 @@ If <i>seconds</i> is zero, no new alarm is scheduled. <p> In any event any previously set alarm is canceled. <p> -<dt><encaps>RETURN VALUE</encaps><dd> +</man_description> +<man_returns> <tt>alarm</tt> returns the number of seconds remaining until any previously scheduled alarm was due to be delivered, or zero if there was no previously scheduled alarm. -</man_description> +</man_returns> <man_see> signal </man_see> @@ -11007,14 +11009,15 @@ array(array) backtrace(); This function returns a description of the call stack at this moment. The description is returned in an array with one entry for each call in the stack. Each entry has this format: -<p>({<br> -<dl><dt><dd><table border=0 cellpadding=0 cellspacing=0> -<tr valign=top><td> file, </td><td> /* a string with the filename if known, else zero */ </td></tr> -<tr valign=top><td> line, </td><td> /* an integer containing the line if known, else zero */ </td></tr> -<tr valign=top><td> function, </td><td> /* The function pointer to the called function */ </td></tr> -<tr valign=top><td> mixed|void ..., </td><td> /* The arguments the function was called with */ </td></tr> +<p> +({ +<table border=0 cellpadding=0 cellspacing=0> +<tr valign=top><td><ex_indent> file, </td><td> /* a string with the filename if known, else zero */ </td></tr> +<tr valign=top><td><ex_indent> line, </td><td> /* an integer containing the line if known, else zero */ </td></tr> +<tr valign=top><td><ex_indent> function, </td><td> /* The function pointer to the called function */ </td></tr> +<tr valign=top><td><ex_indent> mixed|void ..., </td><td> /* The arguments the function was called with */ </td></tr> </table> -</dl>})<br> +}) <p>The current call frame will be last in the array, and the one above that the last but one and so on. @@ -11700,10 +11703,8 @@ elements in <i>arr</i> that resulted in a non-zero value from the function. function that gives a mapping back</man_returns> <man_see>map, foreach</man_see> - </function> - <function name=find_call_out title="find a call out in the queue"> <man_syntax> int find_call_out(function <I>f</I>);<br> -- GitLab