Change website scripts to use jstrencode
After the swap in the jparse repo of jstrencode and jstrdecode, due to mix-up in terminology, originally in the mkiocccentry repo, the website tools that used jstrdecode now have to use jstrencode, with a minimum version of 2.0.0. The scripts have been updated to do this. After doing a make install from the jparse repo I did a make www with no html files changed. Then doing the same thing after make install from the mkiocccentry/jparse directory, no changes were made either, indicating that all should be okay. The bin/index.html was however modified to refer to jstrencode, not jstrdecode.
This commit is contained in:
1 parent
184cc9be9a
commit
e58bd97211
11 files changed
+131
-131
No files matched your search
+13
-13
@@ -302,17 +302,17 @@ within_manifest_array == 1 && begin_manifest_element == 1 && NF >= 3 && $1 ~ /^"
|
||||
|
||||
# so we can single quote the entry_text as a single string, we protect any single quotes within it
|
||||
#
|
||||
jstrdecode_arg = entry_text;
|
||||
gsub(/'/, "'\"'\"'", jstrdecode_arg);
|
||||
jstrencode_arg = entry_text;
|
||||
gsub(/'/, "'\"'\"'", jstrencode_arg);
|
||||
|
||||
# form the jstrdecode command
|
||||
# form the jstrencode command
|
||||
#
|
||||
if (jstrdecode_arg ~ /^".*"$/) {
|
||||
jstrdecode_cmd = "jstrdecode -Q -- " "'" substr(jstrdecode_arg, 2, length(jstrdecode_arg)-2) "'";
|
||||
if (jstrencode_arg ~ /^".*"$/) {
|
||||
jstrencode_cmd = "jstrencode -Q -- " "'" substr(jstrencode_arg, 2, length(jstrencode_arg)-2) "'";
|
||||
} else {
|
||||
jstrdecode_cmd = "jstrdecode -Q -- " "'" jstrdecode_arg "'";
|
||||
jstrencode_cmd = "jstrencode -Q -- " "'" jstrencode_arg "'";
|
||||
}
|
||||
jstrdecode_cmd = jstrdecode_cmd " 2>/dev/null; echo $?";
|
||||
jstrencode_cmd = jstrencode_cmd " 2>/dev/null; echo $?";
|
||||
|
||||
# JSON decode entry_text
|
||||
#
|
||||
@@ -320,21 +320,21 @@ within_manifest_array == 1 && begin_manifest_element == 1 && NF >= 3 && $1 ~ /^"
|
||||
result = "";
|
||||
exit_code = 0;
|
||||
# process each pipe line
|
||||
while ((jstrdecode_cmd | getline pipe_output) > 0) {
|
||||
while ((jstrencode_cmd | getline pipe_output) > 0) {
|
||||
if (numLines++ == 0) {
|
||||
# case: 1st line is from jstrdecode
|
||||
# case: 1st line is from jstrencode
|
||||
result = pipe_output;
|
||||
} else {
|
||||
# case: 2nd/line line is the jstrdecode exit code
|
||||
# case: 2nd/line line is the jstrencode exit code
|
||||
exit_code = pipe_output;
|
||||
}
|
||||
}
|
||||
close(jstrdecode_cmd);
|
||||
close(jstrencode_cmd);
|
||||
|
||||
# validate exit code from jstrdecode
|
||||
# validate exit code from jstrencode
|
||||
#
|
||||
if (length(exit_code) == 0 || exit_code != 0) {
|
||||
print "ERROR: unable to jstrdecode entry_text:", entry_text > "/dev/stderr";
|
||||
print "ERROR: unable to jstrencode entry_text:", entry_text > "/dev/stderr";
|
||||
exit 213; # END section will output ERROR message about cannot JSON decode entry_text
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user