Publication of the French translation of Ali's "Programming in D" book

Raphaël Jakse raphael.jakse at gmail.com
Sun Dec 8 15:03:18 PST 2013


Le 08/12/2013 22:29, Andrei Alexandrescu a écrit :
> On 12/8/13 1:22 PM, Raphaël Jakse wrote:
>> To be fair, I used Whata! mainly because I am the author of this syntax
>> and I'm used to it.
>
> I'd say that's a perfectly reasonable answer.
>
>> I can try to explain why I wrote Whata! instead of Markdown.
>
> Does Whata! have a good macro system? After much thinking I got to the
> conclusion a good macro system is essential for generating quality
> published material (which sadly is contradicted by the likes of Markdown
> which lack decent macro systems).

Thank you for your answer.

Depending on what you mean by macro, I got to the same conclusion and 
marcos are planned at high priority.

When the work is done, users will be able to define their own tag to do 
whatever they want.
However, they might need to do it for each output format (LaTeX.

An example would be a [theorem] tag :

[theorem Fermat's little theorem |
	 If [m p] is a prime number, then for any integer [m a], the number [m 
a^p-a] is an integer multiple of [m p].
]

producing the following HTML output:

<section class="whata-theorem">
	<h1 class="theorem-title"> Fermat's little theorem </h1>
	<div class="theorem-content">
		<p>If <script title="2+2" type="math/tex">p</script> is a prime 
number, then for any integer <script title="a" 
type="math/tex">a</script>, the number <script title="a^p-a" 
type="math/tex">a^p-a</script> is an integer multiple of <script 
title="p" type="math/tex">p</script>.</p>
	</div>
</section>

This is already possible and used in the HTML version of Whata!, but not 
very convenient as-is. Still to be implemented in the LaTeX version.

Template seems to be a good way to implement simple user-defined tags. 
For more complex stuffs, users should be able to write package for 
whata, like in LaTeX. However, unlike LaTeX, parsing will be done by the 
Whata! parser, the package will have to use either the DOM tree output 
by Whata!, or its text content.
This is to avoid situations like lstset breaking utf-8 if special 
characters are used in listings under certain conditions, or having to 
use ^^J if you use listings inside tabularx, or having to declare 
lstlistings after the babel package.

This won't prevent user defined tags to parse their text content if they 
need a particular language.
If someone needs a [html] tag which is output as-is to HTML, it will be 
possible to define it:

	[html <<<
		<p> a HTML paragraph </p>
	>>>]

But structure of the document won't be guaranteed anymore, and any 
compatibility with the LaTeX output might be hard to reach.


Users can also define arbitrary values in their document using the [set] 
tag at the beginning of the Whata! file. These This is already used to 
give a title, a date and an author. Values are also parsed as Whata!.

[set
	title  = "Programmer en D"
	author = "Ali Çehreli, [i traduit par Raphaël Jakse]"
]

Eventually, users will be able to use templates HTML and LaTeX templates 
for their documents. They are already able to give a css file to use for 
the HTML version. I don't know how to style a LaTeX document yet. As a 
workaround, they can do some post treatment to the generated .tex file.


Once again, I'm open to any suggestion ;-)

>
>
> Andrei
>



More information about the Digitalmars-d mailing list