Failing to parse the date from the protocol Title should not abort the protocol parsing. #9

Open
opened 2023-09-12 18:36:18 +02:00 by ben · 0 comments
Owner

In

parser_data.date = Some(general::parse_date(title.borrow())?);

the Some(general::parse_date(title.borrow())?) should be replaced with general::parse_date(title.borrow()).ok() to ignore errors when parsing the date from the protocol title.

Additionally one might want to print a warning to stderr that parsing the date from the title failed.

The date parsing is implemented in https://www.fs-infmath.uni-kiel.de/git/FS-InfMath/FS-Protokoll/src/branch/master/fs_protocol_lib/src/format/general.rs#L138 in case one wants to make the parsing handle more cases.

In either case an additional test in /fs_protocol_bin/tests/ should be added to prevent regressions.
Add a file markdown/<TestName>.md.stdin with the markdown content or etherpad/<TestName>.txt.stdin with an etherpad plaintext export and see the README.md for instructions on how to generate new reference files after adding the new test input.

In https://www.fs-infmath.uni-kiel.de/git/FS-InfMath/FS-Protokoll/src/commit/a2b4b33868b637124cd9e654d8dd4e84d9c403a0/fs_protocol_lib/src/format/input/markdown.rs#L373 the `Some(general::parse_date(title.borrow())?)` should be replaced with `general::parse_date(title.borrow()).ok()` to ignore errors when parsing the date from the protocol title. Additionally one might want to print a warning to stderr that parsing the date from the title failed. The date parsing is implemented in https://www.fs-infmath.uni-kiel.de/git/FS-InfMath/FS-Protokoll/src/branch/master/fs_protocol_lib/src/format/general.rs#L138 in case one wants to make the parsing handle more cases. In either case an additional test in `/fs_protocol_bin/tests/` should be added to prevent regressions. Add a file `markdown/<TestName>.md.stdin` with the markdown content or `etherpad/<TestName>.txt.stdin` with an etherpad plaintext export and see the [README.md](https://www.fs-infmath.uni-kiel.de/git/FS-InfMath/FS-Protokoll/src/branch/master/README.md) for instructions on how to generate new reference files after adding the new test input.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
FS-InfMath/FS-Protokoll#9
No description provided.