mirror of
https://github.com/qpdf/qpdf.git
synced 2024-05-29 16:30:53 +00:00
Fix typo in json output key name
moddify -> modify. Also carefully spell checked all remaining keys by splitting them into words and running a spell checker, not just relying on visual proofreading. That was the only one.
This commit is contained in:
parent
1bc8abfdd3
commit
15272662f6
2
TODO
2
TODO
|
@ -61,8 +61,6 @@ General things to remember:
|
||||||
* The choices for json_key (job.yml) will be different for v1 and v2.
|
* The choices for json_key (job.yml) will be different for v1 and v2.
|
||||||
That information is already duplicated in multiple places.
|
That information is already duplicated in multiple places.
|
||||||
|
|
||||||
* Remember typo: search for "Typo" In QPDFJob::doJSONEncrypt.
|
|
||||||
|
|
||||||
* Test stream with invalid data
|
* Test stream with invalid data
|
||||||
|
|
||||||
* Consider using camelCase in multi-word key names to be consistent
|
* Consider using camelCase in multi-word key names to be consistent
|
||||||
|
|
|
@ -445,7 +445,7 @@ class QPDFJob
|
||||||
|
|
||||||
// Helper functions
|
// Helper functions
|
||||||
static void usage(std::string const& msg);
|
static void usage(std::string const& msg);
|
||||||
static JSON json_schema(std::set<std::string>* keys = 0);
|
static JSON json_schema(int json_version, std::set<std::string>* keys = 0);
|
||||||
static void parse_object_id(
|
static void parse_object_id(
|
||||||
std::string const& objspec, bool& trailer, int& obj, int& gen);
|
std::string const& objspec, bool& trailer, int& obj, int& gen);
|
||||||
void parseRotationParameter(std::string const&);
|
void parseRotationParameter(std::string const&);
|
||||||
|
|
|
@ -1374,10 +1374,12 @@ QPDFJob::doJSONEncrypt(Pipeline* p, bool& first, QPDF& pdf)
|
||||||
"modifyassembly", JSON::makeBool(pdf.allowModifyAssembly()));
|
"modifyassembly", JSON::makeBool(pdf.allowModifyAssembly()));
|
||||||
j_capabilities.addDictionaryMember(
|
j_capabilities.addDictionaryMember(
|
||||||
"modifyforms", JSON::makeBool(pdf.allowModifyForm()));
|
"modifyforms", JSON::makeBool(pdf.allowModifyForm()));
|
||||||
// Typo will be fixed for json v2
|
|
||||||
/* cSpell:ignore moddifyannotations */
|
/* cSpell:ignore moddifyannotations */
|
||||||
|
std::string MODIFY_ANNOTATIONS =
|
||||||
|
(this->m->json_version == 1 ? "moddifyannotations"
|
||||||
|
: "modifyannotations");
|
||||||
j_capabilities.addDictionaryMember(
|
j_capabilities.addDictionaryMember(
|
||||||
"moddifyannotations", JSON::makeBool(pdf.allowModifyAnnotation()));
|
MODIFY_ANNOTATIONS, JSON::makeBool(pdf.allowModifyAnnotation()));
|
||||||
j_capabilities.addDictionaryMember(
|
j_capabilities.addDictionaryMember(
|
||||||
"modifyother", JSON::makeBool(pdf.allowModifyOther()));
|
"modifyother", JSON::makeBool(pdf.allowModifyOther()));
|
||||||
j_capabilities.addDictionaryMember(
|
j_capabilities.addDictionaryMember(
|
||||||
|
@ -1448,7 +1450,7 @@ QPDFJob::doJSONAttachments(Pipeline* p, bool& first, QPDF& pdf)
|
||||||
}
|
}
|
||||||
|
|
||||||
JSON
|
JSON
|
||||||
QPDFJob::json_schema(std::set<std::string>* keys)
|
QPDFJob::json_schema(int json_version, std::set<std::string>* keys)
|
||||||
{
|
{
|
||||||
// Style: use all lower-case keys with no dashes or underscores.
|
// Style: use all lower-case keys with no dashes or underscores.
|
||||||
// Choose array or dictionary based on indexing. For example, we
|
// Choose array or dictionary based on indexing. For example, we
|
||||||
|
@ -1585,12 +1587,14 @@ QPDFJob::json_schema(std::set<std::string>* keys)
|
||||||
"needappearances": "whether the form fields' appearance streams need to be regenerated"
|
"needappearances": "whether the form fields' appearance streams need to be regenerated"
|
||||||
})"));
|
})"));
|
||||||
}
|
}
|
||||||
|
std::string MODIFY_ANNOTATIONS =
|
||||||
|
(json_version == 1 ? "moddifyannotations" : "modifyannotations");
|
||||||
if (all_keys || keys->count("encrypt")) {
|
if (all_keys || keys->count("encrypt")) {
|
||||||
JSON encrypt = schema.addDictionaryMember("encrypt", JSON::parse(R"({
|
JSON encrypt = schema.addDictionaryMember("encrypt", JSON::parse(R"({
|
||||||
"capabilities": {
|
"capabilities": {
|
||||||
"accessibility": "allow extraction for accessibility?",
|
"accessibility": "allow extraction for accessibility?",
|
||||||
"extract": "allow extraction?",
|
"extract": "allow extraction?",
|
||||||
"moddifyannotations": "allow modifying annotations?",
|
")" + MODIFY_ANNOTATIONS + R"(": "allow modifying annotations?",
|
||||||
"modify": "allow all modifications?",
|
"modify": "allow all modifications?",
|
||||||
"modifyassembly": "allow modifying document assembly?",
|
"modifyassembly": "allow modifying document assembly?",
|
||||||
"modifyforms": "allow modifying forms?",
|
"modifyforms": "allow modifying forms?",
|
||||||
|
@ -1630,7 +1634,7 @@ QPDFJob::json_schema(std::set<std::string>* keys)
|
||||||
std::string
|
std::string
|
||||||
QPDFJob::json_out_schema_v1()
|
QPDFJob::json_out_schema_v1()
|
||||||
{
|
{
|
||||||
return json_schema().unparse();
|
return json_schema(1).unparse();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -1717,7 +1721,7 @@ QPDFJob::doJSON(QPDF& pdf, Pipeline* p)
|
||||||
|
|
||||||
if (this->m->test_json_schema) {
|
if (this->m->test_json_schema) {
|
||||||
// Check against schema
|
// Check against schema
|
||||||
JSON schema = json_schema(&m->json_keys);
|
JSON schema = json_schema(this->m->json_version, &m->json_keys);
|
||||||
std::list<std::string> errors;
|
std::list<std::string> errors;
|
||||||
JSON captured = JSON::parse(captured_json);
|
JSON captured = JSON::parse(captured_json);
|
||||||
if (!captured.checkSchema(schema, errors)) {
|
if (!captured.checkSchema(schema, errors)) {
|
||||||
|
|
|
@ -4306,8 +4306,8 @@ foreach my $d (@encrypted_files)
|
||||||
$enc_json .=
|
$enc_json .=
|
||||||
" \"accessibility\": " . &$jf($accessible) . ",\n" .
|
" \"accessibility\": " . &$jf($accessible) . ",\n" .
|
||||||
" \"extract\": " . &$jf($extract) . ",\n" .
|
" \"extract\": " . &$jf($extract) . ",\n" .
|
||||||
" \"moddifyannotations\": " . &$jf($modifyannot) . ",\n" .
|
|
||||||
" \"modify\": " . &$jf($modifyall) . ",\n" .
|
" \"modify\": " . &$jf($modifyall) . ",\n" .
|
||||||
|
" \"modifyannotations\": " . &$jf($modifyannot) . ",\n" .
|
||||||
" \"modifyassembly\": " . &$jf($modifyassembly) . ",\n" .
|
" \"modifyassembly\": " . &$jf($modifyassembly) . ",\n" .
|
||||||
" \"modifyforms\": " . &$jf($modifyform) . ",\n" .
|
" \"modifyforms\": " . &$jf($modifyform) . ",\n" .
|
||||||
" \"modifyother\": " . &$jf($modifyother) . ",\n" .
|
" \"modifyother\": " . &$jf($modifyother) . ",\n" .
|
||||||
|
|
Loading…
Reference in New Issue
Block a user