Version: 5.1.1.2
3 Textual Data
3.1 Text Representations
This module provides tools for manipulating and converting textual data.
3.1.1 Contracts and Predicates
This contract and predicate recognize text values: strings, byte strings,
symbols, and keywords, as well as syntax objects containing them.
These predicates recognize specific text types stored in syntax objects.
3.1.2 Text Conversions and Concatenation
These functions convert text values to specific types. They concatenate each
text argument, adding before and after to the front
and back of the result and between between each argument.
Examples: |
> (text->string #"concat" #'enate) | "concatenate" | > (text->bytes #:between "-" 'concat #'#:enate) | #"concat-enate" | > (text->symbol #:before "(" #:after ")" '#:concat #'"enate") | '|(concatenate)| | > (text->keyword #:before #'< #:between #'- #:after #'> "concat" #'#"enate") | '#:<concat-enate> |
|
These functions convert text values to specific syntax object types, deriving
syntax object properties from the stx argument. They concatenate each
text argument, adding before and after to the front
and back of the result and between between each argument.
Examples: |
> (text->string-literal #"concat" #'enate) | #<syntax "concatenate"> | > (text->bytes-literal #:between "-" 'concat #'#:enate) | #<syntax #"concat-enate"> | | #<syntax:4:0 |(concatenate)|> | | #<syntax:5:0 #:<concat-enate>> |
|
3.1.3 Text Comparisons
These predicates compare the character content of two text values. They are
equivalent to:
3.2 Regular Expressions
This module provides tools for building strings which can be compiled to regular
expressions. In particular, the constructors wrap their arguments in
appropriate delimeters to prevent misparsing after concatenation.
Produces a regular expression string that matches start, followed by
each re interleaved with between, followed by end.
Produces a regular expression string that matches any of the given res.
Produces a regular expression string that matches either the empty string, or
the concatenation of all the given res.
Produces a regular expression string that matches zero or more consecutive
occurrences of the concatenation of the given res.
Produces a regular expression string that matches one or more consecutive
occurrences of the concatenation of the given res.
Produces a regular expression string that matches the concatenation of the given
res and saves the result.
Produces a regular expression string that matches the concatenation of the given
res in multiple-line mode.
3.3 XML and CSS
This module provides tools for programmatic creation of static web pages. It is
based on the XML collection; see documentation for xexpr?.
This contract and predicate pair recognizes CSS-expressions, which are
described by the following grammar:
css | | = | | (list style ...) |
| | | | |
style-def | | = | | (cons selector (list property ...)) |
| | | | |
property | | = | | (list name value) |
| | | | |
selector | | = | | text |
| | | | |
name | | = | | text |
| | | | |
value | | = | | text |
Here, text is any of the Text Representations described above.
This flat contract corresponds to
xexpr?. It is reprovided from
xml. In versions of PLT Scheme before the implementation of
xexpr/c, this module provides its own definition.
These functions write CSS-expressions and
X-expressions, respectively, to output ports, by their
canonical text representations.
These functions write style sheets (represented as CSS-expressions) or
webpages (represented as X-expressions) to files.