View mode: basic / threaded / horizontal-split · Log in · Help
January 05, 2013
Re: dlangspec.pdf?
On 1/5/13 4:38 PM, Philippe Sigaud wrote:
> Btw, I just played a bit with macros and defined a small bunch of
> LaTex-producing macros. I'll post that.
>
> It doesn't help that DMD inserts a HTML comment at the beginning:
>
> <!-- Generated by Ddoc from filename.d -->
>
> HTML hardwired into the final result, whatever the doc says :(

Yah, I also played with producing LaTeX and hit the same problem. Had to 
sed away the first line. Walter, could you please fix that - thanks.

Philippe, please share with me as soon as you have anything significant 
done in terms of LaTeX production so we don't overlap work.


Thanks,

Andrei
January 06, 2013
Re: dlangspec.pdf?
On 1/5/2013 2:50 PM, Philippe Sigaud wrote:
> I must be tired, because the only .ddoc file I find is std.ddoc. No .d article
> on templates, etc: only the .html files.

https://github.com/D-Programming-Language/d-programming-language.org
January 06, 2013
Re: dlangspec.pdf?
On 1/5/2013 3:44 PM, Andrei Alexandrescu wrote:
> On 1/5/13 4:38 PM, Philippe Sigaud wrote:
>> Btw, I just played a bit with macros and defined a small bunch of
>> LaTex-producing macros. I'll post that.
>>
>> It doesn't help that DMD inserts a HTML comment at the beginning:
>>
>> <!-- Generated by Ddoc from filename.d -->
>>
>> HTML hardwired into the final result, whatever the doc says :(
>
> Yah, I also played with producing LaTeX and hit the same problem. Had to sed
> away the first line. Walter, could you please fix that - thanks.

C:>grep DDOC_COMMENT *.c
doc.c:DDOC_COMMENT   = <!-- $0 -->\n\
doc.c:    buf.printf("$(DDOC_COMMENT Generated by Ddoc from %s)\n", 
srcfile->toChars());

I.e. override the DDOC_COMMENT macro.
January 06, 2013
Re: dlangspec.pdf?
On 1/5/13 5:17 PM, Walter Bright wrote:
> On 1/5/2013 1:32 PM, Philippe Sigaud wrote:
>> What should it be? Some module to define text transformations?
>> std.regex does
>> this quite well.
>
>
> A text macro system is not std.regex at all. What std.textmacro should
> be is a range that takes a text input stream, an associative array of
> NAME=VALUE pairs, and it outputs a text range with the macros having
> been expanded.

Example: http://www.stringtemplate.org/

Andrei
January 06, 2013
Re: dlangspec.pdf?
On 1/5/2013 7:15 PM, Andrei Alexandrescu wrote:
> On 1/5/13 5:17 PM, Walter Bright wrote:
>> On 1/5/2013 1:32 PM, Philippe Sigaud wrote:
>>> What should it be? Some module to define text transformations?
>>> std.regex does
>>> this quite well.
>>
>>
>> A text macro system is not std.regex at all. What std.textmacro should
>> be is a range that takes a text input stream, an associative array of
>> NAME=VALUE pairs, and it outputs a text range with the macros having
>> been expanded.
>
> Example: http://www.stringtemplate.org/

I like the range method better.
January 06, 2013
Re: dlangspec.pdf?
On Sun, Jan 6, 2013 at 1:40 AM, Walter Bright <newshound2@digitalmars.com>wrote:

> On 1/5/2013 2:50 PM, Philippe Sigaud wrote:
>
>> I must be tired, because the only .ddoc file I find is std.ddoc. No .d
>> article
>> on templates, etc: only the .html files.
>>
>
> https://github.com/D-**Programming-Language/d-**programming-language.org<https://github.com/D-Programming-Language/d-programming-language.org>
>

Oh, .dd files! I did not search for those, I didn't even know they existed.

Thanks, now I can look how you did some linking and layout.
January 06, 2013
Re: dlangspec.pdf?
> Philippe, please share with me as soon as you have anything significant
> done in terms of LaTeX production so we don't overlap work.
>
>
Nothing significant yet, that's my first dib into macro.
I use these, but have a problem for code highlighting: DMD inserts macros
to colour the code, these don't play well with my usual solutions (package
pygmentize or package listings). The same for \verbatim{} instruction.
Here, I just used a simple \texttt{} instruction, but in this case curly
braces are lost :(


B=\textbf{$0}
I=\textit{$0}
U=\underline{$0}
P= $0
DL=\begin{description}
$0
\end{description}
DT=\item[$0]
DD=$0
TABLE=\begin{tabular}[2]{l|l}
$0
\end{tabular}
TR=$0 \\
TH=$0 &
TD=$0
OL=\begin{enumerate}
$0
\end{enumerate}
UL=\begin{itemize}
$0
\end{itemize}
LI=\item $0
BIG=\large{$0}
SMALL=\small{$0}
BR=\newline
LINK=\url{$0}
LINK2=\href{$1}{$+}
RED={\color{red}$0}
BLUE={\color{blue}$0}
GREEN={\color{green}$0}
YELLOW={\color{yellow}$0}
BLACK={\color{black}$0}
WHITE={\color{white}$0}
D_CODE=\texttt{$0}
DDOC_PSYMBOL = $(U $0)
DDOC_ANCHOR = \label{$1}
DDOC_DECL  = $(DT $0)
XREF = $(REF std_$1.html#$2, $(D std.$1.$2))
CXREF = $(REF core_$1.html#$2, $(D core.$1.$2))
LREF = \hyperref[$1]{$1}
DDOC=\documentclass[11pt]{article}
\usepackage{color}

\usepackage{hyperref}
\begin{document}
\title{$(TITLE)}
\date{}
\maketitle

$(BODY)
\end{document}
January 06, 2013
Re: dlangspec.pdf?
On Sun, Jan 06, 2013 at 10:44:27AM +0100, Philippe Sigaud wrote:
> > Philippe, please share with me as soon as you have anything significant
> > done in terms of LaTeX production so we don't overlap work.
> >
> >
> Nothing significant yet, that's my first dib into macro.
> I use these, but have a problem for code highlighting: DMD inserts macros
> to colour the code, these don't play well with my usual solutions (package
> pygmentize or package listings). The same for \verbatim{} instruction.
> Here, I just used a simple \texttt{} instruction, but in this case curly
> braces are lost :(

LaTeX has its own syntactic conventions. Curly braces must be escaped
with backslash, and certain operators (^ in particular, which also
affects ^^) will cause syntax errors, because they are metacharacters
with a different meaning. All of them need to be properly escaped.

You may be able to use \begin{verbatim} and \end{verbatim} (which
doesn't suffer from the trailing brace problem) but you can't use it for
inline spans of text.

Unless, of course, you drop into low-level TeX hacking to redefine
metacharacters so that characters used in D code never collide with
them. (It's possible, but not recommended because nobody will be able to
read the code and understand what it does! Plus, you'll have to restore
LaTeX's original definitions every time you end a block of code so that
LaTeX macros will still work -- otherwise you'll get very colorful
malfunctions.)


T

-- 
Talk is cheap. Whining is actually free. -- Lars Wirzenius
January 06, 2013
Re: dlangspec.pdf?
On Sun, Jan 6, 2013 at 4:19 PM, H. S. Teoh <hsteoh@quickfur.ath.cx> wrote:

> On Sun, Jan 06, 2013 at 10:44:27AM +0100, Philippe Sigaud wrote:
> > > Philippe, please share with me as soon as you have anything significant
> > > done in terms of LaTeX production so we don't overlap work.
> > >
> > >
> > Nothing significant yet, that's my first dib into macro.
> > I use these, but have a problem for code highlighting: DMD inserts macros
> > to colour the code, these don't play well with my usual solutions
> (package
> > pygmentize or package listings). The same for \verbatim{} instruction.
> > Here, I just used a simple \texttt{} instruction, but in this case curly
> > braces are lost :(
>
> LaTeX has its own syntactic conventions. Curly braces must be escaped
> with backslash, and certain operators (^ in particular, which also
> affects ^^) will cause syntax errors, because they are metacharacters
> with a different meaning. All of them need to be properly escaped.
>

Exactly.


>
> You may be able to use \begin{verbatim} and \end{verbatim} (which
> doesn't suffer from the trailing brace problem) but you can't use it for
> inline spans of text.
>

Damn right.

I'll try with the listings package, but I don't have much hope to achieve
what I want.
January 07, 2013
Re: dlangspec.pdf?
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.
1 2 3 4 5 6 7 8
Top | Discussion index | About this forum | D home