New look & feel for std.algorithm

Robert Jacques sandford at jhu.edu
Mon Apr 4 21:29:47 PDT 2011


On Mon, 04 Apr 2011 16:42:38 -0400, Andrei Alexandrescu  
<SeeWebsiteForEmail at erdani.org> wrote:

> On 4/4/11 12:58 AM, Andrei Alexandrescu wrote:
>> There were also a number of bugs on www.d-programming-language.org,
>> which David Gileadi kindly took care of. Please take a look at
>> www.digitalmars.com and let me know if you find any issues. In
>> particular, we've discussed a while ago the new look and feel of
>> std.algorithm, which will serve as an example for later modules. This is
>> the current form:
>> http://d-programming-language.org/phobos-prerelease/std_algorithm.html
>>
>>
>> Thanks,
>>
>> Andrei
>
> Made one more pass, acted on various comments.
>
> http://d-programming-language.org/phobos/std_algorithm.html
>
>
> Andrei

Hi Andrei,
I've traced down the rendering "bug" in Opera. DDoc is generating invalid  
html (no surprise given that validator.w3.org shows, 200 Errors and 10  
warnings). The problem error comes from <p></p> being added after the  
</tr>. For example:

<table>
   <tr>
     <th>Month</th>
     <th>Savings</th>
   </tr><p></p>
   <tr>
     <td>January</td>
     <td>$100</td>
   </tr><p></p>
</table>

Which isn't valid html and is generating ~62 of those 200 errors. How  
Opera renders this is by moving the <p></p> pairs out and above the  
<table></table>, which causes a bunch of blank lines to occur between the  
caption and the table.

How to fix it:
So what's happening is that DDoc is generating a <p></p> for every blank  
line in the source doc section, so a quick solution which works is to  
remove the extra line breaks from the source file. i.e.

Replace this:

$(BOOKTABLE $(TEXTWITHCOMMAS Container primitives. Below, $(D C) means
a _container type, $(D c) is a value of _container type, $(D n$(SUB
x)) represents the effective length of value $(D x), which could be a
single element (in which case $(D n$(SUB x)) is $(D 1)), a _container,
or a range.),

$(TR $(TH Syntax) $(TH $(BIGOH ·)) $(TH Description))

$(TR $(TDNW $(D C(x))) $(TDNW $(D n$(SUB x))) $(TD Creates a
_container of type $(D C) from either another _container or a range.))

$(TR $(TDNW $(D c.dup)) $(TDNW $(D n$(SUB c))) $(TD Returns a
duplicate of the _container.))

$(TR $(TDNW $(D c ~ x)) $(TDNW $(D n$(SUB c) + n$(SUB x))) $(TD
Returns the concatenation of $(D c) and $(D r). $(D x) may be a single
element or an input range.))

with this:

$(BOOKTABLE $(TEXTWITHCOMMAS Container primitives. Below, $(D C) means
a _container type, $(D c) is a value of _container type, $(D n$(SUB
x)) represents the effective length of value $(D x), which could be a
single element (in which case $(D n$(SUB x)) is $(D 1)), a _container,
or a range.),
$(TR $(TH Syntax) $(TH $(BIGOH ·)) $(TH Description))
$(TR $(TDNW $(D C(x))) $(TDNW $(D n$(SUB x))) $(TD Creates a
_container of type $(D C) from either another _container or a range.))
$(TR $(TDNW $(D c.dup)) $(TDNW $(D n$(SUB c))) $(TD Returns a
duplicate of the _container.))
$(TR $(TDNW $(D c ~ x)) $(TDNW $(D n$(SUB c) + n$(SUB x))) $(TD
Returns the concatenation of $(D c) and $(D r). $(D x) may be a single
element or an input range.))

Long term, we should probably fix the ddoc file to handle this properly,  
but to do this we'd need to be able to redefine the P ddoc tag inside the  
TABLE tag and then reset it afterwards, and I don't if/how that can be  
done in ddoc.

P.S. The ability to view the source of a web page, edit it, preview/save  
the result and run your modification through a validator in Opera is just  
awesome.


More information about the Digitalmars-d mailing list