The ugly truth about ddoc

tcak via Digitalmars-d digitalmars-d at puremagic.com
Sun Jan 18 19:19:57 PST 2015


On Monday, 19 January 2015 at 02:18:32 UTC, Andrei Alexandrescu 
wrote:
> TL;DR: I've uploaded new menu colors at http://erdani.com/d/, 
> this time aiming for a more martian red ethos. Please let me 
> know.
>
> ==================
>
> So I was looking at the css today (original at 
> http://paste.ofcode.org/fHGT24YASrWu3rnMYLdm4C taken from the 
> zip at 
> http://cssmenumaker.com/menu/modern-jquery-accordion-menu) and 
> it was quite unwieldy to experiment with. For example, the same 
> color appears hardcoded in a number of places; whenever 
> changing one I'd need to change all, or miss some important 
> instances (as it happened with my first experiment).
>
> I'm sure experts must have tools for allowing things like 
> variables and macros for css creation. Indeed there are a 
> number of CSS editors that features things like variables, 
> substitutions, and code generations, but most come at a cost 
> and require quite some involvement.
>
> So I slapped something much simpler together using... ddoc.
>
> 1. I aded this at the top of the original file:
>
> Ddoc
>
> and then this at the bottom:
>
> Macros:
>
> DDOC=$(BODY)
> DDOC_COMMENT=/*$0*/
> ESCAPES=/</</ />/>/ /&/&/
>
> then saved the file as cssmenu.css.dd. Now I suddenly had a 
> file compilable with ddoc, which produced itself (sans the 
> heading and the macros). Here's the cmdline:
>
> dmd -c -o- -Dfweb/css/cssmenu.css css/cssmenu.css.dd
>
> It's a bit of a bummer that I need to define three unintuitive 
> macros to get idempotent generation, but I guess that's that. 
> We should document that somewhere.
>
> 2. Now the fun begins. Now with macros I could define things 
> like variables and even functions, and change all by changing 
> one. Cool! So I started looking for all colors in the document 
> and converted them to macros.
>
> After a short time I had 
> http://paste.ofcode.org/3agBQ3t6C3UJsqMfRe4GeQL working. With 
> that in hand, it was trivially easy to test different colors 
> and see how they impact the look.
>
> The result is as I mentioned at http://erdani.com/d. I trust 
> you'll hate the colors but maybe not the hack.
>
> So, may I add a pull request of this without anyone having an 
> apoplexy attack? When we pass the site for styling we can pass 
> the generated css.
>
>
> Andrei


Red colour is hard to work with generally. It takes too much 
attention. It goes well with white and grey colours. Though, here 
is some colours for you to try:

https://color.adobe.com/create/color-wheel/?base=2&rule=Custom&selected=4&name=My%20Color%20Theme&mode=rgb&rgbvalues=0.7,0.22200669464295397,0.1097099201844362,0.6268360119554587,1,0.5314703422197685,0.125290070947203,1,0.4581047763190884,0.13626074345941347,0.4015373174033305,0.8,0.3049403467128378,0.4400712229615978,0.7&swatchOrder=0,1,2,3,4


I know it is hard to accept change though, for more professional 
look, many changes would require on the site.

This is an example for Phobos documentation:
http://php.net/manual/en/function.shm-attach.php


We could use Open Sans font as well maybe from Google Fonts.


I mostly write CSS, JS, HTML by hand instead of using frameworks. 
So, I am sorry if the tools in the hand are not giving enough 
flexibility.


More information about the Digitalmars-d mailing list