From 7660b6d257521ea0151cbcaf76849f6de7112b64 Mon Sep 17 00:00:00 2001 From: abap34 Date: Wed, 7 Aug 2024 15:38:51 +0900 Subject: [PATCH 1/3] =?UTF-8?q?=E3=83=87=E3=83=95=E3=82=A9=E3=83=AB?= =?UTF-8?q?=E3=83=88=E3=83=86=E3=83=BC=E3=83=9E=E3=82=92=E8=84=9A=E6=B3=A8?= =?UTF-8?q?=E3=81=AB=E5=AF=BE=E5=BF=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/dark.css | 10 ++++++++++ src/light.css | 11 +++++++++++ 2 files changed, 21 insertions(+) diff --git a/src/dark.css b/src/dark.css index 60137bb..ac24355 100644 --- a/src/dark.css +++ b/src/dark.css @@ -434,4 +434,14 @@ iframe { a { color: #007bff; word-break: break-all; +} + +.footnote { + border-top: solid 1px #555; + font-style: italic; +} + +.footnote > * { + display: block; + margin-bottom: 10px; } \ No newline at end of file diff --git a/src/light.css b/src/light.css index 0e6780f..c0bda4d 100644 --- a/src/light.css +++ b/src/light.css @@ -442,4 +442,15 @@ iframe { a { color: #007bff; word-break: break-all; +} + +.footnote { + border-top: solid 1px #ddd; + font-style: italic; + color: #777; +} + + +.footnote > * { + display: block; } \ No newline at end of file From 3939bc87c62e5963f924ca0d737a53518861580e Mon Sep 17 00:00:00 2001 From: abap34 Date: Wed, 7 Aug 2024 15:39:08 +0900 Subject: [PATCH 2/3] =?UTF-8?q?=E8=84=9A=E6=B3=A8=E3=81=AE=E3=82=AD?= =?UTF-8?q?=E3=83=BC=E3=82=92=E7=B5=B1=E4=B8=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/syntax/FootnoteDefinition.hpp | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/syntax/FootnoteDefinition.hpp b/src/syntax/FootnoteDefinition.hpp index 922e19a..a6d7157 100644 --- a/src/syntax/FootnoteDefinition.hpp +++ b/src/syntax/FootnoteDefinition.hpp @@ -8,25 +8,24 @@ namespace almo { struct FootnoteDefinition : public ASTNode { private: - std::string tag; + std::string symbol; public: - FootnoteDefinition(std::string tag_) : tag(tag_) { set_uuid(); } + FootnoteDefinition(std::string symbol_) : symbol(symbol_) { set_uuid(); } std::string to_html() const override { std::string childs_html = concatenated_childs_html(); - return "
  • ^" + tag + "" + - childs_html + "
  • "; + return "^" + + symbol + "" + childs_html + ""; } std::map get_properties() const override { - return {{"tag", tag}}; + return {{"symbol", symbol}}; } std::string get_classname() const override { return "FootnoteDefinition"; } }; struct FootnoteDefinitionSyntax : public BlockSyntax { /* - "[^" + expr + "]: + hoge" + "[^" + symbol + "]: + hoge" */ static inline const std::regex rex = std::regex(R"(\[\^(.*?)\]:(.*?))"); bool operator()(Reader &read) const override { From c03cd318efc8f71e7349bbccffb28df557bce529 Mon Sep 17 00:00:00 2001 From: abap34 Date: Wed, 7 Aug 2024 15:39:54 +0900 Subject: [PATCH 3/3] =?UTF-8?q?C++=20CLI=20=E3=81=A7=E3=82=82=E8=84=9A?= =?UTF-8?q?=E6=B3=A8=E3=81=AE=E6=9C=AB=E5=B0=BE=E3=81=B8=E3=81=AE=E7=A7=BB?= =?UTF-8?q?=E5=8B=95=E3=82=92=E8=A1=8C=E3=81=86=E3=82=88=E3=81=86=E3=81=AB?= =?UTF-8?q?=E5=A4=89=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/render.hpp | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/render.hpp b/src/render.hpp index de0c8e0..a4b8e87 100644 --- a/src/render.hpp +++ b/src/render.hpp @@ -89,7 +89,23 @@ namespace almo { return output_html; } + void move_footnote_definition(Markdown& ast) { + std::vector> footnote_defs = ast.nodes_byclass("FootnoteDefinition"); + + std::shared_ptr footnote_div = std::make_shared("footnote"); + + ast.pushback_child(footnote_div); + + for (auto node : footnote_defs) { + ast.move_node(node, footnote_div); + } + } + std::string render(Markdown ast, std::map meta_data) { + std::vector> footnote_defs = ast.nodes_byclass("FootnoteDefinition"); + + std::shared_ptr footnote_div = std::make_shared("footnote"); + std::string content = ast.to_html(); std::string html_template = load_html_template(meta_data["template_file"], meta_data["css_setting"], meta_data["required_pyodide"] == "true"); @@ -148,6 +164,9 @@ namespace almo { Markdown ast; MarkdownParser parser(md_content); parser.process(ast); + + move_footnote_definition(ast); + render(ast, meta_data); ParseSummary summary = { .ast = ast,