Add type of invisible as second class in span

This allows hard tabs, leading whitespace, and
trailing whitespace to be styled independently.
This commit is contained in:
Kevin Sawicki
2013-02-12 13:02:34 -08:00
parent ad4398c4c5
commit 9af54de0f6

View File

@@ -72,13 +72,13 @@ class Token
if invisibles
if @isHardTab and invisibles.tab
html = html.replace(/^./, "<span class='invisible'>#{invisibles.tab}</span>")
html = html.replace(/^./, "<span class='invisible hard-tab'>#{invisibles.tab}</span>")
else if invisibles.space
if hasLeadingWhitespace
html = html.replace /^[ ]+/, (match) ->
"<span class='invisible'>#{match.replace(/./g, invisibles.space)}</span>"
"<span class='invisible leading-whitespace'>#{match.replace(/./g, invisibles.space)}</span>"
if hasTrailingWhitespace
html = html.replace /[ ]+$/, (match) ->
"<span class='invisible'>#{match.replace(/./g, invisibles.space)}</span>"
"<span class='invisible trailing-whitespace'>#{match.replace(/./g, invisibles.space)}</span>"
html