diff --git a/src/adoc.cpp b/src/adoc.cpp index a542d6e..4fdeaa6 100644 --- a/src/adoc.cpp +++ b/src/adoc.cpp @@ -65,13 +65,25 @@ void export_adoc(const vector &entries, ostream &out) } out << endl; - out << '_' << time << '_'; + out << '_' << time.substr(0, 5) << '_'; + if (!entry.archive_uri.empty()) + { + out << " (link:" << entry.archive_uri << "[archived version])"; + } + out << endl; + + bool separator = false; for (const string &tag : entry.tags) { if (tag.empty()) { continue; } + if (!separator) + { + out << "| "; + separator = true; + } auto globaltag = alltags.find(tag); if (globaltag != alltags.end()) @@ -83,22 +95,17 @@ void export_adoc(const vector &entries, ostream &out) alltags.insert({ tag, { entry } }); } - out << " xref:" << replace_spaces(tag) << '[' << tag << ']'; + out << "xref:" << replace_spaces(tag) << "[" << tag << ']'; if (tag != *(entry.tags.rbegin())) { - out << ','; + out << ", "; } } out << endl; - if (!entry.archive_uri.empty()) - { - out << " (" << entry.archive_uri << "[archived version])\n"; - } - out << endl; if (!entry.description.empty()) { - out << entry.description << endl << endl; + out << endl << entry.description << endl << endl; } } diff --git a/tests/test_adoc.cpp b/tests/test_adoc.cpp index 9ff765e..9556790 100644 --- a/tests/test_adoc.cpp +++ b/tests/test_adoc.cpp @@ -59,8 +59,8 @@ SCENARIO ("The AsciiDoc export works correctly") ("== 1970-01-01\n\n" "\\[\\[dt1970-01-01T\\d{2}:\\d{2}:\\d{2}\\]\\]\n" "\\.link:https://example\\.com/page\\.html\\[Nice title\\]\n" - "_\\d{2}:\\d{2}:\\d{2}_ " - "xref:tag1\\[tag1\\], xref:tag2\\[tag2\\]\n\n" + "_\\d{2}:\\d{2}:\\d{2}_\n" + "| xref:tag1\\[tag1\\], xref:tag2\\[tag2\\]\n\n" "Good description\\.\n"); const regex re_tags ("== Tags\n\n"