Skip to content

Commit

Permalink
Merge pull request #776 from andralex/better-macros
Browse files Browse the repository at this point in the history
Better macros, more styles
  • Loading branch information
WalterBright committed Jan 17, 2015
2 parents 48283d7 + f409939 commit 4cc0dac
Show file tree
Hide file tree
Showing 29 changed files with 409 additions and 399 deletions.
14 changes: 7 additions & 7 deletions attribute.dd
Expand Up @@ -129,7 +129,7 @@ extern (Windows):
$(LINK2 http://en.wikipedia.org/wiki/X86_calling_conventions, stdcall) convention.)

$(P Note that a lone $(D extern) declaration is used as a
$(XLINK2 declaration.html#extern, storage class).)
$(LINK2 declaration.html#extern, storage class).)

$(H4 C++ $(LNAME2 namespace, Namespaces))

Expand Down Expand Up @@ -504,11 +504,11 @@ $(H3 $(LNAME2 disable, $(D @disable) Attribute))
}
---

$(P $(XLINK2 struct.html#Struct-Constructor, Disabling struct no-arg constructor)
$(P $(LINK2 struct.html#Struct-Constructor, Disabling struct no-arg constructor)
disallows default construction of the struct.
)

$(P $(XLINK2 struct.html#StructPostblit, Disabling struct postblit)
$(P $(LINK2 struct.html#StructPostblit, Disabling struct postblit)
makes the struct not copyable.
)

Expand Down Expand Up @@ -554,19 +554,19 @@ $(H3 $(LNAME2 nogc, $(D @nogc) Attribute))

$(H3 $(LNAME2 property, $(D @property) Attribute))

$(P See $(XLINK2 function.html#property-functions, Property Functions).)
$(P See $(LINK2 function.html#property-functions, Property Functions).)

$(H3 $(LNAME2 nothrow, $(D nothrow) Attribute))

$(P See $(XLINK2 function.html#nothrow-functions, Nothrow Functions).)
$(P See $(LINK2 function.html#nothrow-functions, Nothrow Functions).)

$(H3 $(LNAME2 pure, $(D pure) Attribute))

$(P See $(XLINK2 function.html#pure-functions, Pure Functions).)
$(P See $(LINK2 function.html#pure-functions, Pure Functions).)

$(H3 $(LNAME2 ref, $(D ref) Attribute))

$(P See $(XLINK2 function.html#ref-functions, Ref Functions).)
$(P See $(LINK2 function.html#ref-functions, Ref Functions).)

$(H3 $(LNAME2 override, $(D override) Attribute))

Expand Down
2 changes: 1 addition & 1 deletion changelog.dd
Expand Up @@ -4770,7 +4770,7 @@ struct S
)
$(LI $(LNAME2 isnestedtrait, Added the $(B isNested) trait for discovery of aggregates and functions with context pointers:)

$(P The new $(XLINK2 traits.html#isNested, isNested) trait allows you to discover whether an aggregate or function
$(P The new $(LINK2 traits.html#isNested, isNested) trait allows you to discover whether an aggregate or function
contains a context pointer:)

---------
Expand Down
2 changes: 1 addition & 1 deletion comparison.dd
Expand Up @@ -2,7 +2,7 @@ Ddoc

$(COMMUNITY $(B D) vs Other Languages,

$(BLOCKQUOTE William Nerdspeare,
$(BLOCKQUOTE_BY William Nerdspeare,
To D, or not to D.
)

Expand Down
4 changes: 2 additions & 2 deletions contracts.dd
Expand Up @@ -252,8 +252,8 @@ assert(&s); // check that struct S invariant holds
$(H2 References)

$(LIST
$(XLINK2 http://people.cs.uchicago.edu/~robby/contract-reading-list/, Contracts Reading List),
$(XLINK2 http://jan.newmarch.name/java/contracts/paper-long.html, Adding Contracts to Java)
$(LINK2 http://people.cs.uchicago.edu/~robby/contract-reading-list/, Contracts Reading List),
$(LINK2 http://jan.newmarch.name/java/contracts/paper-long.html, Adding Contracts to Java)
)

)
Expand Down
4 changes: 2 additions & 2 deletions cpp_interface.dd
Expand Up @@ -132,9 +132,9 @@ k = 3
$(H3 C++ Namespaces)

$(P C++ functions that reside in namespaces can be
directly called from D. A $(XLINK2 attribute.html#namespace, namespace)
directly called from D. A $(LINK2 attribute.html#namespace, namespace)
can be added to the `extern (C++)`
$(XLINK2 attribute.html#linkage, LinkageAttribute):
$(LINK2 attribute.html#linkage, LinkageAttribute):
)
------
extern (C++, N) int foo(int i, int j, int k);
Expand Down
2 changes: 1 addition & 1 deletion ctod.dd
Expand Up @@ -2,7 +2,7 @@ Ddoc

$(COMMUNITY Programming in D for C Programmers,

$(COMMENT $(BLOCKQUOTE William Nerdspeare,
$(COMMENT $(BLOCKQUOTE_BY William Nerdspeare,
Et tu, D? Then fall, C!
))

Expand Down
4 changes: 2 additions & 2 deletions declaration.dd
Expand Up @@ -472,7 +472,7 @@ $(H3 $(LNAME2 extern, Extern Declarations))
variable declarations in C files.

$(P An $(D extern) declaration can optionally be followed by an
$(D extern) $(XLINK2 attribute.html#linkage, linkage attribute).
$(D extern) $(LINK2 attribute.html#linkage, linkage attribute).
If there is no linkage attribute it defaults to $(D extern(D)):)

---------------
Expand Down Expand Up @@ -555,7 +555,7 @@ $(GNAME Typeof):
typeof(this) r; // error, no enclosing struct or class
--------------------

$(P If the expression is a $(XLINK2 function.html#property-functions,
$(P If the expression is a $(LINK2 function.html#property-functions,
Property Function), $(D typeof) gives its return type.
)

Expand Down
87 changes: 49 additions & 38 deletions dlang.org.ddoc
@@ -1,19 +1,19 @@
_=Macros for the dlang.org site look and feel. Please keep sorted by name. Multiline macros should keep one _= line before and after for clarity. Also, one _= line should be present when the first letter changes. (The "_="" is needed so there's no extra newline after the last macro defined in a group.)

ACRONYM=<acronym title="$+">$1</acronym> ($+)
ASSIGNEXPRESSION=$(GLINK2 expression, AssignExpression)
ACRONYM = <acronym title="$+">$1</acronym> ($+)
ASSIGNEXPRESSION = $(GLINK2 expression, AssignExpression)
_=

BIGOH = $(SPANC bigoh, &Omicron;($(D $0)))
BLOCKQUOTE = <blockquote>$(P $+)<cite>$1</cite></blockquote>
BLOCKQUOTE_PLAIN = <blockquote>$(P $0)</blockquote>
BLOCKQUOTE = $(T blockquote, $(P $0))
BLOCKQUOTE_BY = $(BLOCKQUOTE $(P $+)$(T cite, $1))
BLACK=$(SPANC black, $0)
BLUE=$(SPANC blue, $0)
BOOKTABLE = <table class=book><caption>$1</caption>$2</table>
BUGZILLA = $(LINK2 https://issues.dlang.org/show_bug.cgi?id=$0, Bugzilla $0)
BOOKTABLE = $(TC table, book, $(T caption, $1)$+)
BUGZILLA = $(SPANC bugzilla, $(AHTTPS issues.dlang.org/show_bug.cgi?id=$0, Bugzilla $0))
_=

CCODE=<pre class="ccode notranslate">$0</pre>
CCODE=$(TC pre, ccode notranslate, $0)
CODE=$(D $0)
CODE_AMP=$(D &amp;)
CODE_DOLLAR=$(D $)
Expand All @@ -22,25 +22,34 @@ CODE_LCURL=$(D {)
CODE_PERCENT=$(D %)
CODE_PIPE=$(D |)
CODE_RCURL=$(D })
CONSOLE=<pre class="console notranslate">$0</pre>
CONSOLE=$(TC pre, console notranslate, $0)
COPYRIGHT=Copyright &copy; 1999-$(YEAR) by Digital Mars $(REG), All Rights Reserved
CPPCODE=<pre class="cppcode notranslate">$0</pre>
CPPCODE=$(TC pre, cppcode notranslate, $0)
CPPLISTING=$(CPPCODE $0)
CROSS=&#x2718;
_=

D=$(SPANC d_inlinecode donthyphenate notranslate, $0)
D_CODE=<pre class="d_code notranslate">$0</pre>
D_CODE=$(TC pre, d_code notranslate, $0)
_=

D_RUN_CODE =
$(DIV ,
$(DIVC d_code, $1)
$(DIVC d_run_code,
<textarea class="d_code">$4</textarea>
$(DIVC d_code_stdin">$(SPANC d_code_title, Standard input)<br /><textarea class="d_code_stdin">$2</textarea>)
$(DIVC d_code_args, $(SPANC d_code_title, Command line arguments)<br /><textarea class="d_code_args">$3</textarea>)
$(DIVC d_code_output, $(SPANC d_code_title, Application output)<br /><textarea class="d_code_output" readonly>Running...</textarea>)
$(TC textarea, d_code, $4)
$(DIVC d_code_stdin,
$(SPANC d_code_title, Standard input)$(BR)
$(TC textarea, d_code_stdin, $2)
)
$(DIVC d_code_args,
$(SPANC d_code_title, Command line arguments)$(BR)
$(TC textarea, d_code_args, $3)
)
$(DIVC d_code_output,
$(SPANC d_code_title, Application output)$(BR)
<textarea class="d_code_output" readonly>Running...</textarea>
)
<input type="button" class="editButton" value="Edit">
<input type="button" class="argsButton" value="Args">
<input type="button" class="inputButton" value="Input">
Expand Down Expand Up @@ -74,18 +83,19 @@ DDOC_PARAM_ID = <td class="param_id">$0</td>
DDOC_PARAM_DESC = <td class="param_desc">$0</td>
DDOC_PARAMS = $(DDOCKEYVAL Parameters, <table class=params>$0</table>)
DDOC_BLANKLINE = $(P)
DDOC_PSYMBOL = <a name="$0"></a>$(SPANC ddoc_psymbol, $0)
DDOC_PSYMBOL = $(ADEF $0)$(SPANC ddoc_psymbol, $0)
DDOC_ANCHOR = $(ADEF .$1)$(DIVCID quickindex, quickindex.$1, )
DDOC_DECL = <dt class="d_decl">$0</dt>
DDOC_DECL = $(TC dt, d_decl, $0)
DDOC_UNDEFINED_MACRO = $(DDOC_COMMENT UNDEFINED MACRO: "$1")
DDOCCODE=<pre class="ddoccode notranslate">$0</pre>
DDOCCODE=$(TC pre, ddoccode notranslate, $0)
DDOCKEYVAL=$(PC keyval $1, $(SPANC key key$1, $1:) $(DIVC val val$1, $+))
DDSUBLINK=$(XLINK2 $1.html#$2, $3)
DDSUBLINK=$(LINK2 $1.html#$2, $3)
DRUNTIMESRC=$(HTTPS github.com/D-Programming-Language/druntime/blob/master/src/$0, $0)
DPLLINK=$(LINK2 $1,$+)
_=

ELABORATE_HEADER=$(TR <th rowspan=2>D</th><th colspan=2>C</th></tr><tr><th scope="col">32 bit</th><th scope="col">64 bit</th>)
ELABORATE_HEADER=$(TR <th rowspan=2>D</th><th colspan=2>C</th>)
$(TR <th scope="col">32 bit</th><th scope="col">64 bit</th>)
_=

FOOTER = $(DIV id="copyright", $(COPYRIGHT) | Page generated by $(WEB dlang.org/ddoc.html, Ddoc) on $(GEN_DATETIME))
Expand All @@ -98,7 +108,7 @@ GLINK=$(RELATIVE_LINK2 $0, $(I $0))
GLINK2=$(DDSUBLINK $1,$2,$(I $2))
GLOSSARY = $(WEB dlang.org/glossary.html#$0, $0)
GNAME=<a id="$0">$(SPANC gname, $0)</a>
GRAMMAR=<pre class="bnf notranslate">$0</pre>
GRAMMAR=$(TC pre, bnf notranslate, $0)
GREEN=$(SPANC green, $0)
GT=&gt;
_=
Expand All @@ -122,11 +132,11 @@ LUCKY = $(HTTP google.com/search?btnI=I%27m+Feeling+Lucky&amp;ie=UTF-8&amp;oe=UT
LUCKY2 = $(HTTP google.com/search?btnI=I%27m+Feeling+Lucky&q=$+,$1)
_=

MDASH=<nobr>&#x200A;&mdash;&#x200A;</nobr>
MDASH=$(T nobr, &#x200A;&mdash;&#x200A;)
METACODE=$(SPANC metacode, $0)
META_KEYWORDS=D programming language
META_DESCRIPTION=D Programming Language
MODDEFFILE=<pre class="moddeffile notranslate">$0</pre>
MODDEFFILE=$(TC pre, moddeffile notranslate, $0)
MULTICOL_CELL=<td colspan=$1>$+</td>
MULTICOL_HEADER=<th colspan=$1>$+</th>
MULTICOLS=$+
Expand Down Expand Up @@ -164,20 +174,21 @@ $(DIVID tools,
)
_=

PC=<p class="$1">$+</p>
PC=$(TC p, $1, $+)
_=

PHOBOS=<a href="http://dlang.org/phobos/std_$1.html#$2">$3</a>
PHOBOSSRC=$(LINK2 https://github.com/D-Programming-Language/phobos/blob/master/$0, $0)
PHOBOS=$(SPANC phobos, $(AHTTP dlang.org/phobos/std_$1.html#$2, $(TAIL $3)))
PHOBOSSRC=$(SPANC phobos_src, $(AHTTPS github.com/D-Programming-Language/phobos/blob/master/$0, $0))
_=

RAW_DOLLAR=$
RED=$(SPANC red, $0)
RELATIVE_LINK2=$(ALOCAL $1, $+)
_=

SAMPLESRC=$(LINK2 https://github.com/D-Programming-Language/dmd/blob/master/samples/$0, /dmd/samples/d/$0)
SCINI=<pre class="scini notranslate">$0</pre>
SAMPLESRC=$(SPANC sample_src, $(AHTTPS github.com/D-Programming-Language/dmd/blob/master/samples/$0, /dmd/samples/d/$0))
SCINI=$(TC pre, scini notranslate, $0)
SCRIPTLOAD=<script type="text/javascript" src="%0"></script>
SECTION1=$(H1 $1)$+
SECTION2=$(H2 $1)$+
SECTION3=$(H3 $1)$+
Expand All @@ -189,18 +200,19 @@ TABLE_10=$(TABLE2 $1,$+)
TABLE_2COLS=$(TABLE2 $1, $+)
TABLE_3COLS=$(TABLE2 $1, $+)
TABLE_SPECIAL=$(TABLE2 $1,$+)
TABLE2=<center><table><caption>$1</caption>$+</table></center>
TAIL=$+
TDX=<td>$1</td>$(TDX $+)
TABLE2=$(T center, $(T table, $(T caption, $1)$+))
TDX=$(TD $1)$(TDX $+)
TH=<th scope="col">$0</th>
THEAD=$(TR $(THX $1, $+))
THX=<th class="donthyphenate">$(B $1)</th>$(THX $+)
THX=$(TC th, donthyphenate, $(B $1))$(THX $+)
TOC=$(SPEC_S $1,$+)
TOCENTRY = $(LI $(LINK2 $1, $2))
TOCENTRYH = $(LI $(LINK2 $1, $2)$3)
TOCENTRYT = $(LI <a href="$1" title="$2">$3</a>)
TOCENTRYTH = $(LI <a href="$1" title="$2">$3</a>$4)
TOCHEADER = <h2 class="tocheader">$0</h2>
TOCENTRIES=$(TOCENTRY $1, $2) $(TOCENTRIES_REC $+)
TOCENTRIES_REC=$(TOCENTRIES $+)
TOCENTRY = $(LI $(SPANC tocentry, $(LINK2 $1.html, $+)))
TOCENTRYH = $(LI $(SPANC tocentryh, $(LINK2 $1, $2)$3))
TOCENTRYT = $(LI $(SPANC tocentryt, <a href="$1" title="$2">$3</a>))
TOCENTRYTH = $(LI $(SPANC tocentryth, <a href="$1" title="$2">$3</a>$4))
TOCHEADER = $(TC h2, tocheader, $0)
TOCHEADERL = $(TOCHEADER <a href="$1" title="$2">$3</a>)
TR2=$(TR $1 $2)
TR3=$(TR $1 $2 $3)
Expand All @@ -217,9 +229,8 @@ _=
WHITE=$(SPANC white, $0)
_=

XLINK2=$(LINK2 $1,$+)
XREF=$(XREF2 $1, $2, $(D std.$1.$2))
XREF2=<a href="http://dlang.org/phobos/std_$1.html#$2">$3</a>
XREF2=$(SPANC libref, $(AHTTP dlang.org/phobos/std_$1.html#$2, $(TAIL $+)))
_=

YELLOW=$(SPANC yellow, $0)
Expand Down

0 comments on commit 4cc0dac

Please sign in to comment.