table of contents
| Pandoc::Selector(3pm) | User Contributed Perl Documentation | Pandoc::Selector(3pm) |
NAME¶
Pandoc::Selector - Pandoc document selector language
SYNOPSIS¶
my $selector = Pandoc::Selector->new('Code.perl|CodeBlock.perl');
# check whether an element matches
$selector->match($element);
# use as element method
$element->match('Code.perl|CodeBlock.perl')
DESCRIPTION¶
Pandoc::Selector provides a language to select elements of a Pandoc document. It borrows ideas from CSS Selectors <https://www.w3.org/TR/selectors-3/>, XPath <https://www.w3.org/TR/xpath/> and similar languages.
The language is being developed together with this implementation.
EXAMPLES¶
Header#main Code.perl Code.perl.raw :inline
SELECTOR GRAMMAR¶
Whitespace between parts of the syntax is optional and not included in the following grammar. A Selector is a list of one or more expression lists separated by pipes ("|"). For instance the selector "Subscript|Superscript" selects both Subscript elements and Superscript elements.
Selector ::= ExpressionList ( '|' ExpressionList )*
An expression list is a list of one or more expressions:
ExpressionList ::= Expression ( Expression )*
An expression is any of name expression, id expression, class expression, and type expression.
Expression ::= NameExpression
| IdExpression
| ClassExpression
| TypeExpression
NameExpression ::= Name
Name ::= [A-Za-z]+
IdExpression ::= '#' [\p{L}\p{N}_-]+
ClassExpression ::= '.' [\p{L}\p{N}_-]+
TypeExpression ::= ':' Name
SEE ALSO¶
See example filter "select" to select parts of a document.
| 2024-08-03 | perl v5.38.2 |