bpj / pandoc-elements-selectors Goto Github PK
View Code? Open in Web Editor NEWProposed Pandoc::Elements extended selector expression syntax, with parser and compiler in Perl
Home Page: https://github.com/nichtich/Pandoc-Elements/issues/18
Proposed Pandoc::Elements extended selector expression syntax, with parser and compiler in Perl
Home Page: https://github.com/nichtich/Pandoc-Elements/issues/18
In light of the possibility that this syntax might get used in a non-Perl context it might be a good idea to replace the blatantly Perlish sigils &
and %
with something else. As per #1 I'm thinking of ;
for properties (similar to :
for type) and ,
for attributes (similar to .
for class). Personally I have nothing against Perlish sigils, but others might, and I'm thinking that &
might be used to more clearly show that selector expressions are ANDed together, perhaps opening the door for making whitespace totally insignificant outside strings and regexes. OTOH this similarity may be a drawback, making the sigils and their functions easier to confuse.
Perhaps the description should talk (more) of properties than of methods since the distinction which matters from a Pandoc (rather than Perl or specifically Pandoc::Elements) perspective is between attributes (the things which go within curly brackets after some Pandoc constructs) and other properties of elements. Perhaps the sigil could also be changed to ;
.
Perhaps it would be more user friendly to use shell (Unix) style wildcard syntax as per Regexp::Wildcards instead of or in addition to regular expressions.
Pros:
Non-programmer users familiar with the command line may not know regex but they will know at least the basics of wildcard.
Wildcard-to-regex rewriting will be relatively easy to implement in various languages, while differences between regex flavors may pose a problem.
It is probably harder to write an invalid wildcard expression than to write an invalid regex!
Cons:
I'm thinking that wildcard would use [...]
as delimiters as opposed to {...}
for regex, so we may have both!
'Link &url~[*wikipedia.org*]' # con: implicit start/end anchors
'Link &url~{wikipedia\.org}' # con: must escape dot
Would it be a good idea to support the i
(case insensitive) modifier with glob patterns so that one could write e.g. %[foo]i
rather than %[{Foo,Foo,foo}]
(although this would match fOO
, foO
etc. as well)?
Comments/upvotes/downvotes are hereby requested!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.