Skip to content

Commit

Permalink
pug: Improved class and id detection in tags (#2358)
Browse files Browse the repository at this point in the history
  • Loading branch information
dev-itsheng committed May 3, 2020
1 parent c932447 commit 7f948ec
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 6 deletions.
4 changes: 3 additions & 1 deletion components/prism-pug.js
Expand Up @@ -130,7 +130,9 @@
}
}
],
'punctuation': /:/
'punctuation': /:/,
'attr-id': /#[\w\-]+/,
'attr-class': /\.[\w\-]+/
}
},
'code': [
Expand Down
2 changes: 1 addition & 1 deletion components/prism-pug.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 20 additions & 4 deletions tests/languages/pug/tag_feature.test
Expand Up @@ -13,6 +13,9 @@ a.button
a#main-link
#content

div#test-id.test-class1.test-class2
.test-class1#test-id.test-class2

a: span

----------------------------------------------------
Expand Down Expand Up @@ -83,10 +86,23 @@ a: span
]]
]],

["tag", ["a.button"]],
["tag", [".content"]],
["tag", ["a#main-link"]],
["tag", ["#content"]],
["tag", [
"a",
["attr-class", ".button"]]],
["tag", [["attr-class", ".content"]]],
["tag", [
"a",
["attr-id", "#main-link"]]],
["tag", [["attr-id", "#content"]]],
["tag", [
"div",
["attr-id", "#test-id"],
["attr-class", ".test-class1"],
["attr-class", ".test-class2"]]],
["tag", [
["attr-class", ".test-class1"],
["attr-id", "#test-id"],
["attr-class", ".test-class2"]]],

["tag", ["a", ["punctuation", ":"]]],
["tag", ["span"]]
Expand Down

0 comments on commit 7f948ec

Please sign in to comment.