class DocumentUtil
in Tinman.Core.Document
Helper
class
for
dealing
with
text
documents.
static class
|
DocumentUtil
|
|
Remarks
Content
for
text
documents
can
be
specified
using
a
simple
mini-HTML
dialect,
which
is
defined
by
the
following
Grammar:
blocks := block* ;
inlines := inline* ;
block := ol | ul | cdata | p ;
li := '<li' '>' block* '</li' '>' ;
ol := '<ol' '>' li* '</ol' '>' ;
ul := '<ul' '>' li* '</ul' '>' ;
p := '<p' '>' inline* '</p' '>' | inline+ ;
inline := b | c | i | a | br | text ;
a := '<a' 'href' '=' '"' (char-2 | entity)* '"' ('/>' | '>' text '</a>') ;
b := '<b' '>' text '</b' '>' ;
c := '<c' '>' text '</c' '>' ;
i := '<i' '>' text '</i' '>' ;
text := (char-1 | entity)* ;
br := '<br' '/>' ;
cdata := '<![CDATA[' ~']]>'+ ']]>' ;
char-1 := ]<&[+ ;
char-2 := ]<"&[+ ;
entity := '<' | '&' | '>' | '"' | '&apos' ;
Use
the
BlockContent
and
InlineContent
methods
to
populate
text
document
nodes
with
mini-HTML
content.
Public / Methods
BlockContent
Populates
the
given
document
node
with
block
content.
public
static
method
|
BlockContent
(string content,
ICollector<IBlockNode> output)
|
params
|
content
|
[not-null]
|
The
mini-HTML
content
(see
rule
'blocks' ). |
|
output
|
[not-null]
|
The
output
document
node. |
EscapeMiniHtml
Escapes
the
given
text.
public
static
method
|
EscapeMiniHtml
(string text,
bool attribute = false)
|
type
|
string
|
params
|
text
|
|
The
text
to
escape. |
|
attribute
|
|
Escape
for
attribute
value?
Defaults
to
false . |
returns
|
|
|
The
escaped
text. |
InlineContent
Populates
the
given
document
node
with
block
content.
public
static
method
|
InlineContent
(string content,
ICollector<IInlineNode> output)
|
params
|
content
|
[not-null]
|
The
mini-HTML
content
(see
rule
'inlines' ). |
|
output
|
[not-null]
|
The
output
document
node. |
WhitespaceBefore
public
static
method
|
WhitespaceBefore
(Context context,
IInlineNode node)
|
type
|
bool
|
params
|
context
|
|
|
|
node
|
|
|
WhitespaceReset
public
static
method
|
WhitespaceReset
(Context context)
|
params
|
context
|
|
|