byexamples / byexamples/byexample
Support multiple Zone Delimiters by file extension
- Dominant language
- Python
- Stars
- 67
- Forks
- 9
- PR merge metrics
- No merged PRs in 30d
Description
**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:
```cpp
/* 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*.
Contributor guide
Assessment
This issue has not been assessed yet.