From 9196585a980cfd16b434ee12fe6d546d140cb370 Mon Sep 17 00:00:00 2001 From: tastytea Date: Fri, 24 May 2019 23:53:01 +0200 Subject: [PATCH] Added date after title in tags section of AsciiDoc export. --- src/adoc.cpp | 7 ++++--- tests/test_adoc.cpp | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/adoc.cpp b/src/adoc.cpp index d5a99ec..ce0a1f0 100644 --- a/src/adoc.cpp +++ b/src/adoc.cpp @@ -141,14 +141,15 @@ void export_adoc(const vector &entries, ostream &out) << tag.first << endl; for (const Database::entry &entry : tag.second) { + const string datetime = timepoint_to_string(entry.datetime); + const string day = datetime.substr(0, datetime.find('T')); string title = entry.title; if (title.empty()) { title = "++" + entry.uri + "++"; } - out << endl << "* xref:dt_" - << timepoint_to_string(entry.datetime) - << '[' << title << ']' << endl; + out << endl << "* xref:dt_" << datetime + << '[' << title << "] _(" << day << ")_" << endl; } out << endl; } diff --git a/tests/test_adoc.cpp b/tests/test_adoc.cpp index fa0b05e..6391098 100644 --- a/tests/test_adoc.cpp +++ b/tests/test_adoc.cpp @@ -66,7 +66,7 @@ SCENARIO ("The AsciiDoc export works correctly") ("== Tags\n\n" "=== \\[\\[t_tag1\\]\\]tag1\n\n" "\\* xref:dt_1970-01-01T\\d{2}:\\d{2}:\\d{2}" - "\\[Nice title\\]\n\n"); + "\\[Nice title\\] _\\(1970-01-01\\)_\n\n"); for (const regex &re : { re_header, re_dates, re_tags }) {