[racket] Expressing attrributes in scribble/html?

From: Eli Barzilay (eli at barzilay.org)
Date: Mon Nov 11 01:54:49 EST 2013

Three hours ago, Daniel Prager wrote:
> Thanks Greg and Sam
> 
>     #lang scribble/html
>     @a[href: "http://www.racket-lang.org"
>        title: "Racket the Ultimate"]{Racket}
> 
> After reading a comment in the source I tried @[:href
> "foo.html"]{bar} and even @[href "foo.html"]{bar} before turning to
> the list.

Any `foo:' in the code (for a `foo:' that is otherwise unbound) is
used as an attribute on applications of xml-generating constructs.  I
originally played with having the usual racket keywords, but
eventually decided that it's best to keep the two facilities separate,
in case there are some xml-like uses that require different
functionality than keywords -- like a particular order or duplicate
keywords.


> BTW: For others playing with this: "@mdash" -> "—" etc.

Yeah, some of the entities that seems to be popular are defined, but
not all of them.  You can see the definitions in "html.rkt" -- the
`define/provide-entities' expression.  Supporting all of them would be
problematic, since there are a *lot* of names there, including things
like `not', `and', `pi', and others.  You can also use things like
@entity{blah}, @entity['blah], or @entity[123].  But I think that it's
overall best to use the character in the code in most cases, unless
you need the entities for some reason (as in some weird xslt cases).

-- 
          ((lambda (x) (x x)) (lambda (x) (x x)))          Eli Barzilay:
                    http://barzilay.org/                   Maze is Life!


Posted on the users mailing list.