Add a setting for mapping file extensions to syntax highlighters for diffs
Review Request #11821 — Created Sept. 24, 2021 and submitted
Previously, we guess what syntax highlighting to apply to files in the diff
viewer given their data and file extension. Sometimes this guess would be wrong,
and we have no way of setting what type of syntax highlighting gets applied to
files. This change adds a setting for mapping file extensions to pygments
lexers (the syntax highlighters), namely
reviewboard.admin.siteconfig.diffviewer_custom_pygments_lexers
. If a mapping
is not defined for a certain file extension, we revert to the old behaviour
of guessing which lexer to use given the filename and file contents.Adds
reviewboard.admin.form_widgets.LexersMappingWidget
which partly
handles the UI for modifying this mapping.
- Created unit tests for the mapping in
reviewboard.diffviewer.tests.test_raw_diff_chunk_generator
.
Ran all unit tests inreviewboard.diffviewer
with success - Created the unit tests for the LexersMappingWidget in
reviewboard.admin.tests.test_lexers_mapping_widget
.
Ran all unit tests inreviewboard.admin.tests
with success.
Summary | ID | Author |
---|---|---|
aac35dd214d59c3a66996bae103eaee99691960d | Michelle |
Description | From | Last Updated |
---|---|---|
Since we're using both the key and the value, the items() iterator might be nicer than keys(): for ext, lexer_name … |
david | |
In the case where there's a configured lexer that matches an extension, but that doesn't exist in Pygments, we probably … |
david | |
Python actually has a really nice syntax feature where for has an else clause that gets executed in the case … |
david | |
W291 trailing whitespace |
reviewbot | |
E122 continuation line missing indentation or outdented |
reviewbot | |
W293 blank line contains whitespace |
reviewbot | |
E303 too many blank lines (2) |
reviewbot | |
E122 continuation line missing indentation or outdented |
reviewbot | |
W293 blank line contains whitespace |
reviewbot | |
W291 trailing whitespace |
reviewbot | |
W291 trailing whitespace |
reviewbot | |
E122 continuation line missing indentation or outdented |
reviewbot | |
This doesn't seem valuable. Let's just use the one that we imported. |
david | |
Please add a blank line between these. |
david | |
Add a blank line here too. |
david | |
The logging messages do their own format operation on the arguments, so we don't have to use % here. Let's … |
david | |
Ahh, I see now why you were defining the class local version. Django has a helper for this that you … |
david | |
W293 blank line contains whitespace |
reviewbot | |
E123 closing bracket does not match indentation of opening bracket's line |
reviewbot | |
E501 line too long (84 > 79 characters) |
reviewbot | |
W293 blank line contains whitespace |
reviewbot | |
W292 no newline at end of file |
reviewbot | |
E501 line too long (84 > 79 characters) |
reviewbot | |
W293 blank line contains whitespace |
reviewbot | |
W292 no newline at end of file |
reviewbot | |
E501 line too long (84 > 79 characters) |
reviewbot | |
W293 blank line contains whitespace |
reviewbot | |
E501 line too long (84 > 79 characters) |
reviewbot | |
W293 blank line contains whitespace |
reviewbot | |
E501 line too long (84 > 79 characters) |
reviewbot | |
W293 blank line contains whitespace |
reviewbot | |
E501 line too long (84 > 79 characters) |
reviewbot | |
W293 blank line contains whitespace |
reviewbot | |
Let's try to shorten this to be a single line. Additional detail can be added in the next paragraph if … |
david | |
Leading underscore isn't needed here. |
david | |
Dedent 4 spaces. |
david | |
Dedent 4 spaces. |
david | |
We should probably clarify in the help text that this is for pygments so people can find the appropriate documentation. |
david | |
Let's use parens and string concatenation instead of the triple-quoted string here: correct_html = ( '<input type...' '<select name...' ) |
david | |
Can wrap this a little bit nicer: correct_html += format_html( '...') That said, string concatenation in Python isn't particularly efficient. … |
david | |
Same comments here as in above method. |
david | |
Keep imports in alphabetical order. |
david | |
Let's swap these so they're alphabetical |
david | |
Add a blank line here. |
david | |
Please alphabetize. |
david | |
Add a blank line before these. Let's also put c before j |
david | |
Alphabetize. |
david | |
Add a blank line in here. |
david | |
Add a blank line between these two. |
david | |
This comment just says exactly what the code says, so it's not adding much information. Let's get rid of it. |
david | |
This should go in its own import section above the reviewboard imports. |
david | |
We have a context manager that might dramatically simplify this test class. It will do a temporary override of the … |
david | |
F811 redefinition of unused 'render_to_string' from line 6 |
reviewbot | |
Add a blank line between these two. |
david | |
This needs to just be a single line. If we need more detail, we can add another paragraph. |
david | |
should I add a "Version added: 5.0.0" in here? |
maubin | |
Since the entire class is added in 5.0, I don't think we need version specifiers for each method inside it. … |
david |
-
Looks like a great start!
-
Since we're using both the key and the value, the
items()
iterator might be nicer thankeys()
:for ext, lexer_name in CUSTOM_PYGMENTS_LEXERS.items(): ...
-
In the case where there's a configured lexer that matches an extension, but that doesn't exist in Pygments, we probably should log an error so the user knows what went wrong.
-
Python actually has a really nice syntax feature where
for
has anelse
clause that gets executed in the case where nothing calledbreak
. So this could be combined:lexer = None for ext = CUSTOM_PYGMENTS_LEXERS.keys(): # Try to instantiate lexer ... else: # Use guess_lexer_for_filename
- Summary:
-
[WIP] Add a setting for mapping file extensions to syntax highlighters for diffsAdd a setting for mapping file extensions to syntax highlighters for diffs
- Testing Done:
-
~ None yet.
~ Created the following unit tests in reviewboard.diffviewer.tests.test_raw_diff_chunk_generator:
+ - test_apply_pygments_with_custom_mapping() which tests if custom lexer mapping works and if it overrides the old behaviour of guessing + - test_apply_pygments_with_bad_custom_mapping() which tests if proper error is logged when the custom mapping maps an extension to a non existant lexer class + + Ran all unit tests in reviewboard.diffviewer with success
- Commits:
-
Summary ID Author 3e4ddeda899f0e5d97f02ed070d7525662ee33c5 Michelle 3e4ddeda899f0e5d97f02ed070d7525662ee33c5 Michelle 97a6bd3547ff2c3af0708640538d75ef4a55f1c8 Michelle 13f279fa09f30803a02621e13192942b95e80460 Michelle d27cc3d581a53a7fd414db5efc820cba92ba9fb3 Michelle 8eb445508de1a38aae178bc59477b585f681bbd6 Michelle dafacdae4c204636121480ab9b3821ffec9ff889 Michelle 45754bd19bf4ae4ae6f9582e725557ddf0e3c976 Michelle 5fb349b3f4d0adb8a4f0c0b25d3df3611a446220 Michelle c29591ba2ab98206ea65f12b248826d2e5ad5eac Michelle f853203d6bcadd51d4e9dcfe9561607034023ab7 Michelle
Checks run (1 failed, 1 succeeded)
flake8
- Commits:
-
Summary ID Author 3e4ddeda899f0e5d97f02ed070d7525662ee33c5 Michelle 97a6bd3547ff2c3af0708640538d75ef4a55f1c8 Michelle 13f279fa09f30803a02621e13192942b95e80460 Michelle d27cc3d581a53a7fd414db5efc820cba92ba9fb3 Michelle 8eb445508de1a38aae178bc59477b585f681bbd6 Michelle dafacdae4c204636121480ab9b3821ffec9ff889 Michelle 45754bd19bf4ae4ae6f9582e725557ddf0e3c976 Michelle 5fb349b3f4d0adb8a4f0c0b25d3df3611a446220 Michelle c29591ba2ab98206ea65f12b248826d2e5ad5eac Michelle f853203d6bcadd51d4e9dcfe9561607034023ab7 Michelle 3e4ddeda899f0e5d97f02ed070d7525662ee33c5 Michelle 97a6bd3547ff2c3af0708640538d75ef4a55f1c8 Michelle 13f279fa09f30803a02621e13192942b95e80460 Michelle d27cc3d581a53a7fd414db5efc820cba92ba9fb3 Michelle 8eb445508de1a38aae178bc59477b585f681bbd6 Michelle dafacdae4c204636121480ab9b3821ffec9ff889 Michelle 45754bd19bf4ae4ae6f9582e725557ddf0e3c976 Michelle 5fb349b3f4d0adb8a4f0c0b25d3df3611a446220 Michelle c29591ba2ab98206ea65f12b248826d2e5ad5eac Michelle f853203d6bcadd51d4e9dcfe9561607034023ab7 Michelle f734b34e8ddc5eca2a3000f71feab356c0541cfd Michelle
- Commits:
-
Summary ID Author 3e4ddeda899f0e5d97f02ed070d7525662ee33c5 Michelle 97a6bd3547ff2c3af0708640538d75ef4a55f1c8 Michelle 13f279fa09f30803a02621e13192942b95e80460 Michelle d27cc3d581a53a7fd414db5efc820cba92ba9fb3 Michelle 8eb445508de1a38aae178bc59477b585f681bbd6 Michelle dafacdae4c204636121480ab9b3821ffec9ff889 Michelle 45754bd19bf4ae4ae6f9582e725557ddf0e3c976 Michelle 5fb349b3f4d0adb8a4f0c0b25d3df3611a446220 Michelle c29591ba2ab98206ea65f12b248826d2e5ad5eac Michelle f853203d6bcadd51d4e9dcfe9561607034023ab7 Michelle f734b34e8ddc5eca2a3000f71feab356c0541cfd Michelle 3e4ddeda899f0e5d97f02ed070d7525662ee33c5 Michelle 97a6bd3547ff2c3af0708640538d75ef4a55f1c8 Michelle 13f279fa09f30803a02621e13192942b95e80460 Michelle d27cc3d581a53a7fd414db5efc820cba92ba9fb3 Michelle 8eb445508de1a38aae178bc59477b585f681bbd6 Michelle dafacdae4c204636121480ab9b3821ffec9ff889 Michelle 45754bd19bf4ae4ae6f9582e725557ddf0e3c976 Michelle 5fb349b3f4d0adb8a4f0c0b25d3df3611a446220 Michelle c29591ba2ab98206ea65f12b248826d2e5ad5eac Michelle f853203d6bcadd51d4e9dcfe9561607034023ab7 Michelle f734b34e8ddc5eca2a3000f71feab356c0541cfd Michelle d3dd8e59f73f2c246e6f04ab57c4b2dbfaa87f4b Michelle
Checks run (2 succeeded)
-
-
-
-
-
The logging messages do their own format operation on the arguments, so we don't have to use
%
here. Let's also make this message a little bit more explicit/terse:logger.error('Pygments lexer "%s" for "%s" files in ' 'settings.CUSTOM_PYGMENTS_LEXERS was not found.', lexer_name, ext)
-
Ahh, I see now why you were defining the class local version. Django has a helper for this that you can use as a decorator:
django.test.utils.override_settings
:@override_settings(CUSTOM_PYGMENTS_LEXERS={'.md': 'LessCss'}) def test_apply_pygments_with_custom_mapping(self): ...
- Commits:
-
Summary ID Author 3e4ddeda899f0e5d97f02ed070d7525662ee33c5 Michelle 97a6bd3547ff2c3af0708640538d75ef4a55f1c8 Michelle 13f279fa09f30803a02621e13192942b95e80460 Michelle d27cc3d581a53a7fd414db5efc820cba92ba9fb3 Michelle 8eb445508de1a38aae178bc59477b585f681bbd6 Michelle dafacdae4c204636121480ab9b3821ffec9ff889 Michelle 45754bd19bf4ae4ae6f9582e725557ddf0e3c976 Michelle 5fb349b3f4d0adb8a4f0c0b25d3df3611a446220 Michelle c29591ba2ab98206ea65f12b248826d2e5ad5eac Michelle f853203d6bcadd51d4e9dcfe9561607034023ab7 Michelle f734b34e8ddc5eca2a3000f71feab356c0541cfd Michelle d3dd8e59f73f2c246e6f04ab57c4b2dbfaa87f4b Michelle 3e4ddeda899f0e5d97f02ed070d7525662ee33c5 Michelle 97a6bd3547ff2c3af0708640538d75ef4a55f1c8 Michelle 13f279fa09f30803a02621e13192942b95e80460 Michelle d27cc3d581a53a7fd414db5efc820cba92ba9fb3 Michelle 8eb445508de1a38aae178bc59477b585f681bbd6 Michelle dafacdae4c204636121480ab9b3821ffec9ff889 Michelle 45754bd19bf4ae4ae6f9582e725557ddf0e3c976 Michelle 5fb349b3f4d0adb8a4f0c0b25d3df3611a446220 Michelle c29591ba2ab98206ea65f12b248826d2e5ad5eac Michelle f853203d6bcadd51d4e9dcfe9561607034023ab7 Michelle f734b34e8ddc5eca2a3000f71feab356c0541cfd Michelle d3dd8e59f73f2c246e6f04ab57c4b2dbfaa87f4b Michelle 5e248bac7d732347961213f7a83934a07c604426 Michelle
- Commits:
-
Summary ID Author 3e4ddeda899f0e5d97f02ed070d7525662ee33c5 Michelle 97a6bd3547ff2c3af0708640538d75ef4a55f1c8 Michelle 13f279fa09f30803a02621e13192942b95e80460 Michelle d27cc3d581a53a7fd414db5efc820cba92ba9fb3 Michelle 8eb445508de1a38aae178bc59477b585f681bbd6 Michelle dafacdae4c204636121480ab9b3821ffec9ff889 Michelle 45754bd19bf4ae4ae6f9582e725557ddf0e3c976 Michelle 5fb349b3f4d0adb8a4f0c0b25d3df3611a446220 Michelle c29591ba2ab98206ea65f12b248826d2e5ad5eac Michelle f853203d6bcadd51d4e9dcfe9561607034023ab7 Michelle f734b34e8ddc5eca2a3000f71feab356c0541cfd Michelle d3dd8e59f73f2c246e6f04ab57c4b2dbfaa87f4b Michelle 5e248bac7d732347961213f7a83934a07c604426 Michelle 3e4ddeda899f0e5d97f02ed070d7525662ee33c5 Michelle 97a6bd3547ff2c3af0708640538d75ef4a55f1c8 Michelle 13f279fa09f30803a02621e13192942b95e80460 Michelle d27cc3d581a53a7fd414db5efc820cba92ba9fb3 Michelle 8eb445508de1a38aae178bc59477b585f681bbd6 Michelle dafacdae4c204636121480ab9b3821ffec9ff889 Michelle 45754bd19bf4ae4ae6f9582e725557ddf0e3c976 Michelle 5fb349b3f4d0adb8a4f0c0b25d3df3611a446220 Michelle c29591ba2ab98206ea65f12b248826d2e5ad5eac Michelle f853203d6bcadd51d4e9dcfe9561607034023ab7 Michelle f734b34e8ddc5eca2a3000f71feab356c0541cfd Michelle d3dd8e59f73f2c246e6f04ab57c4b2dbfaa87f4b Michelle 5e248bac7d732347961213f7a83934a07c604426 Michelle d1a3b05fd934f96b700bb87b60e2613e89df833f Michelle
Checks run (2 succeeded)
- Summary:
-
Add a setting for mapping file extensions to syntax highlighters for diffs[WIP] Add a setting for mapping file extensions to syntax highlighters for diffs
- Commits:
-
Summary ID Author 3e4ddeda899f0e5d97f02ed070d7525662ee33c5 Michelle 97a6bd3547ff2c3af0708640538d75ef4a55f1c8 Michelle 13f279fa09f30803a02621e13192942b95e80460 Michelle d27cc3d581a53a7fd414db5efc820cba92ba9fb3 Michelle 8eb445508de1a38aae178bc59477b585f681bbd6 Michelle dafacdae4c204636121480ab9b3821ffec9ff889 Michelle 45754bd19bf4ae4ae6f9582e725557ddf0e3c976 Michelle 5fb349b3f4d0adb8a4f0c0b25d3df3611a446220 Michelle c29591ba2ab98206ea65f12b248826d2e5ad5eac Michelle f853203d6bcadd51d4e9dcfe9561607034023ab7 Michelle f734b34e8ddc5eca2a3000f71feab356c0541cfd Michelle d3dd8e59f73f2c246e6f04ab57c4b2dbfaa87f4b Michelle 5e248bac7d732347961213f7a83934a07c604426 Michelle d1a3b05fd934f96b700bb87b60e2613e89df833f Michelle 3e4ddeda899f0e5d97f02ed070d7525662ee33c5 Michelle 97a6bd3547ff2c3af0708640538d75ef4a55f1c8 Michelle 13f279fa09f30803a02621e13192942b95e80460 Michelle d27cc3d581a53a7fd414db5efc820cba92ba9fb3 Michelle 8eb445508de1a38aae178bc59477b585f681bbd6 Michelle dafacdae4c204636121480ab9b3821ffec9ff889 Michelle 45754bd19bf4ae4ae6f9582e725557ddf0e3c976 Michelle 5fb349b3f4d0adb8a4f0c0b25d3df3611a446220 Michelle c29591ba2ab98206ea65f12b248826d2e5ad5eac Michelle f853203d6bcadd51d4e9dcfe9561607034023ab7 Michelle f734b34e8ddc5eca2a3000f71feab356c0541cfd Michelle d3dd8e59f73f2c246e6f04ab57c4b2dbfaa87f4b Michelle 5e248bac7d732347961213f7a83934a07c604426 Michelle d1a3b05fd934f96b700bb87b60e2613e89df833f Michelle 02756419d83742c1b0181d806bdb57b3cd6661aa Michelle fbd7700720326e780e696c44181650451beaad95 Michelle faa04403111580a7b8494fc726904764887bac9a Michelle
- Change Summary:
-
Create LexersMappingWidget and using it in diff settings to test for now
- Testing Done:
-
Created the following unit tests in reviewboard.diffviewer.tests.test_raw_diff_chunk_generator:
- test_apply_pygments_with_custom_mapping() which tests if custom lexer mapping works and if it overrides the old behaviour of guessing ~ - test_apply_pygments_with_bad_custom_mapping() which tests if proper error is logged when the custom mapping maps an extension to a non existant lexer class ~ - test_apply_pygments_with_bad_custom_mapping() which tests if proper error is logged when the custom mapping maps an extension to a non existant lexer class + - test_apply_pygments_with_empty_custom_mapping() which tests if apply_pygments still works as expected with an empty custom mapping. Ran all unit tests in reviewboard.diffviewer with success
- Commits:
-
Summary ID Author 3e4ddeda899f0e5d97f02ed070d7525662ee33c5 Michelle 97a6bd3547ff2c3af0708640538d75ef4a55f1c8 Michelle 13f279fa09f30803a02621e13192942b95e80460 Michelle d27cc3d581a53a7fd414db5efc820cba92ba9fb3 Michelle 8eb445508de1a38aae178bc59477b585f681bbd6 Michelle dafacdae4c204636121480ab9b3821ffec9ff889 Michelle 45754bd19bf4ae4ae6f9582e725557ddf0e3c976 Michelle 5fb349b3f4d0adb8a4f0c0b25d3df3611a446220 Michelle c29591ba2ab98206ea65f12b248826d2e5ad5eac Michelle f853203d6bcadd51d4e9dcfe9561607034023ab7 Michelle f734b34e8ddc5eca2a3000f71feab356c0541cfd Michelle d3dd8e59f73f2c246e6f04ab57c4b2dbfaa87f4b Michelle 5e248bac7d732347961213f7a83934a07c604426 Michelle d1a3b05fd934f96b700bb87b60e2613e89df833f Michelle 02756419d83742c1b0181d806bdb57b3cd6661aa Michelle fbd7700720326e780e696c44181650451beaad95 Michelle faa04403111580a7b8494fc726904764887bac9a Michelle 3e4ddeda899f0e5d97f02ed070d7525662ee33c5 Michelle 97a6bd3547ff2c3af0708640538d75ef4a55f1c8 Michelle 13f279fa09f30803a02621e13192942b95e80460 Michelle d27cc3d581a53a7fd414db5efc820cba92ba9fb3 Michelle 8eb445508de1a38aae178bc59477b585f681bbd6 Michelle dafacdae4c204636121480ab9b3821ffec9ff889 Michelle 45754bd19bf4ae4ae6f9582e725557ddf0e3c976 Michelle 5fb349b3f4d0adb8a4f0c0b25d3df3611a446220 Michelle c29591ba2ab98206ea65f12b248826d2e5ad5eac Michelle f853203d6bcadd51d4e9dcfe9561607034023ab7 Michelle f734b34e8ddc5eca2a3000f71feab356c0541cfd Michelle d3dd8e59f73f2c246e6f04ab57c4b2dbfaa87f4b Michelle 5e248bac7d732347961213f7a83934a07c604426 Michelle d1a3b05fd934f96b700bb87b60e2613e89df833f Michelle 02756419d83742c1b0181d806bdb57b3cd6661aa Michelle fbd7700720326e780e696c44181650451beaad95 Michelle faa04403111580a7b8494fc726904764887bac9a Michelle 48047abe632054dd35db53369725cb063e7f3ff4 Michelle
- Change Summary:
-
took out changes from bad rebasing
- Commits:
-
Summary ID Author 3e4ddeda899f0e5d97f02ed070d7525662ee33c5 Michelle 97a6bd3547ff2c3af0708640538d75ef4a55f1c8 Michelle 13f279fa09f30803a02621e13192942b95e80460 Michelle d27cc3d581a53a7fd414db5efc820cba92ba9fb3 Michelle 8eb445508de1a38aae178bc59477b585f681bbd6 Michelle dafacdae4c204636121480ab9b3821ffec9ff889 Michelle 45754bd19bf4ae4ae6f9582e725557ddf0e3c976 Michelle 5fb349b3f4d0adb8a4f0c0b25d3df3611a446220 Michelle c29591ba2ab98206ea65f12b248826d2e5ad5eac Michelle f853203d6bcadd51d4e9dcfe9561607034023ab7 Michelle f734b34e8ddc5eca2a3000f71feab356c0541cfd Michelle d3dd8e59f73f2c246e6f04ab57c4b2dbfaa87f4b Michelle 5e248bac7d732347961213f7a83934a07c604426 Michelle d1a3b05fd934f96b700bb87b60e2613e89df833f Michelle 02756419d83742c1b0181d806bdb57b3cd6661aa Michelle fbd7700720326e780e696c44181650451beaad95 Michelle faa04403111580a7b8494fc726904764887bac9a Michelle 48047abe632054dd35db53369725cb063e7f3ff4 Michelle 810c268b04d766208982bd9cc5772fb472ab2e50 Michelle a5a683ce294e75b13c7c4b600ab1c6b7a2d9416d Michelle 6da489bde81ca3eb9df84c3bb4e79425b18b7e45 Michelle 8e396cb6f373d3336d411804d2973bb2f06680be Michelle 23ec2199b6b867851f9d8d8163a85e9ba9898bce Michelle 5785f25b427e1b18316db43ddcc98e02ba646892 Michelle eefc9d52856d30d61963a6d34ebc76102b33bf2b Michelle 967ef3e281d39d468ef4d9c9f360f6a1e28087ec Michelle 33139db632f2c36deb14cc9a493c4f33cb6754fe Michelle 224a9d9c751d4525937d3b4cae2f85a5f09d2e6a Michelle e6eed2477b86a382140fbe0d215819ea4a17c8a9 Michelle 9b1f2c9a68e2161a9d67cb1064ec09063e8aeb50 Michelle 211c72f95930609b6655ad0f06f229df884d2d62 Michelle ad32f6009c25e8d555c19622857422236ee46f5f Michelle d7549e8107b35ceae203e9099b2a323bd7e89042 Michelle 09b9854b63f1c67e6684c300b7c9fd971a65d175 Michelle a36c2ee69209caa2053c1ea80431762a97cf9379 Michelle dfdc4468076bf6d899533efc6fb3c4b9f1088394 Michelle
- Change Summary:
-
Add tests for LexersMappingWidget
- Description:
-
Adds a default mapping of file extensions to pygments lexers, which
administrators may modify to define their own custom mapping. If a mapping is not defined for a certain file extension, we revert to the old behaviour of guessing which lexer to use given the filename and file contents. + + Adds reviewboard.admin.form_widgets.LexersMappingWidget which partly handles
+ the UI for maintaining this mapping. - Testing Done:
-
Created the following unit tests in reviewboard.diffviewer.tests.test_raw_diff_chunk_generator:
- test_apply_pygments_with_custom_mapping() which tests if custom lexer mapping works and if it overrides the old behaviour of guessing - test_apply_pygments_with_bad_custom_mapping() which tests if proper error is logged when the custom mapping maps an extension to a non existant lexer class - test_apply_pygments_with_empty_custom_mapping() which tests if apply_pygments still works as expected with an empty custom mapping. Ran all unit tests in reviewboard.diffviewer with success
+ + Created the unit tests for the LexersMappingWidget in reviewboard.admin.tests.test_lexers_mapping_widget.
+ Ran all unit tests in reviewboard.admin.tests with success. - Commits:
-
Summary ID Author 810c268b04d766208982bd9cc5772fb472ab2e50 Michelle a5a683ce294e75b13c7c4b600ab1c6b7a2d9416d Michelle 6da489bde81ca3eb9df84c3bb4e79425b18b7e45 Michelle 8e396cb6f373d3336d411804d2973bb2f06680be Michelle 23ec2199b6b867851f9d8d8163a85e9ba9898bce Michelle 5785f25b427e1b18316db43ddcc98e02ba646892 Michelle eefc9d52856d30d61963a6d34ebc76102b33bf2b Michelle 967ef3e281d39d468ef4d9c9f360f6a1e28087ec Michelle 33139db632f2c36deb14cc9a493c4f33cb6754fe Michelle 224a9d9c751d4525937d3b4cae2f85a5f09d2e6a Michelle e6eed2477b86a382140fbe0d215819ea4a17c8a9 Michelle 9b1f2c9a68e2161a9d67cb1064ec09063e8aeb50 Michelle 211c72f95930609b6655ad0f06f229df884d2d62 Michelle ad32f6009c25e8d555c19622857422236ee46f5f Michelle d7549e8107b35ceae203e9099b2a323bd7e89042 Michelle 09b9854b63f1c67e6684c300b7c9fd971a65d175 Michelle a36c2ee69209caa2053c1ea80431762a97cf9379 Michelle dfdc4468076bf6d899533efc6fb3c4b9f1088394 Michelle 810c268b04d766208982bd9cc5772fb472ab2e50 Michelle a5a683ce294e75b13c7c4b600ab1c6b7a2d9416d Michelle 6da489bde81ca3eb9df84c3bb4e79425b18b7e45 Michelle 8e396cb6f373d3336d411804d2973bb2f06680be Michelle 23ec2199b6b867851f9d8d8163a85e9ba9898bce Michelle 5785f25b427e1b18316db43ddcc98e02ba646892 Michelle eefc9d52856d30d61963a6d34ebc76102b33bf2b Michelle 967ef3e281d39d468ef4d9c9f360f6a1e28087ec Michelle 33139db632f2c36deb14cc9a493c4f33cb6754fe Michelle 224a9d9c751d4525937d3b4cae2f85a5f09d2e6a Michelle e6eed2477b86a382140fbe0d215819ea4a17c8a9 Michelle 9b1f2c9a68e2161a9d67cb1064ec09063e8aeb50 Michelle 211c72f95930609b6655ad0f06f229df884d2d62 Michelle ad32f6009c25e8d555c19622857422236ee46f5f Michelle d7549e8107b35ceae203e9099b2a323bd7e89042 Michelle 09b9854b63f1c67e6684c300b7c9fd971a65d175 Michelle a36c2ee69209caa2053c1ea80431762a97cf9379 Michelle dfdc4468076bf6d899533efc6fb3c4b9f1088394 Michelle 2d37e23bb79913a72a2e2c580d2023e73d7449c7 Michelle - Diff:
-
Revision 10 (+809 -115)
- Commits:
-
Summary ID Author 810c268b04d766208982bd9cc5772fb472ab2e50 Michelle a5a683ce294e75b13c7c4b600ab1c6b7a2d9416d Michelle 6da489bde81ca3eb9df84c3bb4e79425b18b7e45 Michelle 8e396cb6f373d3336d411804d2973bb2f06680be Michelle 23ec2199b6b867851f9d8d8163a85e9ba9898bce Michelle 5785f25b427e1b18316db43ddcc98e02ba646892 Michelle eefc9d52856d30d61963a6d34ebc76102b33bf2b Michelle 967ef3e281d39d468ef4d9c9f360f6a1e28087ec Michelle 33139db632f2c36deb14cc9a493c4f33cb6754fe Michelle 224a9d9c751d4525937d3b4cae2f85a5f09d2e6a Michelle e6eed2477b86a382140fbe0d215819ea4a17c8a9 Michelle 9b1f2c9a68e2161a9d67cb1064ec09063e8aeb50 Michelle 211c72f95930609b6655ad0f06f229df884d2d62 Michelle ad32f6009c25e8d555c19622857422236ee46f5f Michelle d7549e8107b35ceae203e9099b2a323bd7e89042 Michelle 09b9854b63f1c67e6684c300b7c9fd971a65d175 Michelle a36c2ee69209caa2053c1ea80431762a97cf9379 Michelle dfdc4468076bf6d899533efc6fb3c4b9f1088394 Michelle 2d37e23bb79913a72a2e2c580d2023e73d7449c7 Michelle 810c268b04d766208982bd9cc5772fb472ab2e50 Michelle a5a683ce294e75b13c7c4b600ab1c6b7a2d9416d Michelle 6da489bde81ca3eb9df84c3bb4e79425b18b7e45 Michelle 8e396cb6f373d3336d411804d2973bb2f06680be Michelle 23ec2199b6b867851f9d8d8163a85e9ba9898bce Michelle 5785f25b427e1b18316db43ddcc98e02ba646892 Michelle eefc9d52856d30d61963a6d34ebc76102b33bf2b Michelle 967ef3e281d39d468ef4d9c9f360f6a1e28087ec Michelle 33139db632f2c36deb14cc9a493c4f33cb6754fe Michelle 224a9d9c751d4525937d3b4cae2f85a5f09d2e6a Michelle e6eed2477b86a382140fbe0d215819ea4a17c8a9 Michelle 9b1f2c9a68e2161a9d67cb1064ec09063e8aeb50 Michelle 211c72f95930609b6655ad0f06f229df884d2d62 Michelle ad32f6009c25e8d555c19622857422236ee46f5f Michelle d7549e8107b35ceae203e9099b2a323bd7e89042 Michelle 09b9854b63f1c67e6684c300b7c9fd971a65d175 Michelle a36c2ee69209caa2053c1ea80431762a97cf9379 Michelle dfdc4468076bf6d899533efc6fb3c4b9f1088394 Michelle 2d37e23bb79913a72a2e2c580d2023e73d7449c7 Michelle 38a50c83e212b487d4d62537b0fa64c9c6cbe2ff Michelle - Diff:
-
Revision 11 (+815 -123)
- Change Summary:
-
Everything is done and tested, except for handling local site stuff
- Commits:
-
Summary ID Author 810c268b04d766208982bd9cc5772fb472ab2e50 Michelle a5a683ce294e75b13c7c4b600ab1c6b7a2d9416d Michelle 6da489bde81ca3eb9df84c3bb4e79425b18b7e45 Michelle 8e396cb6f373d3336d411804d2973bb2f06680be Michelle 23ec2199b6b867851f9d8d8163a85e9ba9898bce Michelle 5785f25b427e1b18316db43ddcc98e02ba646892 Michelle eefc9d52856d30d61963a6d34ebc76102b33bf2b Michelle 967ef3e281d39d468ef4d9c9f360f6a1e28087ec Michelle 33139db632f2c36deb14cc9a493c4f33cb6754fe Michelle 224a9d9c751d4525937d3b4cae2f85a5f09d2e6a Michelle e6eed2477b86a382140fbe0d215819ea4a17c8a9 Michelle 9b1f2c9a68e2161a9d67cb1064ec09063e8aeb50 Michelle 211c72f95930609b6655ad0f06f229df884d2d62 Michelle ad32f6009c25e8d555c19622857422236ee46f5f Michelle d7549e8107b35ceae203e9099b2a323bd7e89042 Michelle 09b9854b63f1c67e6684c300b7c9fd971a65d175 Michelle a36c2ee69209caa2053c1ea80431762a97cf9379 Michelle dfdc4468076bf6d899533efc6fb3c4b9f1088394 Michelle 2d37e23bb79913a72a2e2c580d2023e73d7449c7 Michelle 38a50c83e212b487d4d62537b0fa64c9c6cbe2ff Michelle 810c268b04d766208982bd9cc5772fb472ab2e50 Michelle a5a683ce294e75b13c7c4b600ab1c6b7a2d9416d Michelle 6da489bde81ca3eb9df84c3bb4e79425b18b7e45 Michelle 8e396cb6f373d3336d411804d2973bb2f06680be Michelle 23ec2199b6b867851f9d8d8163a85e9ba9898bce Michelle 5785f25b427e1b18316db43ddcc98e02ba646892 Michelle eefc9d52856d30d61963a6d34ebc76102b33bf2b Michelle 967ef3e281d39d468ef4d9c9f360f6a1e28087ec Michelle 33139db632f2c36deb14cc9a493c4f33cb6754fe Michelle 224a9d9c751d4525937d3b4cae2f85a5f09d2e6a Michelle e6eed2477b86a382140fbe0d215819ea4a17c8a9 Michelle 9b1f2c9a68e2161a9d67cb1064ec09063e8aeb50 Michelle 211c72f95930609b6655ad0f06f229df884d2d62 Michelle ad32f6009c25e8d555c19622857422236ee46f5f Michelle d7549e8107b35ceae203e9099b2a323bd7e89042 Michelle 09b9854b63f1c67e6684c300b7c9fd971a65d175 Michelle a36c2ee69209caa2053c1ea80431762a97cf9379 Michelle dfdc4468076bf6d899533efc6fb3c4b9f1088394 Michelle 2d37e23bb79913a72a2e2c580d2023e73d7449c7 Michelle 38a50c83e212b487d4d62537b0fa64c9c6cbe2ff Michelle 8d4a6d7996c73bee56335d8f5ea55f16d4aee271 Michelle - Diff:
-
Revision 12 (+824 -136)
- Change Summary:
-
Finalized and ready for review.
- Summary:
-
[WIP] Add a setting for mapping file extensions to syntax highlighters for diffsAdd a setting for mapping file extensions to syntax highlighters for diffs
- Description:
-
~ Adds a default mapping of file extensions to pygments lexers, which
~ administrators may modify to define their own custom mapping. If a ~ mapping is not defined for a certain file extension, we revert to ~ the old behaviour of guessing which lexer to use given the filename ~ Adds reviewboard.admin.siteconfig.diffviewer_custom_pygments_lexers,
~ a mapping of file extensions to pygments lexers. If a mapping is not ~ defined for a certain file extension, we revert to the old behaviour ~ of guessing which lexer to use given the filename and file contents. - and file contents. ~ Adds reviewboard.admin.form_widgets.LexersMappingWidget which partly handles
~ the UI for maintaining this mapping. ~ Adds reviewboard.admin.form_widgets.LexersMappingWidget which partly
~ handles the UI for modifying this mapping. - Testing Done:
-
~ Created the following unit tests in reviewboard.diffviewer.tests.test_raw_diff_chunk_generator:
~ - test_apply_pygments_with_custom_mapping() which tests if custom lexer mapping works and if it overrides the old behaviour of guessing ~ - test_apply_pygments_with_bad_custom_mapping() which tests if proper error is logged when the custom mapping maps an extension to a non existant lexer class ~ Created unit tests for the mapping in
~ reviewboard.diffviewer.tests.test_raw_diff_chunk_generator. ~ Ran all unit tests in reviewboard.diffviewer with success - - test_apply_pygments_with_empty_custom_mapping() which tests if apply_pygments still works as expected with an empty custom mapping. ~ Ran all unit tests in reviewboard.diffviewer with success
~ ~ Created the unit tests for the LexersMappingWidget in
~ reviewboard.admin.tests.test_lexers_mapping_widget. - Created the unit tests for the LexersMappingWidget in reviewboard.admin.tests.test_lexers_mapping_widget.
Ran all unit tests in reviewboard.admin.tests with success. - Commits:
-
Summary ID Author 810c268b04d766208982bd9cc5772fb472ab2e50 Michelle a5a683ce294e75b13c7c4b600ab1c6b7a2d9416d Michelle 6da489bde81ca3eb9df84c3bb4e79425b18b7e45 Michelle 8e396cb6f373d3336d411804d2973bb2f06680be Michelle 23ec2199b6b867851f9d8d8163a85e9ba9898bce Michelle 5785f25b427e1b18316db43ddcc98e02ba646892 Michelle eefc9d52856d30d61963a6d34ebc76102b33bf2b Michelle 967ef3e281d39d468ef4d9c9f360f6a1e28087ec Michelle 33139db632f2c36deb14cc9a493c4f33cb6754fe Michelle 224a9d9c751d4525937d3b4cae2f85a5f09d2e6a Michelle e6eed2477b86a382140fbe0d215819ea4a17c8a9 Michelle 9b1f2c9a68e2161a9d67cb1064ec09063e8aeb50 Michelle 211c72f95930609b6655ad0f06f229df884d2d62 Michelle ad32f6009c25e8d555c19622857422236ee46f5f Michelle d7549e8107b35ceae203e9099b2a323bd7e89042 Michelle 09b9854b63f1c67e6684c300b7c9fd971a65d175 Michelle a36c2ee69209caa2053c1ea80431762a97cf9379 Michelle dfdc4468076bf6d899533efc6fb3c4b9f1088394 Michelle 2d37e23bb79913a72a2e2c580d2023e73d7449c7 Michelle 38a50c83e212b487d4d62537b0fa64c9c6cbe2ff Michelle 8d4a6d7996c73bee56335d8f5ea55f16d4aee271 Michelle 810c268b04d766208982bd9cc5772fb472ab2e50 Michelle a5a683ce294e75b13c7c4b600ab1c6b7a2d9416d Michelle 6da489bde81ca3eb9df84c3bb4e79425b18b7e45 Michelle 8e396cb6f373d3336d411804d2973bb2f06680be Michelle 23ec2199b6b867851f9d8d8163a85e9ba9898bce Michelle 5785f25b427e1b18316db43ddcc98e02ba646892 Michelle eefc9d52856d30d61963a6d34ebc76102b33bf2b Michelle 967ef3e281d39d468ef4d9c9f360f6a1e28087ec Michelle 33139db632f2c36deb14cc9a493c4f33cb6754fe Michelle 224a9d9c751d4525937d3b4cae2f85a5f09d2e6a Michelle e6eed2477b86a382140fbe0d215819ea4a17c8a9 Michelle 9b1f2c9a68e2161a9d67cb1064ec09063e8aeb50 Michelle 211c72f95930609b6655ad0f06f229df884d2d62 Michelle ad32f6009c25e8d555c19622857422236ee46f5f Michelle d7549e8107b35ceae203e9099b2a323bd7e89042 Michelle 09b9854b63f1c67e6684c300b7c9fd971a65d175 Michelle a36c2ee69209caa2053c1ea80431762a97cf9379 Michelle dfdc4468076bf6d899533efc6fb3c4b9f1088394 Michelle 2d37e23bb79913a72a2e2c580d2023e73d7449c7 Michelle 38a50c83e212b487d4d62537b0fa64c9c6cbe2ff Michelle 8d4a6d7996c73bee56335d8f5ea55f16d4aee271 Michelle 19678b279aef9280842c45bebbf420098da9c9be Michelle 43a4b9f467132947149f2eb315abbcbd3cccbdb7 Michelle df5ee812136e0eb9a94c4358a3288e26401d06fc Michelle - Diff:
-
Revision 13 (+807 -161)
Checks run (2 succeeded)
-
-
Let's try to shorten this to be a single line. Additional detail can be added in the next paragraph if necessary.
-
-
-
-
We should probably clarify in the help text that this is for pygments so people can find the appropriate documentation.
-
Let's use parens and string concatenation instead of the triple-quoted string here:
correct_html = ( '<input type...' '<select name...' )
-
Can wrap this a little bit nicer:
correct_html += format_html( '...')
That said, string concatenation in Python isn't particularly efficient. The usual convention is to build a list and join all at once:
correct_html_parts = [ '<input ...', '<select...', ] for lex in get_all_lexers(): ... correct_html_parts.append(format_html( '...')) correct_html_parts.append('</select>') correct_html = ''.join(correct_html_parts)
-
-
-
- Commits:
-
Summary ID Author 810c268b04d766208982bd9cc5772fb472ab2e50 Michelle a5a683ce294e75b13c7c4b600ab1c6b7a2d9416d Michelle 6da489bde81ca3eb9df84c3bb4e79425b18b7e45 Michelle 8e396cb6f373d3336d411804d2973bb2f06680be Michelle 23ec2199b6b867851f9d8d8163a85e9ba9898bce Michelle 5785f25b427e1b18316db43ddcc98e02ba646892 Michelle eefc9d52856d30d61963a6d34ebc76102b33bf2b Michelle 967ef3e281d39d468ef4d9c9f360f6a1e28087ec Michelle 33139db632f2c36deb14cc9a493c4f33cb6754fe Michelle 224a9d9c751d4525937d3b4cae2f85a5f09d2e6a Michelle e6eed2477b86a382140fbe0d215819ea4a17c8a9 Michelle 9b1f2c9a68e2161a9d67cb1064ec09063e8aeb50 Michelle 211c72f95930609b6655ad0f06f229df884d2d62 Michelle ad32f6009c25e8d555c19622857422236ee46f5f Michelle d7549e8107b35ceae203e9099b2a323bd7e89042 Michelle 09b9854b63f1c67e6684c300b7c9fd971a65d175 Michelle a36c2ee69209caa2053c1ea80431762a97cf9379 Michelle dfdc4468076bf6d899533efc6fb3c4b9f1088394 Michelle 2d37e23bb79913a72a2e2c580d2023e73d7449c7 Michelle 38a50c83e212b487d4d62537b0fa64c9c6cbe2ff Michelle 8d4a6d7996c73bee56335d8f5ea55f16d4aee271 Michelle 19678b279aef9280842c45bebbf420098da9c9be Michelle 43a4b9f467132947149f2eb315abbcbd3cccbdb7 Michelle df5ee812136e0eb9a94c4358a3288e26401d06fc Michelle 810c268b04d766208982bd9cc5772fb472ab2e50 Michelle a5a683ce294e75b13c7c4b600ab1c6b7a2d9416d Michelle 6da489bde81ca3eb9df84c3bb4e79425b18b7e45 Michelle 8e396cb6f373d3336d411804d2973bb2f06680be Michelle 23ec2199b6b867851f9d8d8163a85e9ba9898bce Michelle 5785f25b427e1b18316db43ddcc98e02ba646892 Michelle eefc9d52856d30d61963a6d34ebc76102b33bf2b Michelle 967ef3e281d39d468ef4d9c9f360f6a1e28087ec Michelle 33139db632f2c36deb14cc9a493c4f33cb6754fe Michelle 224a9d9c751d4525937d3b4cae2f85a5f09d2e6a Michelle e6eed2477b86a382140fbe0d215819ea4a17c8a9 Michelle 9b1f2c9a68e2161a9d67cb1064ec09063e8aeb50 Michelle 211c72f95930609b6655ad0f06f229df884d2d62 Michelle ad32f6009c25e8d555c19622857422236ee46f5f Michelle d7549e8107b35ceae203e9099b2a323bd7e89042 Michelle 09b9854b63f1c67e6684c300b7c9fd971a65d175 Michelle a36c2ee69209caa2053c1ea80431762a97cf9379 Michelle dfdc4468076bf6d899533efc6fb3c4b9f1088394 Michelle 2d37e23bb79913a72a2e2c580d2023e73d7449c7 Michelle 38a50c83e212b487d4d62537b0fa64c9c6cbe2ff Michelle 8d4a6d7996c73bee56335d8f5ea55f16d4aee271 Michelle 19678b279aef9280842c45bebbf420098da9c9be Michelle 43a4b9f467132947149f2eb315abbcbd3cccbdb7 Michelle df5ee812136e0eb9a94c4358a3288e26401d06fc Michelle 70eabb4e4983c7d39c06520389aaabde45d88b76 Michelle 83df1297d190d6aa433b6a07e3acea09e499762f Michelle - Diff:
-
Revision 14 (+838 -196)
Checks run (2 succeeded)
-
-
-
-
-
-
-
-
This comment just says exactly what the code says, so it's not adding much information. Let's get rid of it.
-
-
We have a context manager that might dramatically simplify this test class. It will do a temporary override of the siteconfig and then restore the old settings when that scope is exited. Can you try this and see if it does the right thing?
```python
settings = {
'diffviewer_custom_pygments_lexers': {'.md', 'LessCss'},
}with self.siteconfig_settings(settings):
chunk_generator = ....
- Commits:
-
Summary ID Author 810c268b04d766208982bd9cc5772fb472ab2e50 Michelle a5a683ce294e75b13c7c4b600ab1c6b7a2d9416d Michelle 6da489bde81ca3eb9df84c3bb4e79425b18b7e45 Michelle 8e396cb6f373d3336d411804d2973bb2f06680be Michelle 23ec2199b6b867851f9d8d8163a85e9ba9898bce Michelle 5785f25b427e1b18316db43ddcc98e02ba646892 Michelle eefc9d52856d30d61963a6d34ebc76102b33bf2b Michelle 967ef3e281d39d468ef4d9c9f360f6a1e28087ec Michelle 33139db632f2c36deb14cc9a493c4f33cb6754fe Michelle 224a9d9c751d4525937d3b4cae2f85a5f09d2e6a Michelle e6eed2477b86a382140fbe0d215819ea4a17c8a9 Michelle 9b1f2c9a68e2161a9d67cb1064ec09063e8aeb50 Michelle 211c72f95930609b6655ad0f06f229df884d2d62 Michelle ad32f6009c25e8d555c19622857422236ee46f5f Michelle d7549e8107b35ceae203e9099b2a323bd7e89042 Michelle 09b9854b63f1c67e6684c300b7c9fd971a65d175 Michelle a36c2ee69209caa2053c1ea80431762a97cf9379 Michelle dfdc4468076bf6d899533efc6fb3c4b9f1088394 Michelle 2d37e23bb79913a72a2e2c580d2023e73d7449c7 Michelle 38a50c83e212b487d4d62537b0fa64c9c6cbe2ff Michelle 8d4a6d7996c73bee56335d8f5ea55f16d4aee271 Michelle 19678b279aef9280842c45bebbf420098da9c9be Michelle 43a4b9f467132947149f2eb315abbcbd3cccbdb7 Michelle df5ee812136e0eb9a94c4358a3288e26401d06fc Michelle 70eabb4e4983c7d39c06520389aaabde45d88b76 Michelle 83df1297d190d6aa433b6a07e3acea09e499762f Michelle 810c268b04d766208982bd9cc5772fb472ab2e50 Michelle a5a683ce294e75b13c7c4b600ab1c6b7a2d9416d Michelle 6da489bde81ca3eb9df84c3bb4e79425b18b7e45 Michelle 8e396cb6f373d3336d411804d2973bb2f06680be Michelle 23ec2199b6b867851f9d8d8163a85e9ba9898bce Michelle 5785f25b427e1b18316db43ddcc98e02ba646892 Michelle eefc9d52856d30d61963a6d34ebc76102b33bf2b Michelle 967ef3e281d39d468ef4d9c9f360f6a1e28087ec Michelle 33139db632f2c36deb14cc9a493c4f33cb6754fe Michelle 224a9d9c751d4525937d3b4cae2f85a5f09d2e6a Michelle e6eed2477b86a382140fbe0d215819ea4a17c8a9 Michelle 9b1f2c9a68e2161a9d67cb1064ec09063e8aeb50 Michelle 211c72f95930609b6655ad0f06f229df884d2d62 Michelle ad32f6009c25e8d555c19622857422236ee46f5f Michelle d7549e8107b35ceae203e9099b2a323bd7e89042 Michelle 09b9854b63f1c67e6684c300b7c9fd971a65d175 Michelle a36c2ee69209caa2053c1ea80431762a97cf9379 Michelle dfdc4468076bf6d899533efc6fb3c4b9f1088394 Michelle 2d37e23bb79913a72a2e2c580d2023e73d7449c7 Michelle 38a50c83e212b487d4d62537b0fa64c9c6cbe2ff Michelle 8d4a6d7996c73bee56335d8f5ea55f16d4aee271 Michelle 19678b279aef9280842c45bebbf420098da9c9be Michelle 43a4b9f467132947149f2eb315abbcbd3cccbdb7 Michelle df5ee812136e0eb9a94c4358a3288e26401d06fc Michelle 70eabb4e4983c7d39c06520389aaabde45d88b76 Michelle 83df1297d190d6aa433b6a07e3acea09e499762f Michelle 8e3b46734371907145c91b86a75a4418ab332a6d Michelle - Diff:
-
Revision 15 (+889 -265)
Checks run (2 succeeded)
- Commits:
-
Summary ID Author 810c268b04d766208982bd9cc5772fb472ab2e50 Michelle a5a683ce294e75b13c7c4b600ab1c6b7a2d9416d Michelle 6da489bde81ca3eb9df84c3bb4e79425b18b7e45 Michelle 8e396cb6f373d3336d411804d2973bb2f06680be Michelle 23ec2199b6b867851f9d8d8163a85e9ba9898bce Michelle 5785f25b427e1b18316db43ddcc98e02ba646892 Michelle eefc9d52856d30d61963a6d34ebc76102b33bf2b Michelle 967ef3e281d39d468ef4d9c9f360f6a1e28087ec Michelle 33139db632f2c36deb14cc9a493c4f33cb6754fe Michelle 224a9d9c751d4525937d3b4cae2f85a5f09d2e6a Michelle e6eed2477b86a382140fbe0d215819ea4a17c8a9 Michelle 9b1f2c9a68e2161a9d67cb1064ec09063e8aeb50 Michelle 211c72f95930609b6655ad0f06f229df884d2d62 Michelle ad32f6009c25e8d555c19622857422236ee46f5f Michelle d7549e8107b35ceae203e9099b2a323bd7e89042 Michelle 09b9854b63f1c67e6684c300b7c9fd971a65d175 Michelle a36c2ee69209caa2053c1ea80431762a97cf9379 Michelle dfdc4468076bf6d899533efc6fb3c4b9f1088394 Michelle 2d37e23bb79913a72a2e2c580d2023e73d7449c7 Michelle 38a50c83e212b487d4d62537b0fa64c9c6cbe2ff Michelle 8d4a6d7996c73bee56335d8f5ea55f16d4aee271 Michelle 19678b279aef9280842c45bebbf420098da9c9be Michelle 43a4b9f467132947149f2eb315abbcbd3cccbdb7 Michelle df5ee812136e0eb9a94c4358a3288e26401d06fc Michelle 70eabb4e4983c7d39c06520389aaabde45d88b76 Michelle 83df1297d190d6aa433b6a07e3acea09e499762f Michelle 8e3b46734371907145c91b86a75a4418ab332a6d Michelle 4095f339e8f0d2f731c002a4188be81e0f6cd167 Michelle - Branch:
-
masterrelease-5.0.x
- Depends On:
-
- Diff:
Revision 16 (+658 -16)
- Commits:
-
Summary ID Author 4095f339e8f0d2f731c002a4188be81e0f6cd167 Michelle c9a53a82a075528117ee4f95a14a0c88a2ab8be1 Michelle - Diff:
-
Revision 17 (+656 -16)
Checks run (2 succeeded)
- Commits:
-
Summary ID Author c9a53a82a075528117ee4f95a14a0c88a2ab8be1 Michelle 326476223e1163d83986d3857526c5f373f843fc Michelle - Diff:
-
Revision 18 (+658 -16)
Checks run (2 succeeded)
- Description:
-
~ Adds reviewboard.admin.siteconfig.diffviewer_custom_pygments_lexers,
~ a mapping of file extensions to pygments lexers. If a mapping is not ~ defined for a certain file extension, we revert to the old behaviour ~ Previously, we guess what syntax highlighting to apply to files in the diff
~ viewer given their data and file extension. Sometimes this guess would be wrong, ~ and we have no way of setting what type of syntax highlighting gets applied to + files. This change adds a setting for mapping file extensions to pygments + lexers (the syntax highlighters), namely + reviewboard.admin.siteconfig.diffviewer_custom_pygments_lexers
. If a mapping+ is not defined for a certain file extension, we revert to the old behaviour of guessing which lexer to use given the filename and file contents. ~ Adds reviewboard.admin.form_widgets.LexersMappingWidget which partly
~ Adds
reviewboard.admin.form_widgets.LexersMappingWidget
which partlyhandles the UI for modifying this mapping. - Testing Done:
-
~ Created unit tests for the mapping in
~ reviewboard.diffviewer.tests.test_raw_diff_chunk_generator. ~ - Created unit tests for the mapping in
reviewboard.diffviewer.tests.test_raw_diff_chunk_generator
.
Ran all unit tests inreviewboard.diffviewer
with success
~ - Created the unit tests for the LexersMappingWidget in
reviewboard.admin.tests.test_lexers_mapping_widget
.
Ran all unit tests inreviewboard.admin.tests
with success.
- Ran all unit tests in reviewboard.diffviewer with success - - Created the unit tests for the LexersMappingWidget in
- reviewboard.admin.tests.test_lexers_mapping_widget. - Ran all unit tests in reviewboard.admin.tests with success. - Created unit tests for the mapping in
- Commits:
-
Summary ID Author 326476223e1163d83986d3857526c5f373f843fc Michelle 97c7be5b4bb62f77b72187f28879a7d77089ef10 Michelle - Diff:
-
Revision 19 (+654 -16)
Checks run (2 succeeded)
- Commits:
-
Summary ID Author 97c7be5b4bb62f77b72187f28879a7d77089ef10 Michelle d9de4e339566468c528b53f6f36ede7f7bb1ec25 Michelle - Diff:
-
Revision 20 (+656 -16)
Checks run (2 succeeded)
- Commits:
-
Summary ID Author d9de4e339566468c528b53f6f36ede7f7bb1ec25 Michelle 930128881e245f00cdc9f918b56bdf483d734336 Michelle - Diff:
-
Revision 21 (+680 -16)
Checks run (2 succeeded)
- Commits:
-
Summary ID Author 930128881e245f00cdc9f918b56bdf483d734336 Michelle aac35dd214d59c3a66996bae103eaee99691960d Michelle - Diff:
-
Revision 22 (+662 -16)