January 07, 2013
On 1/7/13 2:17 AM, Walter Bright wrote:
> On 1/6/2013 9:31 AM, Philippe Sigaud wrote:
>> Exactly.
>
> At one point I looked into doing Latex macros for Ddoc, but
> unfortunately it didn't look like it was doable without some extensive
> modifications to Ddoc.

??? I already have something in progress.

Andrei

January 07, 2013
On 1/6/2013 11:35 PM, Andrei Alexandrescu wrote:
> On 1/7/13 2:17 AM, Walter Bright wrote:
>> On 1/6/2013 9:31 AM, Philippe Sigaud wrote:
>>> Exactly.
>>
>> At one point I looked into doing Latex macros for Ddoc, but
>> unfortunately it didn't look like it was doable without some extensive
>> modifications to Ddoc.
>
> ??? I already have something in progress.

Cool! You know Latex far better than I.
January 07, 2013
On Mon, Jan 07, 2013 at 02:35:09AM -0500, Andrei Alexandrescu wrote:
> On 1/7/13 2:17 AM, Walter Bright wrote:
> >On 1/6/2013 9:31 AM, Philippe Sigaud wrote:
> >>Exactly.
> >
> >At one point I looked into doing Latex macros for Ddoc, but unfortunately it didn't look like it was doable without some extensive modifications to Ddoc.

I think the simplest way would be to allow the definition of some kind of post-processing filter that escapes LaTeX metacharacters with their appropriate substitutions. It can be as easy as a ddoc macro (or list of macros) that translates a given character into its LaTeX equivalent, with the default of no-op. So to adapt ddoc output to a particular format, you just have to override that particular set of metacharacters, and leave everything else as pass-through.


> ??? I already have something in progress.
[...]

Curious ears want to hear what that something is. :-)


T

-- 
Arise, you prisoners of Windows / Arise, you slaves of Redmond, Wash, / The day and hour soon are coming / When all the IT folks say "Gosh!" / It isn't from a clever lawsuit / That Windowsland will finally fall, / But thousands writing open source code / Like mice who nibble through a wall. -- The Linux-nationale by Greg Baker
January 07, 2013
On Monday, 7 January 2013 at 17:32:33 UTC, H. S. Teoh wrote:
> I think the simplest way would be to allow the definition of some kind of post-processing filter that escapes LaTeX
> metacharacters with their appropriate substitutions.

Believe it or not, but dmd already has the beginnings of this code! There's a ddoc escapes table.

from doc.c:

ESCAPES = /</&lt;/\n
          />/&gt;/\n
          /&/&amp;/\n


And there's code to parse it, but it isn't actually used. I did a dmd pull request a while ago to bring in this functionality but it didn't pass reviews. (A consequence of proper escaping would be that inline HTML, outside of macros, would no longer be permitted, because <b> etc would be properly escaped instead of printed out verbatim. This is far, far, far superior to the status quo, but it does break a lot of phobos documentation.)
January 07, 2013
On Mon, Jan 07, 2013 at 06:40:36PM +0100, Adam D. Ruppe wrote:
> On Monday, 7 January 2013 at 17:32:33 UTC, H. S. Teoh wrote:
> >I think the simplest way would be to allow the definition of some
> >kind of post-processing filter that escapes LaTeX
> >metacharacters with their appropriate substitutions.
> 
> Believe it or not, but dmd already has the beginnings of this code! There's a ddoc escapes table.
> 
> from doc.c:
> 
> ESCAPES = /</&lt;/\n
>           />/&gt;/\n
>           /&/&amp;/\n

This is exactly what's needed to produce proper LaTeX output.


> And there's code to parse it, but it isn't actually used. I did a dmd pull request a while ago to bring in this functionality but it didn't pass reviews. (A consequence of proper escaping would be that inline HTML, outside of macros, would no longer be permitted, because <b> etc would be properly escaped instead of printed out verbatim. This is far, far, far superior to the status quo, but it does break a lot of phobos documentation.)

Inline HTML should not be allowed in ddoc, because it completely defeats the purpose of the ddoc macro system allowing the same documentation to be rendered for multiple target formats.

