[Tablegen] Make sure prefetches appear before styles
This commit is contained in:
parent
7c3604fcf3
commit
d6cde50192
1 changed files with 18 additions and 15 deletions
|
@ -136,6 +136,9 @@ namespace Tablegen
|
|||
pugi::xml_node comment = table.append_child(pugi::node_comment);
|
||||
comment.set_value(" Autogenerated by Tablegen, please avoid editing manually. ");
|
||||
|
||||
pugi::xml_node prefetch = table.append_child("div");
|
||||
prefetch.append_attribute("hidden");
|
||||
|
||||
pugi::xml_node script = table.append_child("script");
|
||||
pugi::xml_node styles = table.append_child("style");
|
||||
|
||||
|
@ -152,9 +155,24 @@ namespace Tablegen
|
|||
|
||||
pugi::xml_node tableBody = table.append_child("tbody");
|
||||
for (pugi::xml_node row; const auto& [i, character] : vw::enumerate(characters)) {
|
||||
std::string imagePath = std::vformat(
|
||||
settings.ImageFormat, std::make_format_args(character.ImagePath)
|
||||
);
|
||||
std::string animationPath = std::vformat(
|
||||
settings.AnimationFormat, std::make_format_args(character.AnimationPath)
|
||||
);
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// HTML
|
||||
////////////////////////////////////////////////////////////////////
|
||||
pugi::xml_node prefetchImage = prefetch.append_child("link");
|
||||
prefetchImage.append_attribute("rel") = "prefetch";
|
||||
prefetchImage.append_attribute("href") = imagePath;
|
||||
|
||||
pugi::xml_node prefetchAnimation = prefetch.append_child("link");
|
||||
prefetchAnimation.append_attribute("rel") = "prefetch";
|
||||
prefetchAnimation.append_attribute("href") = animationPath;
|
||||
|
||||
if (i % settings.CharactersPerRow == 0) {
|
||||
row = tableBody.append_child("tr");
|
||||
row.append_attribute("class") = "kanji-table-row";
|
||||
|
@ -178,21 +196,6 @@ namespace Tablegen
|
|||
imageWrap.append_attribute("class") = "kanji-image-wrap";
|
||||
imageWrap.append_attribute("id") = std::format("kanji-{}", i);
|
||||
|
||||
std::string imagePath = std::vformat(
|
||||
settings.ImageFormat, std::make_format_args(character.ImagePath)
|
||||
);
|
||||
std::string animationPath = std::vformat(
|
||||
settings.AnimationFormat, std::make_format_args(character.AnimationPath)
|
||||
);
|
||||
|
||||
pugi::xml_node prefetchImage = container.append_child("link");
|
||||
prefetchImage.append_attribute("rel") = "prefetch";
|
||||
prefetchImage.append_attribute("href") = imagePath;
|
||||
|
||||
pugi::xml_node prefetchAnimation = container.append_child("link");
|
||||
prefetchAnimation.append_attribute("rel") = "prefetch";
|
||||
prefetchAnimation.append_attribute("href") = animationPath;
|
||||
|
||||
pugi::xml_node image = imageWrap.append_child("input");
|
||||
image.append_attribute("type") = "checkbox";
|
||||
image.append_attribute("class") = "kanji-image";
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue