diff --git a/asl_rulebook2/extract/content.py b/asl_rulebook2/extract/content.py index ba2fe95..be2ca8d 100755 --- a/asl_rulebook2/extract/content.py +++ b/asl_rulebook2/extract/content.py @@ -29,11 +29,12 @@ _DISABLE_SORT_ITEMS = [ "E28", "E29", "E30", # Chapter E footnotes "F20", "F21", # Chapter F footnotes "G48", "G49", "G50", # Chapter G footnotes + "H9", # Chapter H footnotes ] _DEFAULT_ARGS = { "chapter-a": "42-102", "chapter-b": "109-154", "chapter-c": "158-183", "chapter-d": "187-213", - "chapter-e": "216-245", "chapter-f": "247-267", "chapter-g": "270-319", + "chapter-e": "216-245", "chapter-f": "247-267", "chapter-g": "270-319", "chapter-h": "322-324,326-330", "chapter-j": "593", "chapter-w": "647-664", "content_vp_left": 0, "content_vp_right": 565, "content_vp_top": 715, "content_vp_bottom": 28, # viewport @@ -95,6 +96,8 @@ class ExtractContent( ExtractBase ): break if page_no not in page_index: self.log_msg( "progress", "- Skipping page {}.", page_no ) + if curr_chapter_pageno is not None: + curr_chapter_pageno += 1 continue if not self._curr_chapter or self._curr_chapter != page_index[page_no]: # we've found the start of a new chapter @@ -289,7 +292,7 @@ class ExtractContent( ExtractBase ): else: self._curr_footnote[1] += elem.get_text() - def _save_footnote( self ): + def _save_footnote( self ): #pylint: disable=too-many-branches """Save a parsed footnote.""" if not self._curr_footnote: @@ -331,6 +334,11 @@ class ExtractContent( ExtractBase ): if footnote_id == "9" and "9" in footnote_ids: footnote_id = "29" + # check if we've gone past the end of the Chapter H footnotes + if self._curr_chapter == "H" and len(footnote_id) > 1: + self._curr_footnote = None + return + # clean up the content content = re.sub( r"\s+", " ", content ).strip() content = fixup_text( content ) @@ -388,9 +396,15 @@ class ExtractContent( ExtractBase ): ) # check for the credits at the end of the Chapter F footnotes - pos = content.find( "WEST OF ALAMEIN CREDITS" ) - if pos > 0: - content = content[:pos] + if self._curr_chapter == "F": + pos = content.find( "WEST OF ALAMEIN CREDITS" ) + if pos > 0: + content = content[:pos] + # check for the start of the vehicle notes at the end of the Chapter H footnotes + if self._curr_chapter == "H": + pos = content.find( "GERMAN VEHICLE NOTES" ) + if pos > 0: + content = content[:pos] # save the footnote self._footnotes[ self._curr_chapter ].append( { diff --git a/asl_rulebook2/extract/data/chapter-fixups.json b/asl_rulebook2/extract/data/chapter-fixups.json index ed1cfb3..23e465e 100644 --- a/asl_rulebook2/extract/data/chapter-fixups.json +++ b/asl_rulebook2/extract/data/chapter-fixups.json @@ -8,13 +8,14 @@ "E": "Miscellaneous", "F": "North Africa", "G": "Pacific Theater", + "H": "Design Your Own", "J": "Deluxe ASL", "W": "Korean War" }, "_comment_": "Section titles are all-caps, and are converted to normal-caps during extraction. This table specifies words that actually should be all-caps.", "capitalize_words": [ - "LOS", "SW", "CC", "SMOKE", + "LOS", "SW", "CC", "SMOKE", "OB", "OBA", "TH#", "TK#", "DRM", "RCL", "LATW", "AFV", "OVR", "DD", "ASL", diff --git a/asl_rulebook2/extract/data/footnote-fixups.json b/asl_rulebook2/extract/data/footnote-fixups.json index d740a6c..fff1ca8 100644 --- a/asl_rulebook2/extract/data/footnote-fixups.json +++ b/asl_rulebook2/extract/data/footnote-fixups.json @@ -169,6 +169,12 @@ }, +"H": { + "4": [ + [ "ASLgame system.", "ASL game system." ] + ] +}, + "W": { "2": [ diff --git a/asl_rulebook2/extract/data/target-fixups.json b/asl_rulebook2/extract/data/target-fixups.json index 5b7b0df..7515bcc 100644 --- a/asl_rulebook2/extract/data/target-fixups.json +++ b/asl_rulebook2/extract/data/target-fixups.json @@ -397,6 +397,48 @@ "55": { "new_ruleid": null } }, +"H2": { + "1.25": { + "new_ruleid": "H1.25", + "new_caption": "MOL" + } +}, + +"H3": { + "1.46OBSERVATIONPOST(OP)TANKS:": { + "new_ruleid": "H1.46", + "new_caption": "OBSERVATION POST (OP) TANKS" + } +}, + +"H6": { + "10": { "new_ruleid": null, "instances": 2 }, + "11": { "new_ruleid": null, "instances": 2 }, + "12": { "new_ruleid": null, "instances": 2 }, + "1.531 AIRSUPPORT:": { + "new_ruleid": "H1.531", + "new_caption": "AIR SUPPORT" + } +}, + +"H7": { + "1.71BONUSINFANTRY:": { + "new_ruleid": "H1.71", + "new_caption": "BONUS INFANTRY" + } +}, + +"H8": { + "22 LMGMMGHMGATRLT. MTRPSKFTDC": { "new_ruleid": null }, + "422 LMGMMGHMG.50cal ATRLT. MTRFTDC": { "new_ruleid": null }, + "1 GERMAN SW ALLOTMENT CHART": { "new_ruleid": null }, + "1,3 RUSSIAN SW ALLOTMENT CHART": { "new_ruleid": null }, + "1.84REINFORCEMENTLEADERS/SW:": { + "new_ruleid": "H1.84", + "new_caption": "REINFORCEMENT LEADERS/SW" + } +}, + "J1": { "1.MINIATURES:": { "new_ruleid": null } }, diff --git a/asl_rulebook2/webapp/data/chapters/H-background.png b/asl_rulebook2/webapp/data/chapters/H-background.png index 4678ea2..5afa409 100644 Binary files a/asl_rulebook2/webapp/data/chapters/H-background.png and b/asl_rulebook2/webapp/data/chapters/H-background.png differ diff --git a/asl_rulebook2/webapp/static/css/chapters.css b/asl_rulebook2/webapp/static/css/chapters.css index 58b441f..e629a7f 100644 --- a/asl_rulebook2/webapp/static/css/chapters.css +++ b/asl_rulebook2/webapp/static/css/chapters.css @@ -5,6 +5,7 @@ .chapter-e { border: 1px solid #9ad0e9 !important ; } .chapter-f { border: 1px solid #b4965f !important ; } .chapter-g { border: 1px solid #c6cf21 !important ; } +.chapter-h { border: 1px solid #f3a954 !important ; } .chapter-j { border: 1px solid #6e7723 !important ; } .chapter-w { border: 1px solid #ad965d !important ; } diff --git a/doc/features/images/chapters-extended.png b/doc/features/images/chapters-extended.png index 281e702..f788acd 100644 Binary files a/doc/features/images/chapters-extended.png and b/doc/features/images/chapters-extended.png differ diff --git a/doc/features/images/chapters.png b/doc/features/images/chapters.png index a04b324..f464f2e 100644 Binary files a/doc/features/images/chapters.png and b/doc/features/images/chapters.png differ diff --git a/doc/features/index.html b/doc/features/index.html index 7f8f74b..c8863c2 100644 --- a/doc/features/index.html +++ b/doc/features/index.html @@ -20,7 +20,7 @@

And if the rule has any associated footnotes, these will be shown in a popup.

You can also browse the ASLRB by chapter:
- +