We need to go through all instances of such errors in Phobos and fix 'em all.


T

-- 
Don't get stuck in a closet---wear yourself out.
January 07, 2013
On Monday, 7 January 2013 at 18:07:51 UTC, H. S. Teoh wrote:
> Inline HTML should not be allowed in ddoc, because it completely defeats the purpose of the ddoc macro system allowing the same documentation to be rendered for multiple target formats.
>
> We need to go through all instances of such errors in Phobos and fix 'em all.

 Depends on what HTML was used (and can extend to BBCode as well). If I were to add anything, it most likely would be bold/italic/underline & bullets. Those should be acceptable and overall easy to convert (or I would think so anyways).
January 07, 2013
On 1/7/13 9:30 AM, H. S. Teoh wrote:
> On Mon, Jan 07, 2013 at 02:35:09AM -0500, Andrei Alexandrescu wrote:
>> ??? I already have something in progress.
> [...]
>
> Curious ears want to hear what that something is. :-)

A set of ddoc macros that convert to LaTeX starting from Philippe's macros. The one systemic issue I encountered so far is tables, which in LaTeX must set the number of columns in advance.

Andrei
January 07, 2013
On 1/7/13 10:23 AM, Andrei Alexandrescu wrote:
> On 1/7/13 9:30 AM, H. S. Teoh wrote:
>> On Mon, Jan 07, 2013 at 02:35:09AM -0500, Andrei Alexandrescu wrote:
>>> ??? I already have something in progress.
>> [...]
>>
>> Curious ears want to hear what that something is. :-)
>
> A set of ddoc macros that convert to LaTeX starting from Philippe's
> macros. The one systemic issue I encountered so far is tables, which in
> LaTeX must set the number of columns in advance.
>
> Andrei

Heh, here's the first thing that I actually got to compile error-free from spec.dd and lex.dd: http://erdani.com/d/dlangspec.pdf. Had to fudge a few macros and some stuff doesn't expand to what it should, but from here the path is relatively easy.

Andrei
January 07, 2013
Al 07/01/13 20:19, En/na Andrei Alexandrescu ha escrit:
> On 1/7/13 10:23 AM, Andrei Alexandrescu wrote:
>> On 1/7/13 9:30 AM, H. S. Teoh wrote:
>>> On Mon, Jan 07, 2013 at 02:35:09AM -0500, Andrei Alexandrescu wrote:
>>>> ??? I already have something in progress.
>>> [...]
>>>
>>> Curious ears want to hear what that something is. :-)
>>
>> A set of ddoc macros that convert to LaTeX starting from Philippe's macros. The one systemic issue I encountered so far is tables, which in LaTeX must set the number of columns in advance.
>>
>> Andrei
> 
> Heh, here's the first thing that I actually got to compile error-free from spec.dd and lex.dd: http://erdani.com/d/dlangspec.pdf. Had to fudge a few macros and some stuff doesn't expand to what it should, but from here the path is relatively easy.
> 
> Andrei
> 

"htmldoc" converts html files into pdf, generating a toc.

In this sample I've removed original toc and "htmldoc" generated a toc with 2 levels. http://d-packages.googlecode.com/files/dlangspec.pdf

Unfortunately "htmldoc" do not support css.
-- 
Jordi Sayol
January 07, 2013
On Mon, Jan 7, 2013 at 7:23 PM, Andrei Alexandrescu < SeeWebsiteForEmail@erdani.org> wrote:

> On 1/7/13 9:30 AM, H. S. Teoh wrote:
>
>> On Mon, Jan 07, 2013 at 02:35:09AM -0500, Andrei Alexandrescu wrote:
>>
>>> ??? I already have something in progress.
>>>
>> [...]
>>
>>
>> Curious ears want to hear what that something is. :-)
>>
>
> A set of ddoc macros that convert to LaTeX starting from Philippe's macros. The one systemic issue I encountered so far is tables, which in LaTeX must set the number of columns in advance.


Same here. The two systems do not see tables in the same way.

Did you find a way to get syntax-highlighted code?