update attr syntax in docs

pull/105/head
Matthew Butterick 9 years ago
parent e37f6ae535
commit da2d9fd40d

@ -133,7 +133,7 @@ Here are a few examples of correct Pollen-mode commands:
#lang pollen
◊variable-name
◊tag{Text inside the tag.}
◊tag['attr: "value"]{Text inside the tag}
◊tag[#:attr "value"]{Text inside the tag}
◊get-customer-id["Brennan Huff"]
◊tag{His ID is ◊get-customer-id["Brennan Huff"].}
}
@ -144,7 +144,7 @@ And some incorrect examples:
#lang pollen
◊tag {Text inside the tag.} ; space between first and second parts
◊tag[Text inside the tag] ; text argument needs to be within braces
◊tag{Text inside the tag}['attr: "value"] ; wrong order
◊tag{Text inside the tag}[#:attr "value"] ; wrong order
}
The next section describes each of these parts in detail.
@ -524,9 +524,9 @@ To make a meta, you create a tag with the special @code{define-meta} name. Then
#lang pollen
◊define-meta[dog]{Roxy} ; Pollen-mode syntax
◊some-tag['key: "value"]{Normal tag}
◊some-tag[#:key "value"]{Normal tag}
◊(define-meta cat "Chopper") ; equivalent Racket-mode syntax
◊some-tag['key: "value"]{Another normal tag}
◊some-tag[#:key "value"]{Another normal tag}
}
When you run a source file with metas in it, two things happen. First, the metas are removed from the output:
@ -553,9 +553,9 @@ Still, you can override this too:
#lang pollen
◊define-meta[dog]{Roxy}
◊some-tag['key: "value"]{Normal tag}
◊some-tag[#:key "value"]{Normal tag}
◊(define-meta cat "Chopper")
◊some-tag['key: "value"]{Another normal tag}
◊some-tag[#:key "value"]{Another normal tag}
◊(define-meta here-path "tesseract")
}

@ -44,7 +44,7 @@ A tag with attributes and content:
◊div['((attr1 "val1")(attr2 "val2"))]{My nice div.}
A tag with attributes and content (alternate syntax):
◊div['attr1: "val1" 'attr2: "val2"]{My nice div.}
◊div[#:attr1 "val1" #:attr2 "val2"]{My nice div.}
}
Let's also recall that these commands can be written in Racket mode equivalently:
@ -188,7 +188,7 @@ Detecting attributes in an argument list can be tricky because a) the tag may or
(define-values (attributes elements) (split-attributes parts))
`(extra ,attributes (big ,@"@"elements)))
I want to attend ◊em['key: "value"]{RacketCon}.}]
I want to attend ◊em[#:key "value"]{RacketCon}.}]
This will move the @racket[elements] inside the @racket[big] tag, and attach the @racket[attributes] to the @racket[extra] tag:

@ -71,5 +71,5 @@ Helper function for custom tag functions. Take a rest argument that possibly inc
(values attrs elements))
(tag "Hello world")
(tag '((key "value")) "Hello world")
(tag 'key: "value" "Hello world")
(tag #:key "value" "Hello world")
]

@ -76,7 +76,7 @@ Because @link["https://highlightjs.org/"]{Highlight.js} is browser-based, it doe
@codeblock{
#lang pollen/markup
◊pre{◊code['class: "python"]{
◊pre{◊code[#:class "python"]{
for x in range(3):
print x
}}}}

Loading…
Cancel
Save