4040import sys
4141import time
4242
43- version = "0.29 "
43+ version = "0.30 "
4444program = os .path .basename (sys .argv [0 ])
4545progdir = os .path .dirname (sys .argv [0 ])
4646
@@ -280,12 +280,12 @@ def get_creation_date(self):
280280 if self ._creation_date :
281281 return self ._creation_date
282282 date_regexes = [
283- r'^(?P<month>\w+)\s+(?P<day>\d{1,2}),?\s +(?P<year>\d{4})' ,
284- r'^(?P<day>\d{1,2}),?\s +(?P<month>\w+)\s+(?P<year>\d{4})' ,
283+ r'^(?P<month>\w+)\s+(?P<day>\d{1,2})(,|\s) +(?P<year>\d{4})' ,
284+ r'^(?P<day>\d{1,2})(,|\s) +(?P<month>\w+)\s+(?P<year>\d{4})' ,
285285 r'^(?P<day>\d{1,2})-(?P<month>\w+)-(?P<year>\d{4})' ,
286286 r'^(?P<month>\w+)\s+(?P<year>\d{4})' ,
287- r'\s{3,}(?P<month>\w+)\s+(?P<day>\d{1,2}),?\s +(?P<year>\d{4})' ,
288- r'\s{3,}(?P<day>\d{1,2}),?\s +(?P<month>\w+)\s+(?P<year>\d{4})' ,
287+ r'\s{3,}(?P<month>\w+)\s+(?P<day>\d{1,2})(,|\s) +(?P<year>\d{4})' ,
288+ r'\s{3,}(?P<day>\d{1,2})(,|\s) +(?P<month>\w+)\s+(?P<year>\d{4})' ,
289289 r'\s{3,}(?P<day>\d{1,2})-(?P<month>\w+)-(?P<year>\d{4})' ,
290290 # 'October 2008' - default day to today's.
291291 r'\s{3,}(?P<month>\w+)\s+(?P<year>\d{4})' ,
@@ -886,6 +886,7 @@ def get_refs(self):
886886 refs = []
887887 normrefs = []
888888 rfcrefs = []
889+ draftrefs = []
889890 refline = None
890891 for i in range (len (self .lines )- 1 , 15 , - 1 ):
891892 if re .search (r"(?i)^ *[0-9.]+ *(((normative|informative|informational|non-normative) )?references|references\W+(normative|informative))" , self .lines [i ]):
@@ -910,15 +911,17 @@ def get_refs(self):
910911 refs += [ para ]
911912 rfc_match = re .search ("(?i)rfc ?\d+" , para )
912913 if rfc_match :
913- rfc = rfc_match .group (0 ).replace (" " ,"" ).lower ()
914- rfcrefs += [ rfc ]
914+ rfcrefs += [ rfc_match .group (0 ).replace (" " ,"" ).lower () ]
915+ draft_match = re .search ("draft-[a-z0-9-]+" , para )
916+ if draft_match :
917+ draftrefs += [ draft_match .group (0 ).lower () ]
915918 normrefs = list (set (normrefs ))
916919 normrefs .sort ()
917920 rfcrefs = list (set (rfcrefs ))
918921 rfcrefs .sort ()
919922 refs = list (set (refs ))
920923 refs .sort ()
921- return normrefs , rfcrefs , refs
924+ return normrefs , rfcrefs , draftrefs , refs
922925
923926# ----------------------------------------------------------------------
924927
@@ -977,8 +980,9 @@ def getmeta(fn):
977980 fields ["docaffiliations" ] = ", " .join (draft .get_authors_with_firm ())
978981 if opt_debug :
979982 fields ["docheader" ] = draft ._docheader
980- normrefs , rfcrefs , refs = draft .get_refs ()
983+ normrefs , rfcrefs , draftrefs , refs = draft .get_refs ()
981984 fields ["docrfcrefs" ] = ", " .join (rfcrefs )
985+ fields ["docdraftrefs" ] = ", " .join (draftrefs )
982986 fields ["doccreationdate" ] = str (draft .get_creation_date ())
983987 deststatus = draft .get_status ()
984988 if deststatus :
0 commit comments