diff --git a/doc/configuration.rst b/doc/configuration.rst index b859991..494b468 100644 --- a/doc/configuration.rst +++ b/doc/configuration.rst @@ -1616,6 +1616,18 @@ projects (from third party git server). Defaults to: ``False`` +SYNTAX_ALIAS_OVERRIDES +~~~~~~~~~~~~~~~~~~~~~~ + +This configuration key allows to force highlight.js to use a certain logic +on certain files based on their extensions. + +It should be a dictionary containing the file extensions as keys and +the highlighting language/category to use as values. + +Defaults to: ``{".spec": "specfile", ".patch": "diff"}`` + + RepoSpanner Options ------------------- diff --git a/pagure/templates/file.html b/pagure/templates/file.html index 1f94632..6a16801 100644 --- a/pagure/templates/file.html +++ b/pagure/templates/file.html @@ -173,7 +173,7 @@ {% endif %} {% if output_type=='file' %} -
{{ content }}
+ {{ content }}
{% elif output_type == 'markup' %}
foo\n bar
',
+ ''
+ 'foo\n bar
',
output_text
)
diff --git a/tests/test_pagure_flask_ui_repo.py b/tests/test_pagure_flask_ui_repo.py
index ab86f71..9bdb959 100644
--- a/tests/test_pagure_flask_ui_repo.py
+++ b/tests/test_pagure_flask_ui_repo.py
@@ -2239,7 +2239,8 @@ class PagureFlaskRepotests(tests.Modeltests):
self.assertEqual(output.status_code, 200)
output_text = output.get_data(as_text=True)
self.assertIn(
- 'foo\n bar
',
+ ''
+ 'foo\n bar
',
output_text)
# Empty files should also be displayed
@@ -2336,7 +2337,8 @@ class PagureFlaskRepotests(tests.Modeltests):
' Šource',
output_text)
self.assertIn(
- 'Row 0\n
',
+ ''
+ 'Row 0\n
',
output_text
)
@@ -2376,7 +2378,8 @@ class PagureFlaskRepotests(tests.Modeltests):
self.assertEqual(output.status_code, 200)
output_text = output.get_data(as_text=True)
self.assertIn(
- 'foo\n barRow 0\n'
+ ''
+ 'foo\n barRow 0\n'
'Row 1\nRow 2\nRow 3\nRow 4\nRow 5\nRow 6\nRow 7\nRow 8\n'
'Row 9\n
', output_text)
diff --git a/tests/test_pagure_flask_ui_repo_view_file.py b/tests/test_pagure_flask_ui_repo_view_file.py
index 7330024..a827369 100644
--- a/tests/test_pagure_flask_ui_repo_view_file.py
+++ b/tests/test_pagure_flask_ui_repo_view_file.py
@@ -99,7 +99,8 @@ class PagureFlaskRepoViewFiletests(LocalBasetests):
self.assertEqual(output.status_code, 200)
output_text = output.get_data(as_text=True)
self.assertIn(
- 'foo\n bar
',
+ ''
+ 'foo\n bar
',
output_text
)
@@ -213,7 +214,8 @@ class PagureFlaskRepoViewFiletests(LocalBasetests):
'text/html; charset=utf-8')
self.assertIn(' Šource', output_text)
self.assertIn(
- 'Row 0\n
',
+ ''
+ 'Row 0\n
',
output_text
)
@@ -313,7 +315,8 @@ class PagureFlaskRepoViewFileForktests(LocalBasetests):
self.assertEqual(output.status_code, 200)
output_text = output.get_data(as_text=True)
self.assertIn(
- 'foo\n barRow 0\n'
+ ''
+ 'foo\n barRow 0\n'
'Row 1\nRow 2\nRow 3\nRow 4\nRow 5\nRow 6\nRow 7\nRow 8\n'
'Row 9\n
', output_text
)
diff --git a/tests/test_pagure_flask_ui_slash_branch_name.py b/tests/test_pagure_flask_ui_slash_branch_name.py
index d2f5997..7bb19c5 100644
--- a/tests/test_pagure_flask_ui_slash_branch_name.py
+++ b/tests/test_pagure_flask_ui_slash_branch_name.py
@@ -225,7 +225,8 @@ class PagureFlaskSlashInBranchtests(tests.SimplePagureTest):
''', output_text)
self.assertIn(
- '*~
',
+ ''
+ '*~
',
output_text
)