Skip to content

Commit

Permalink
Merge pull request #161 from abap34/refactor/#158
Browse files Browse the repository at this point in the history
不要な `std::format` の利用を削除
  • Loading branch information
abap34 authored Sep 18, 2024
2 parents dcfc3be + a6f61fe commit fb32c49
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 10 deletions.
6 changes: 2 additions & 4 deletions src/syntax/FootnoteDefinition.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,8 @@ struct FootnoteDefinition : public ASTNode {
std::string label = "label_" + symbol;
std::string jump_to = "ref_" + symbol;

return std::format(
"<span class=\"footnote-def\" id=\"{}\"><a "
"href=\"#{}\">[{}]</a>{}</span>",
label, jump_to, symbol, childs_html);
return "<span class=\"footnote-def\" id=\"" + label + "\"><a href=\"#" +
jump_to + "\">[" + symbol + "]</a>" + childs_html + "</span>";
}
std::map<std::string, std::string> get_properties() const override {
return {{"symbol", symbol}};
Expand Down
10 changes: 4 additions & 6 deletions src/syntax/InlineFootnoteReference.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,14 @@ struct InlineFootnoteReference : public ASTNode {
}

std::string to_html() const override {
// This is correct.
// This is correct.
// `label_` is setted in `FootnoteDefinition` (which we have to jump to)
std::string label = "ref_" + symbol;
std::string jump_to = "label_" + symbol;

return std::format(
"<span class=\"footnote-ref\"><sup id=\"{}\"><a "
"href=\"#{}\">[{}]</a>"
"</sup></span>",
label, jump_to, symbol);
return "<span class=\"footnote-ref\"><sup id=\"" + label +
"\"><a href=\"#" + jump_to + "\">[" + symbol +
"]</a></sup></span>";
}

std::map<std::string, std::string> get_properties() const override {
Expand Down

0 comments on commit fb32c49

Please sign in to comment.