@@ -5,7 +5,7 @@ def dbg($label; $value):
55 | (($label + ": " + ($value | tojson )) | debug ) # prints to stderr
66 | $in ; # return original value
77
8- def nonBlankKey ($keyName ):
8+ def nonBlankKey ($keyName ):
99 has ($keyName ) and (. [$keyName ] | tostring | length >= 1 );
1010
1111def blankKey ($keyName ):
@@ -23,21 +23,21 @@ def raise_issued_date_parts:
2323def pad2 : tostring | if length == 1 then "0" +. else . end ;
2424
2525def issued_iso_string :
26- if nonBlankKey ("issued" ) and (.issued | nonBlankKey ("date-parts" )) then
27- setpath (["isoDateString" ];
26+ if nonBlankKey ("issued" ) and (.issued | nonBlankKey ("date-parts" )) then
27+ setpath (["isoDateString" ];
2828 (.issued ["date-parts" ][0 ]) as $p | ($p [0 ]| tostring ) + "-" + (($p [1 ]? // 1 )| pad2 ) + "-" + (($p [2 ]? // 1 )| pad2 ))
29- else
30- .
29+ else
30+ .
3131 end ;
3232
3333def issued_date_readable :
34- if nonBlankKey ("issued" ) and (.issued | nonBlankKey ("date-parts" )) then
35- setpath (["readableDateString" ];
34+ if nonBlankKey ("issued" ) and (.issued | nonBlankKey ("date-parts" )) then
35+ setpath (["readableDateString" ];
3636 (.issued ["date-parts" ][0 ]) as $p | $p | map (pad2 ) | join ("-" ))
37- else
38- .
37+ else
38+ .
3939 end ;
40-
40+
4141def format_person_name :
4242 if (has ("family" ) and .family != null and (.family | tostring | length )> 0 ) then
4343 .family
@@ -65,7 +65,7 @@ def author_string_list:
6565# If you want the field added into each item:
6666def add_author_string :
6767 if (.author ) then . + { authorsFormatted : (author_string_list ) } end ;
68-
68+
6969# Likewise for editors
7070def editor_string_list :
7171 ( .editor // [] )
0 commit comments