CabinJS/grunt-pages — pull request #89 by mlewand (2014-05-17 14:15:11+00:00)
Title: Fix for mixed End of Line characters produced by node-pygmentize-bundled.

## What's the issue?

Code snippets created with **node-pygmentize-bundled** produces always OS specific line endings. It's fine as long as whole team sits on Linux, and whole project uses `\n` EOL char, but if you start to use it at Windows it produces `\r\n` spearators, **only in highlighted snippets**.

That breaks part of tests at Win and causes a mess in output (mixed line endings, which is bad).

Issue is directly in **node-pygmentize-bundled** implementation, and I've sent them already a PR with fix, but I can't tell how quick their reaction will be. You can find more details at rvagg/node-pygmentize-bundled#9.

## Design concept:

Initially I wanted to allow dev to input a literal character of desired EOL char in Gruntfile.js config, but it turned out that string values are parsed, and `(...) pygmentsEOL: '\n', (...)` into pages config, it will automatically transform it to `\r\n` at windows. I was not familiar with this "feature" and could not find a way surpass it.

Property which will tell which EOL string we want to use is in `options.pygmentsEOL`. I've named it `pygmentsEOL`, because it relates only to the output of Pygments adapter.

I didn't change the defalut behaviour, workaround will be applied only if `options.pygmentsEOL` property will be set - this way it will keep backward compatibility.

## What I've done here?

### pages.js modifications:

* Included `os` module, required to get os-specific EOL.
* Added `EOL_STYLES` enumeration.
* Added a `normalizeLineEndings` function, which encapsulates replace process, it's called in `pygmentize` callback.

### Gruntfile.js modifications:

* Essentially added `pygmentsEOL` property in test setups.
* Extra replace in page setup, where `highlight` handler is overriden.

## Extra thoughts

Essentially it's a workaround, but it's required until the source won't be fixed. Then it might be reversed.

With these changes tests passes at Windows. It would be good to check it at Mac.

I've added a note to options list in **README.md**.