1
0
mirror of https://github.com/alecthomas/chroma.git synced 2025-02-13 13:28:27 +02:00

Always use CSS class from StandardTypes.

As opposed to remapping to classes that exist in the current style.
This commit is contained in:
Alec Thomas 2017-09-27 22:05:47 +10:00
parent 80d3b96869
commit 33f604c892

View File

@ -195,6 +195,9 @@ func (f *Formatter) class(t chroma.TokenType) string {
}
func (f *Formatter) styleAttr(styles map[chroma.TokenType]string, tt chroma.TokenType) string {
if f.classes {
return string(fmt.Sprintf(` class="%s"`, f.class(tt)))
}
if _, ok := styles[tt]; !ok {
tt = tt.SubCategory()
if _, ok := styles[tt]; !ok {
@ -204,9 +207,6 @@ func (f *Formatter) styleAttr(styles map[chroma.TokenType]string, tt chroma.Toke
}
}
}
if f.classes {
return string(fmt.Sprintf(` class="%s"`, f.class(tt)))
}
return string(fmt.Sprintf(` style="%s"`, styles[tt]))
}