Pandoc::Selector3pm
Pandoc document selector language
Usage
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')
Overview
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#mainCode.perlCode.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| TypeExpressionNameExpression ::= NameName ::= [A-Za-z]+IdExpression ::= '#' [\p{L}\p{N}_-]+ClassExpression ::= '.' [\p{L}\p{N}_-]+TypeExpression ::= ':' Name
Releases
3 releases since Debian 10 (Buster); the text changed 2 times.