Skip to content

Commit

Permalink
Format and highlight xml
Browse files Browse the repository at this point in the history
  • Loading branch information
mls-m5 committed Nov 10, 2023
1 parent dd7743a commit 981a9d1
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/plugin/genericformat.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,9 @@ bool formatHtmlAndXml(std::filesystem::path path, Editor &editor) {
}

editor.save();
runCommand("tidy -indent -m --tidy-mark no " +
std::string{std::filesystem::absolute(path)});
runCommand("tidy -indent -m --tidy-mark no",
(isXml(path) ? "-xml " : ""),
std::filesystem::absolute(path));
editor.load();

return true;
Expand Down
7 changes: 7 additions & 0 deletions src/syntax/basichighligting.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@ const auto wordListHtml = std::vector<std::string_view>{
"video", "wbr",
};

const auto wordListXml = std::vector<std::string_view>{
"CDATA",
};

const auto wordlistJavascript = std::vector<std::string_view>{
"abstract", "arguments", "await", "boolean", "break",
"byte", "case", "catch", "char", "class",
Expand Down Expand Up @@ -290,6 +294,9 @@ const std::vector<std::string_view> *getWordList(
if (isHtml(extension)) {
return &wordListHtml;
}
if (isXml(extension)) {
return &wordListXml;
}
if (isJs(extension)) {
return &wordlistJavascript;
}
Expand Down

0 comments on commit 981a9d1

Please sign in to comment.