Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pug: Improved class and id in tag detection #2358

Merged
merged 2 commits into from May 3, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 3 additions & 1 deletion components/prism-pug.js
Expand Up @@ -130,7 +130,9 @@
}
}
],
'punctuation': /:/
'punctuation': /:/,
'attr-id': /#[\w\-]+/,
RunDevelopment marked this conversation as resolved.
Show resolved Hide resolved
'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