Modified AsciiDoc output a bit.
continuous-integration/drone/push Build is passing Details

Seconds are no longer included in times, the link to the archived
version comes directly after the time and tags are separated by a |.
This commit is contained in:
tastytea 2019-05-17 11:13:39 +02:00
parent 887d6bd0ca
commit 662fe22df4
Signed by: tastytea
GPG Key ID: CFC39497F1B26E07
2 changed files with 18 additions and 11 deletions

View File

@ -65,13 +65,25 @@ void export_adoc(const vector<Database::entry> &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<Database::entry> &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;
}
}

View File

@ -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"