输出端构成
This commit is contained in:
parent
77aa450258
commit
81db04b444
|
@ -5,9 +5,9 @@
|
||||||
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
|
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Label="QtSettings" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
<PropertyGroup Label="QtSettings" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||||
<QtLastBackgroundBuild>2024-04-02T15:18:58.9876786Z</QtLastBackgroundBuild>
|
<QtLastBackgroundBuild>2024-04-04T04:12:24.0605703Z</QtLastBackgroundBuild>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Label="QtSettings" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
<PropertyGroup Label="QtSettings" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||||
<QtLastBackgroundBuild>2024-04-02T15:18:59.1749926Z</QtLastBackgroundBuild>
|
<QtLastBackgroundBuild>2024-04-04T04:12:24.5356632Z</QtLastBackgroundBuild>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
</Project>
|
</Project>
|
|
@ -90,6 +90,7 @@ void StoryVolume::buildPageHTML(QDomElement& parent) const {
|
||||||
|
|
||||||
auto dom_title = doc_inst.createElement("h1");
|
auto dom_title = doc_inst.createElement("h1");
|
||||||
dom_title.appendChild(doc_inst.createTextNode(volume_inst->name()));
|
dom_title.appendChild(doc_inst.createTextNode(volume_inst->name()));
|
||||||
|
dom_volume.appendChild(dom_title);
|
||||||
|
|
||||||
std::function<void(QDomElement&, const QList<std::shared_ptr<const ast_gen::ElementAccess>>&)> rich_refer_build =
|
std::function<void(QDomElement&, const QList<std::shared_ptr<const ast_gen::ElementAccess>>&)> rich_refer_build =
|
||||||
[&](QDomElement& parent_element, const QList<std::shared_ptr<const ast_gen::ElementAccess>> children) {
|
[&](QDomElement& parent_element, const QList<std::shared_ptr<const ast_gen::ElementAccess>> children) {
|
||||||
|
@ -107,9 +108,10 @@ void StoryVolume::buildPageHTML(QDomElement& parent) const {
|
||||||
auto article_inst = std::dynamic_pointer_cast<const ArticleDefine>(child->element());
|
auto article_inst = std::dynamic_pointer_cast<const ArticleDefine>(child->element());
|
||||||
auto article_group = doc_ins.createElement("div");
|
auto article_group = doc_ins.createElement("div");
|
||||||
auto article_head = doc_ins.createElement("h2");
|
auto article_head = doc_ins.createElement("h2");
|
||||||
article_head.appendChild(doc_ins.createTextNode(article_inst->name()));
|
article_head.appendChild(doc_ins.createTextNode(article_inst->name() + u8"{"));
|
||||||
article_group.appendChild(article_head);
|
article_group.appendChild(article_head);
|
||||||
rich_refer_build(article_group, child->children());
|
rich_refer_build(article_group, child->children());
|
||||||
|
article_group.appendChild(doc_ins.createTextNode(u8"}"));
|
||||||
parent_element.appendChild(article_group);
|
parent_element.appendChild(article_group);
|
||||||
}break;
|
}break;
|
||||||
case NovelNode::FragmentRefer:{
|
case NovelNode::FragmentRefer:{
|
||||||
|
@ -146,6 +148,7 @@ void FragmentRef::buildSliceHTML(QDomElement& dom_parent) const {
|
||||||
auto doc = dom_parent.ownerDocument();
|
auto doc = dom_parent.ownerDocument();
|
||||||
|
|
||||||
auto dom_reference = doc.createElement(u8"div");
|
auto dom_reference = doc.createElement(u8"div");
|
||||||
|
dom_reference.setAttribute("id", QString::number((qulonglong)refer_element.get()));
|
||||||
dom_parent.appendChild(dom_reference);
|
dom_parent.appendChild(dom_reference);
|
||||||
|
|
||||||
auto dom_title = doc.createElement(u8"h2");
|
auto dom_title = doc.createElement(u8"h2");
|
||||||
|
@ -153,7 +156,7 @@ void FragmentRef::buildSliceHTML(QDomElement& dom_parent) const {
|
||||||
|
|
||||||
auto dom_href = doc.createElement(u8"a");
|
auto dom_href = doc.createElement(u8"a");
|
||||||
dom_href.appendChild(doc.createTextNode(refer_element->referSignature()));
|
dom_href.appendChild(doc.createTextNode(refer_element->referSignature()));
|
||||||
dom_href.setAttribute("href", jump_to_host);
|
dom_href.setAttribute("href", u8"file:///"+jump_to_host);
|
||||||
dom_title.appendChild(dom_href);
|
dom_title.appendChild(dom_href);
|
||||||
|
|
||||||
std::function<void(QDomElement&, const QList<std::shared_ptr<const ast_gen::ElementAccess>>&)> rich_refer_build =
|
std::function<void(QDomElement&, const QList<std::shared_ptr<const ast_gen::ElementAccess>>&)> rich_refer_build =
|
||||||
|
@ -172,9 +175,10 @@ void FragmentRef::buildSliceHTML(QDomElement& dom_parent) const {
|
||||||
auto article_inst = std::dynamic_pointer_cast<const ArticleDefine>(child->element());
|
auto article_inst = std::dynamic_pointer_cast<const ArticleDefine>(child->element());
|
||||||
auto article_group = doc_ins.createElement("div");
|
auto article_group = doc_ins.createElement("div");
|
||||||
auto article_head = doc_ins.createElement("h2");
|
auto article_head = doc_ins.createElement("h2");
|
||||||
article_head.appendChild(doc_ins.createTextNode(article_inst->name()));
|
article_head.appendChild(doc_ins.createTextNode(article_inst->name() + u8"{"));
|
||||||
article_group.appendChild(article_head);
|
article_group.appendChild(article_head);
|
||||||
rich_refer_build(article_group, child->children());
|
rich_refer_build(article_group, child->children());
|
||||||
|
article_group.appendChild(doc_ins.createTextNode(u8"}"));
|
||||||
parent_element.appendChild(article_group);
|
parent_element.appendChild(article_group);
|
||||||
}break;
|
}break;
|
||||||
default:
|
default:
|
||||||
|
@ -199,7 +203,7 @@ void FragmentRef::buildPageHTML(QDomElement& parent) const {
|
||||||
refers_dom.appendChild(title_block);
|
refers_dom.appendChild(title_block);
|
||||||
auto title_refer = doc.createElement(u8"a");
|
auto title_refer = doc.createElement(u8"a");
|
||||||
title_refer.appendChild(doc.createTextNode(refer_element->signature()));
|
title_refer.appendChild(doc.createTextNode(refer_element->signature()));
|
||||||
title_refer.setAttribute("href", this->sliceRefers());
|
title_refer.setAttribute("href", u8"file:///"+this->sliceRefers());
|
||||||
title_block.appendChild(title_refer);
|
title_block.appendChild(title_refer);
|
||||||
|
|
||||||
std::function<void(QList<std::shared_ptr<const ast_gen::ElementAccess>>)> build_cascade =
|
std::function<void(QList<std::shared_ptr<const ast_gen::ElementAccess>>)> build_cascade =
|
||||||
|
@ -237,6 +241,7 @@ void Fragment::buildSliceHTML(QDomElement& parent) const {
|
||||||
|
|
||||||
auto doc = parent.ownerDocument();
|
auto doc = parent.ownerDocument();
|
||||||
auto dom_fragment = doc.createElement("div");
|
auto dom_fragment = doc.createElement("div");
|
||||||
|
dom_fragment.setAttribute("id", QString::number((qulonglong)fragment_inst.get()));
|
||||||
parent.appendChild(dom_fragment);
|
parent.appendChild(dom_fragment);
|
||||||
|
|
||||||
auto dom_title = doc.createElement("h2");
|
auto dom_title = doc.createElement("h2");
|
||||||
|
@ -244,7 +249,7 @@ void Fragment::buildSliceHTML(QDomElement& parent) const {
|
||||||
|
|
||||||
auto dom_href = doc.createElement("a");
|
auto dom_href = doc.createElement("a");
|
||||||
dom_href.appendChild(doc.createTextNode(fragment_inst->name()));
|
dom_href.appendChild(doc.createTextNode(fragment_inst->name()));
|
||||||
dom_href.setAttribute("href", this->pageRefers());
|
dom_href.setAttribute("href", u8"file:///"+this->pageRefers());
|
||||||
dom_title.appendChild(dom_href);
|
dom_title.appendChild(dom_href);
|
||||||
|
|
||||||
for (auto& inst_c : syntax_access->children()) {
|
for (auto& inst_c : syntax_access->children()) {
|
||||||
|
@ -271,7 +276,7 @@ void Fragment::buildPageHTML(QDomElement& parent) const {
|
||||||
|
|
||||||
auto dom_href = doc.createElement("a");
|
auto dom_href = doc.createElement("a");
|
||||||
dom_href.appendChild(doc.createTextNode(fragment_inst->signature()));
|
dom_href.appendChild(doc.createTextNode(fragment_inst->signature()));
|
||||||
dom_href.setAttribute("href", this->pageRefers());
|
dom_href.setAttribute("href", u8"file:///" + this->sliceRefers());
|
||||||
dom_title.appendChild(dom_href);
|
dom_title.appendChild(dom_href);
|
||||||
|
|
||||||
for (auto& inst_c : syntax_access->children()) {
|
for (auto& inst_c : syntax_access->children()) {
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
#include <syntax_novel.h>
|
#include <syntax_novel.h>
|
||||||
#include <tokens_novel.h>
|
#include <tokens_novel.h>
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
|
#include <QTextStream>
|
||||||
|
|
||||||
#include "novelparser.h"
|
#include "novelparser.h"
|
||||||
#include "htmlprint.h"
|
#include "htmlprint.h"
|
||||||
|
@ -32,6 +33,33 @@ int main(int argc, char* argv[]) {
|
||||||
tool.storylines_anchors_define(tool.storyline_defines.values(), QDir::current());
|
tool.storylines_anchors_define(tool.storyline_defines.values(), QDir::current());
|
||||||
tool.volumes_anchors_define(tool.volume_defines.values(), QDir::current());
|
tool.volumes_anchors_define(tool.volume_defines.values(), QDir::current());
|
||||||
|
|
||||||
|
std::function<void(std::shared_ptr<const printer::Access>)> html_output =
|
||||||
|
[](std::shared_ptr<const printer::Access> inst) {
|
||||||
|
auto target_path = inst->pageRefers();
|
||||||
|
QFile tfile(target_path);
|
||||||
|
if (tfile.open(QIODevice::WriteOnly | QIODevice::Text)) {
|
||||||
|
QDomDocument doc_inst(QDomImplementation().createDocumentType(u8"html", QString(), QString()));
|
||||||
|
auto html = doc_inst.createElement(u8"html");
|
||||||
|
doc_inst.appendChild(html);
|
||||||
|
|
||||||
|
auto body = doc_inst.createElement(u8"body");
|
||||||
|
html.appendChild(body);
|
||||||
|
|
||||||
|
inst->buildPageHTML(body);
|
||||||
|
|
||||||
|
QTextStream tout(&tfile);
|
||||||
|
doc_inst.save(tout, 2);
|
||||||
|
tout.flush();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
for (auto& node : tool.fragment_defines)
|
||||||
|
html_output(node);
|
||||||
|
for (auto& node : tool.storyline_defines)
|
||||||
|
html_output(node);
|
||||||
|
for (auto& node : tool.volume_defines)
|
||||||
|
html_output(node);
|
||||||
|
|
||||||
std::function<void(std::shared_ptr<const ast_gen::ElementAccess>, int)> tnode_print =
|
std::function<void(std::shared_ptr<const ast_gen::ElementAccess>, int)> tnode_print =
|
||||||
[&](std::shared_ptr<const ast_gen::ElementAccess> node, int intend) {
|
[&](std::shared_ptr<const ast_gen::ElementAccess> node, int intend) {
|
||||||
auto name = node->element()->signature();
|
auto name = node->element()->signature();
|
||||||
|
|
|
@ -5,9 +5,9 @@
|
||||||
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
|
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Label="QtSettings" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
<PropertyGroup Label="QtSettings" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||||
<QtLastBackgroundBuild>2024-04-02T15:18:59.4171377Z</QtLastBackgroundBuild>
|
<QtLastBackgroundBuild>2024-04-04T04:12:25.1970080Z</QtLastBackgroundBuild>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Label="QtSettings" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
<PropertyGroup Label="QtSettings" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||||
<QtLastBackgroundBuild>2024-04-02T15:18:59.5628515Z</QtLastBackgroundBuild>
|
<QtLastBackgroundBuild>2024-04-04T04:12:25.4349434Z</QtLastBackgroundBuild>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
</Project>
|
</Project>
|
|
@ -5,9 +5,9 @@
|
||||||
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
|
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Label="QtSettings" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
<PropertyGroup Label="QtSettings" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||||
<QtLastBackgroundBuild>2024-04-02T15:18:59.2348615Z</QtLastBackgroundBuild>
|
<QtLastBackgroundBuild>2024-04-04T04:12:24.7411048Z</QtLastBackgroundBuild>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Label="QtSettings" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
<PropertyGroup Label="QtSettings" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||||
<QtLastBackgroundBuild>2024-04-02T15:18:59.3520172Z</QtLastBackgroundBuild>
|
<QtLastBackgroundBuild>2024-04-04T04:12:25.0903609Z</QtLastBackgroundBuild>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
</Project>
|
</Project>
|
|
@ -2,9 +2,9 @@
|
||||||
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
<PropertyGroup />
|
<PropertyGroup />
|
||||||
<PropertyGroup Label="QtSettings" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
<PropertyGroup Label="QtSettings" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||||
<QtLastBackgroundBuild>2024-04-02T15:18:59.6245932Z</QtLastBackgroundBuild>
|
<QtLastBackgroundBuild>2024-04-04T04:12:25.4971632Z</QtLastBackgroundBuild>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Label="QtSettings" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
<PropertyGroup Label="QtSettings" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||||
<QtLastBackgroundBuild>2024-04-02T15:18:59.7760855Z</QtLastBackgroundBuild>
|
<QtLastBackgroundBuild>2024-04-04T04:12:25.6489839Z</QtLastBackgroundBuild>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
</Project>
|
</Project>
|
Loading…
Reference in New Issue