Pandoc::Selector - Pandoc document selector language
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')
Pandoc::Selector provides a language to select elements of a Pandoc document. It borrows ideas from CSS Selectors, XPath and similar languages.
The language is being developed together with this implementation.
Header#main Code.perl Code.perl.raw :inline
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.
|
Subscript|Superscript
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 example filter select to select parts of a document.
select
To install Pandoc::Elements, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Pandoc::Elements
CPAN shell
perl -MCPAN -e shell install Pandoc::Elements
For more information on module installation, please visit the detailed CPAN module installation guide.