Skip to content

Commit

Permalink
Merge pull request #411 from openzim/longdescription-non-mandatory
Browse files Browse the repository at this point in the history
--longDescription is not mandatory
  • Loading branch information
kelson42 authored Jun 2, 2024
2 parents 663b9ca + 88cf916 commit d6c6a1b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
5 changes: 3 additions & 2 deletions src/metadata_constraints.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ const Metadata::ReservedMetadataTable reservedMetadataInfoTable = {

METADATA_ASSERT("LongDescription shouldn't be shorter than Description")
{
return !data.has("LongDescription")
|| data["LongDescription"].size() >= data["Description"].size();
return !data.has("LongDescription") ||
data["LongDescription"].size() == 0 ||
data["LongDescription"].size() >= data["Description"].size();
}
8 changes: 5 additions & 3 deletions src/zimwriterfs/zimwriterfs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,12 @@ bool thereAreMissingArguments()
return false;

return creator.empty()
|| name.empty()
|| publisher.empty()
|| description.empty()
|| language.empty()
|| welcome.empty()
|| title.empty()
|| illustration.empty();
}

Expand Down Expand Up @@ -186,8 +188,6 @@ void usage()
std::cout << "\t-t, --title\t\ttitle of the ZIM file" << std::endl;
std::cout << "\t-d, --description\tshort description of the content"
<< std::endl;
std::cout << "\t-L, --longDescription\tlong description of the content"
<< std::endl;
std::cout << "\t-c, --creator\t\tcreator(s) of the content" << std::endl;
std::cout << "\t-p, --publisher\t\tcreator of the ZIM file itself"
<< std::endl;
Expand All @@ -204,6 +204,8 @@ void usage()
<< std::endl;
std::cout << "\t-h, --help\t\tprint this help" << std::endl;
std::cout << "\t-V, --version\t\tprint the version number" << std::endl;
std::cout << "\t-L, --longDescription\tlong description of the content"
<< std::endl;
std::cout
<< "\t-m, --clusterSize\tnumber of bytes per ZIM cluster (default: 2048Kb)"
<< std::endl;
Expand Down Expand Up @@ -283,7 +285,7 @@ void parse_args(int argc, char** argv)

do {
c = getopt_long(
argc, argv, "ahVvijxuw:I:t:d:c:l:p:r:e:n:m:J:UBL:", long_options, &option_index);
argc, argv, "a:hVvijxuw:I:t:d:c:l:p:r:e:n:m:J:UBL:", long_options, &option_index);

if (c != -1) {
switch (c) {
Expand Down

0 comments on commit d6c6a1b

Please sign in to comment.