DeepBlueCLtd / LegacyMan

Legacy content for Field Service Manual
https://deepbluecltd.github.io/LegacyMan/index.html
Apache License 2.0
2 stars 0 forks source link

Store link tracker dict in link_tracker.json and use later + CLI arg parsing improvements #559

Closed robintw closed 9 months ago

robintw commented 9 months ago

This PR includes two main changes:

usage: lman_parser.py [OPTION] DATA_PATH [LOGGING_LEVEL]

positional arguments:
  DATA_PATH             Path to the source data
  LOGGING_LEVEL         Debug level - must be one of debug, warning or info

options:
  -h, --help            show this help message and exit
  --skip-first-run, --no-skip-first-run
                        Skip Run 1, loading the shopping list from the link_tracker.json file
  --warn-on-blank-runs, --no-warn-on-blank-runs
                        Print warning messages whenever runs of blank paragraphs are found

This includes two new options:

Both of these options are off by default, and are turned on by providing that command-line switch.

This PR makes running for single files work properly for the first time (we don't have to use nasty hacks now we're using the link_tracker.json file), and should enable clearing up the output (by removing blank tags warnings unless we turn them on) and speedier iteration (by skipping the first run when requested).

Happy to change the name of any of the CLI params if you want - just let me know.

robintw commented 9 months ago

Fixes #557

IanMayo commented 9 months ago

Thanks @robintw . So, --skip-first-run controls the behaviour of lman-parser, but the single file converter always skips first run, right?

robintw commented 9 months ago

Did you mean to close this @IanMayo - or did you mean to merge it?

robintw commented 9 months ago

And yes, --skip-first-run controls the behaviour of the main parser. Skipping the first run is always done in the single file parser (the content tester is completely separate and doesn't do any of these runs)

IanMayo commented 9 months ago

Did you mean to close this @IanMayo - or did you mean to merge it?

oops. Merging...

IanMayo commented 9 months ago

(the content tester is completely separate and doesn't do any of these runs)

Oops, I meant to refer to the single file converter, not the content tester.

IanMayo commented 9 months ago

Can I ask for one small extension please @robintw ?

Could we introduce a --skip-validation step?

The validation step hasn't reported errors for a couple of weeks, I don't need to run it every time.

robintw commented 9 months ago

Would it be better to have a --run-validation argument then? So by default it doesn't run, but you can tell it to run the validation?

IanMayo commented 9 months ago

Would it be better to have a --run-validation argument then? So by default it doesn't run, but you can tell it to run the validation?

(sorry for slow reply)

Yes, a logical strategy. Thanks!

robintw commented 9 months ago

Done.

New CLI help text is:

usage: lman_parser.py [OPTION] DATA_PATH [LOGGING_LEVEL]

positional arguments:
  DATA_PATH             Path to the source data
  LOGGING_LEVEL         Debug level - must be one of debug, warning or info

options:
  -h, --help            show this help message and exit
  --skip-first-run, --no-skip-first-run
                        Skip Run 1, loading the shopping list from the link_tracker.json file
  --warn-on-blank-runs, --no-warn-on-blank-runs
                        Print warning messages whenever runs of blank paragraphs are found
  --run-validation, --no-run-validation
                        Run the DITA validation step
IanMayo commented 9 months ago

It's great Robin. The single file parser runs in a flash now :-)

I'll merge it, so I can start testing it onsite shortly - but if/when you get chance could you also update the README in repo root?

That's my "go-to" stop for reminding myself of the command structure.