key_without_language() reimplemented with regexp #136
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
What?
This pull request contains several related modifications to A+ RST Tools issue #134.
#134
In lib/toc_languages.py, functions key_without_language() and join_keys()
were refactored into methods in the class IndexJoiner. This is more consistent,
as there are other "join"-named methods in IndexJoiner.
Method key_without_language() in lib/toc_languages.py had a bug: the
function could only strip language ids of form "id_" and "id-", not "_id" or
"id". The bug was discovered with course the CS-A1141 Data Structures and
Algorithms Y. The function is now reimplemented with a more flexible regular
expression.
Method join_keys in lib/toc_languages.py now prints a warning message
into log. The message describes the location of mismatching keys in the
documentation tree, and mismatching keys with their language identifiers.
Example:
Mismatching keys at modules.1.2.3:
Language: en Key: sorting_en_something
Language: fi Key: sorting_fi_different
This should help the course material author locate the error. Moreover,
as the method now logs an error message instead of raising a SphinxError,
the compilation process can show log messages of all mismatching keys at
one compilation run, thus increasing productivity.
modified functions. The unit tests allow the A-plus RST tools developer to:
(i) easily test the functions of the software without needing to run a
Sphinx compilation of a test material, which can take minutes;
(ii) document how the functions should respond to certain inputs.
Why?
A+ RST Tools could not produce a helpful error message when there was
something inconsistent with keys on multilingual courses.
How?
Described above.
Fixes #134
Testing
Python unit tests are introduced to A+ RST Tools in this pull request.
There is the new directory "tests".
What type of test did you run?
[ADD A DESCRIPTION ABOUT WHAT YOU TESTED MANUALLY]
Did you test the changes in
Think of what is affected by these changes and could become broken
Translation
Original error message:
Programming style
Have you updated the README or other relevant documentation?
Is it Done?
Clean up your git commit history before submitting the pull request!