Merge branch 'develop' into main
continuous-integration/drone/push Build is passing Details

This commit is contained in:
tastytea 2019-09-23 21:56:40 +02:00
commit a414b998f0
Signed by: tastytea
GPG Key ID: CFC39497F1B26E07
5 changed files with 29 additions and 23 deletions

View File

@ -1,4 +1,5 @@
:project: remwharead :project: remwharead
:patch_contact: tastytea@tastytea.de
== How to contribute == How to contribute
@ -20,3 +21,6 @@ account.
Please use similar coding conventions as the rest of the project. The basic rule Please use similar coding conventions as the rest of the project. The basic rule
to remember is to write code in the same style as the existing/surrounding code. to remember is to write code in the same style as the existing/surrounding code.
You can also send me your patches via email, to {patch_contact} (ideally using
`git format-patch` or `git send-email`).

View File

@ -2,7 +2,7 @@
:doctype: manpage :doctype: manpage
:Author: tastytea :Author: tastytea
:Email: tastytea@tastytea.de :Email: tastytea@tastytea.de
:Date: 2019-09-21 :Date: 2019-09-23
:Revision: 0.0.0 :Revision: 0.0.0
:man source: remwharead :man source: remwharead
:man manual: General Commands Manual :man manual: General Commands Manual
@ -129,8 +129,7 @@ HTML, PDF and many other formats.
=== bookmarks === bookmarks
The The https://msdn.microsoft.com/en-us/library/aa753582(VS.85).aspx[Netscape
https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/platform-apis/aa753582(v=vs.85)[Netscape
Bookmark file format] is a format for exporting and importing bookmarks that is Bookmark file format] is a format for exporting and importing bookmarks that is
understood by most browsers. understood by most browsers.

View File

@ -86,6 +86,7 @@ int App::main(const std::vector<std::string> &args)
cerr << page.error << endl; cerr << page.error << endl;
return 3; return 3;
} }
archive_answer archive; archive_answer archive;
if (_archive) if (_archive)
{ {

View File

@ -52,7 +52,7 @@ void App::defineOptions(OptionSet& options)
.argument("tags") .argument("tags")
.callback(OptionCallback<App>(this, &App::handle_options))); .callback(OptionCallback<App>(this, &App::handle_options)));
options.addOption( options.addOption(
Option("export", "e", "Export to format.") Option("export", "e", "Export to format. See manpage for a list.")
.argument("format") .argument("format")
.callback(OptionCallback<App>(this, &App::handle_options))); .callback(OptionCallback<App>(this, &App::handle_options)));
options.addOption( options.addOption(

View File

@ -183,25 +183,27 @@ namespace remwharead
_out << "== Tags\n\n"; _out << "== Tags\n\n";
vector<tagpair> sortedtags(tags.size()); vector<tagpair> sortedtags(tags.size());
std::move(tags.begin(), tags.end(), sortedtags.begin()); std::move(tags.begin(), tags.end(), sortedtags.begin());
std::sort(sortedtags.begin(), sortedtags.end(),
[](const tagpair &a, tagpair &b) const auto compare_tags =
{ [](const tagpair &a, tagpair &b)
if (a.second.size() != b.second.size()) {
{ // Sort by number of occurrences if they are different. if (a.second.size() != b.second.size())
return a.second.size() > b.second.size(); { // Sort by number of occurrences if they are different.
} return a.second.size() > b.second.size();
else }
{ // Sort by tag names otherwise. else
std::locale loc; { // Sort by tag names otherwise.
const std::collate<char> &coll = const std::locale loc;
std::use_facet<std::collate<char>>(loc); const std::collate<char> &coll =
return (coll.compare( std::use_facet<std::collate<char>>(loc);
a.first.data(), a.first.data() return (
+ a.first.length(), coll.compare(
b.first.data(), b.first.data() a.first.data(), a.first.data() + a.first.length(),
+ b.first.length()) == -1); b.first.data(), b.first.data() + b.first.length())
} == -1);
}); }
};
std::sort(sortedtags.begin(), sortedtags.end(), compare_tags);
bool othertags = false; // Have we printed “Less used tags” already? bool othertags = false; // Have we printed “Less used tags” already?
for (const auto &tag : sortedtags) for (const auto &tag : sortedtags)