nevir/groc — pull request #120 by sjorek (2013-09-18 10:28:53+00:00)
Title: Fix and enhance code segmentation

Foreword: This pull-request got larger than I wished. And if you want me to split it up into several smaller requests, I'll do so, but I suggest to give it at least a try, once …

The rendered results (containing more changes I'm going to offer soon) are here:
-
-

Summary of bugs, faults and traps I've fixed:

1. All language-specific delimiters and marks as those for single-line and multi-line block-comments, as well as the
`foldPrefix` and `ignorePrefix` are now properly escaped if used in regular-expressions.
2. By introducing a new flag `strictMultiLineEnd` and changing the code accordingly, it is now possible to nest block-
comments of syntax _A_ in block-comments of syntax _B_, as those in the _handlebars_ or _html+php_
syntax-definitions, which are supported by _pygments_.
Example (handlebars): `{{! A nested … }}`
Example (html+php): ``
The previous solution stopped a the first block-comment closing mark, which is obviously wrong.
3. The above change made it necessary to separate the block-line matcher from the single-line matcher. Therefore I
developed a new way to handle this. This new implementation seems to be more solid - at least I hope so.
4. `foldPrefix` and `ignorePrefix` can be a string of arbitrary length now. (This happened by accident)
5. The larger regular-expressions got comments to enhance their readability.
6. I cleaned the code-comments of `lib/utils.coffee` to enhance readability.
7. @achingbrain Block-comments can now be embedded into code, and they can be folded too. Some examples
have been added directly into the code. To achieve this, the change (3.) was necessary too. And I needed to
tweak the CSS and behavior-Javascript a little bit, to make it work.
8. Empty comment lines from block-comments start- and end-marks are not collected anymore, examples are
embedded into code.
9. I added some clarifying comments to `lib/languages.coffee` all related to the changes above, and cleaned the file
a little bit to enhance consistency.

That's all I guess … hope we find a way to get this merged in or at least discuss and solve the issues tackled by this request.

Cheers,
Stephan
:see_no_evil: :hear_no_evil: :speak_no_evil: