byexample icon indicating copy to clipboard operation
byexample copied to clipboard

Support multiple Zone Delimiters by file extension

Open eldipa opened this issue 5 years ago • 0 comments

Describe the feature you'd like Currently byexample supports a single Zone Delimiter selected by the file extension of the target files.

It would be useful to support more Zone Delimiters because some files may have different zones.

Markdown is one case where two zones are well defined: the fenced-code blocks and the HTML comment blocks. byexample supports those two as a single zone at the expenses of a much complex regex.

C/C++ is another example with two zones too: single line comments (//) and multiline comments (/* */). In this case it is too complex to capture those two zones in a single regex. It is be much easier just combining the two Zone Delimiters that byexample already has for each case.

Additional context (optional)

There are issues when two Zone Delimiters yield overlapping zones. Think in the following C/C++ example:

/* This is the zone 1
    // This is the zone 2
    // ?: cpp_example
    //  result
*/

The other issue is that byexample assumes that the zones returned by the (currently) single Zone Delimiter are in order (so they will be executed following that order). Using more than one Zone Delimiter the partial results will have to be merged and sorted.

eldipa avatar Jul 05 '21 21:07 eldipa