AsciiDoc export: Group tags only if there are more than 20.

This commit is contained in:
tastytea 2019-06-06 16:59:45 +02:00
parent 17b33eacbf
commit 8ff0d39927
Signed by: tastytea
GPG Key ID: CFC39497F1B26E07
2 changed files with 5 additions and 4 deletions

View File

@ -188,10 +188,12 @@ void Export::AsciiDoc::print_tags(const tagmap &tags) const
}
});
bool othertags = false;
bool othertags = false; // Have we printed “Less used tags” already?
for (const auto &tag : sortedtags)
{
if (tag.second.size() == 1)
// If we have more than 20 tags, group all tags that occur only 1 time
// under the section “Less used tags”.
if (sortedtags.size() > 20 && tag.second.size() == 1)
{
if (!othertags)
{

View File

@ -65,8 +65,7 @@ SCENARIO ("The AsciiDoc export works correctly")
"Good description\\.\n");
const regex re_tags
("== Tags\n\n"
"=== Less used tags\n\n"
"==== \\[\\[t_tag1\\]\\]tag1\n\n"
"=== \\[\\[t_tag1\\]\\]tag1\n\n"
"\\* xref:dt_1970-01-01T\\d{2}:\\d{2}:\\d{2}"
"\\[Nice title\\] _\\(1970-01-01\\)_\n\n");