mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-06-12 06:41:13 +02:00
Make `@' visible in the sxml-match documentation.
* doc/ref/sxml-match.texi (sxml-match): Quote `@' in the examples.
This commit is contained in:
parent
98f1f9a51a
commit
bdfcabfee7
1 changed files with 10 additions and 10 deletions
|
@ -30,7 +30,7 @@ illustration, transforming a music album catalog language into HTML.
|
||||||
@lisp
|
@lisp
|
||||||
(define (album->html x)
|
(define (album->html x)
|
||||||
(sxml-match x
|
(sxml-match x
|
||||||
[(album (@ (title ,t)) (catalog (num ,n) (fmt ,f)) ...)
|
[(album (@@ (title ,t)) (catalog (num ,n) (fmt ,f)) ...)
|
||||||
`(ul (li ,t)
|
`(ul (li ,t)
|
||||||
(li (b ,n) (i ,f)) ...)]))
|
(li (b ,n) (i ,f)) ...)]))
|
||||||
@end lisp
|
@end lisp
|
||||||
|
@ -137,8 +137,8 @@ matcher.
|
||||||
The example below illustrates the pattern matching of an XML element:
|
The example below illustrates the pattern matching of an XML element:
|
||||||
|
|
||||||
@lisp
|
@lisp
|
||||||
(sxml-match '(e (@ (i 1)) 3 4 5)
|
(sxml-match '(e (@@ (i 1)) 3 4 5)
|
||||||
[(e (@ (i ,d)) ,a ,b ,c) (list d a b c)]
|
[(e (@@ (i ,d)) ,a ,b ,c) (list d a b c)]
|
||||||
[,otherwise #f])
|
[,otherwise #f])
|
||||||
@end lisp
|
@end lisp
|
||||||
|
|
||||||
|
@ -232,8 +232,8 @@ matched, but which do not appear in the pattern. This is achieved by using a
|
||||||
illustrated in the example below:
|
illustrated in the example below:
|
||||||
|
|
||||||
@lisp
|
@lisp
|
||||||
(sxml-match '(a (@ (z 1) (y 2) (x 3)) 4 5 6)
|
(sxml-match '(a (@@ (z 1) (y 2) (x 3)) 4 5 6)
|
||||||
[(a (@ (y ,www) . ,qqq) ,t ,u ,v)
|
[(a (@@ (y ,www) . ,qqq) ,t ,u ,v)
|
||||||
(list www qqq t u v)])
|
(list www qqq t u v)])
|
||||||
@end lisp
|
@end lisp
|
||||||
|
|
||||||
|
@ -244,8 +244,8 @@ expression is @code{(2 ((z 1) (x 3)) 4 5 6)}.
|
||||||
This type of pattern also allows the binding of all attributes:
|
This type of pattern also allows the binding of all attributes:
|
||||||
|
|
||||||
@lisp
|
@lisp
|
||||||
(sxml-match '(a (@ (z 1) (y 2) (x 3)))
|
(sxml-match '(a (@@ (z 1) (y 2) (x 3)))
|
||||||
[(a (@ . ,qqq))
|
[(a (@@ . ,qqq))
|
||||||
qqq])
|
qqq])
|
||||||
@end lisp
|
@end lisp
|
||||||
|
|
||||||
|
@ -257,7 +257,7 @@ the following example:
|
||||||
|
|
||||||
@lisp
|
@lisp
|
||||||
(sxml-match '(e 3 4 5)
|
(sxml-match '(e 3 4 5)
|
||||||
[(e (@ (z (,d 1))) ,a ,b ,c) (list d a b c)])
|
[(e (@@ (z (,d 1))) ,a ,b ,c) (list d a b c)])
|
||||||
@end lisp
|
@end lisp
|
||||||
|
|
||||||
The value @code{1} is used when the attribute @code{z} is absent from the
|
The value @code{1} is used when the attribute @code{z} is absent from the
|
||||||
|
@ -323,7 +323,7 @@ identifiers following @code{->}.
|
||||||
|
|
||||||
Named catamorphism patterns allow processing to be split into multiple, mutually
|
Named catamorphism patterns allow processing to be split into multiple, mutually
|
||||||
recursive procedures. This is illustrated in the example below: a
|
recursive procedures. This is illustrated in the example below: a
|
||||||
transformation that formats a "TV Guide" into HTML.
|
transformation that formats a ``TV Guide'' into HTML.
|
||||||
|
|
||||||
@lisp
|
@lisp
|
||||||
(define (tv-guide->html g)
|
(define (tv-guide->html g)
|
||||||
|
@ -346,7 +346,7 @@ transformation that formats a "TV Guide" into HTML.
|
||||||
(br) ,desc ...)
|
(br) ,desc ...)
|
||||||
,cl)]))
|
,cl)]))
|
||||||
(sxml-match g
|
(sxml-match g
|
||||||
[(TVGuide (@ (start ,start-date)
|
[(TVGuide (@@ (start ,start-date)
|
||||||
(end ,end-date))
|
(end ,end-date))
|
||||||
(Channel (Name ,nm) ,[prog -> p] ...) ...)
|
(Channel (Name ,nm) ,[prog -> p] ...) ...)
|
||||||
`(html (head (title "TV Guide"))
|
`(html (head (title "TV Guide"))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue