kainjow / Mustache

Mustache text templates for modern C++
Boost Software License 1.0
357 stars 49 forks source link

Convert newLines to <br> #19

Closed Snafuuz closed 6 years ago

Snafuuz commented 6 years ago

When HTML escapes are added, also convert line breaks to
tags. Consider single \r and \n, as well as combinations of \r\n

codecov-io commented 6 years ago

Codecov Report

Merging #19 into master will increase coverage by 0.01%. The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #19      +/-   ##
==========================================
+ Coverage   99.13%   99.14%   +0.01%     
==========================================
  Files           2        2              
  Lines        1273     1289      +16     
==========================================
+ Hits         1262     1278      +16     
  Misses         11       11
Impacted Files Coverage Δ
tests.cpp 98.54% <100%> (ø) :arrow_up:
mustache.hpp 100% <100%> (ø) :arrow_up:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 6e0488a...110e56c. Read the comment docs.

kainjow commented 6 years ago

I appreciate the PR, but this isn't what HTML escaping is, and isn't what Mustache spec supports, as far as I can tell, especially if you test with the demo.

Snafuuz commented 6 years ago

I agree that the demo does also not convert newlines. On the other hand, the mustache documentation does not really tell me how to handle multi-line content. I filed a mustache issue that raises this question. (fyi: https://github.com/mustache/mustache.github.com/issues/108) Until then I'll have to use a custom HTML escaping function, as this seems to be the only working solution at the time given.