@@ -10,6 +10,12 @@ const zip =
1010 keys . reduce ( ( o , k , i ) =>
1111 ( o [ k ] = values [ i ] , o ) , { } ) ;
1212
13+ // Convert US date to date object
14+ // e.g. "06/30/2020" -> {year: "2020", month: "06", day: "30"}
15+ const from_mdy =
16+ str =>
17+ zip ( [ 'month' , 'day' , 'year' ] , str . split ( '/' ) ) ;
18+
1319const processName = ( name ) => {
1420 const initialsRegex = / (?: [ a - z A - Z ] \. ) + /
1521 const [ part1 , part2 = '' , part3 = '' ] = name . split ( ',' ) . map ( s => s . trim ( ) ) ;
@@ -54,6 +60,7 @@ var grammar = {
5460 { "name" : "entry" , "symbols" : [ "personEntry" ] , "postprocess" : id } ,
5561 { "name" : "entry" , "symbols" : [ "urlEntry" ] , "postprocess" : id } ,
5662 { "name" : "entry" , "symbols" : [ "dateaccessEntry" ] , "postprocess" : id } ,
63+ { "name" : "entry" , "symbols" : [ "reprintEntry" ] , "postprocess" : id } ,
5764 { "name" : "entry" , "symbols" : [ "otherEntry" ] , "postprocess" : id } ,
5865 { "name" : "personEntry" , "symbols" : [ ( lexer . has ( "person" ) ? { type : "person" } : person ) , ( lexer . has ( "sep" ) ? { type : "sep" } : sep ) , "value" ] , "postprocess" : ( [ { value : key } , , name ] ) => ( { key, value : processName ( name ) } ) } ,
5966 { "name" : "urlEntry$ebnf$1" , "symbols" : [ "value" ] } ,
@@ -67,6 +74,12 @@ var grammar = {
6774 { "name" : "dateaccessEntry" , "symbols" : [ ( lexer . has ( "dateaccess" ) ? { type : "dateaccess" } : dateaccess ) , ( lexer . has ( "sep" ) ? { type : "sep" } : sep ) , "dateaccessEntry$ebnf$1" ] , "postprocess" : ( [ { value : key } , /*sep (ignored)*/ , lines ] ) =>
6875 ( { key
6976 , value : processUrls ( lines . join ( '' ) ) } ) } ,
77+ { "name" : "reprintEntry" , "symbols" : [ ( lexer . has ( "reprint" ) ? { type : "reprint" } : reprint ) , ( lexer . has ( "sep" ) ? { type : "sep" } : sep ) , "value" ] , "postprocess" : ( [ { value : key } , /*sep (ignored)*/ , value ] ) =>
78+ ( { key
79+ , value : ( ( value === 'IN FILE' || value === 'NOT IN FILE' )
80+ ? { status : value }
81+ : { status : 'ON REQUEST'
82+ , date : from_mdy ( value . match ( / \d { 2 } \/ \d { 2 } \/ \d { 4 } / ) [ 0 ] ) } ) } ) } ,
7083 { "name" : "otherEntry$ebnf$1" , "symbols" : [ "value" ] } ,
7184 { "name" : "otherEntry$ebnf$1" , "symbols" : [ "otherEntry$ebnf$1" , "value" ] , "postprocess" : function arrpush ( d ) { return d [ 0 ] . concat ( [ d [ 1 ] ] ) ; } } ,
7285 { "name" : "otherEntry" , "symbols" : [ ( lexer . has ( "tag" ) ? { type : "tag" } : tag ) , ( lexer . has ( "sep" ) ? { type : "sep" } : sep ) , "otherEntry$ebnf$1" ] , "postprocess" : ( [ { value : key } , , value ] ) => ( { key, value : value . join ( ' ' ) } ) } ,
0 commit comments