on master help sign in
Fix broken resolv.conf highlighting

closes #1510 The change in `create_highlighted_versions.py` fixes a "unknown theme "'1337'" warning. The single quotes were wrong. `bat` was always falling back to the default theme, so let's use that for now.

commit94496df3b01dc874071b7e23fe52bd0aec332b74 authorDavid Peter <mail@david-peter.de> dateTue 16 Feb 2021, 21:39 (6 years ago) parent0e5ea9c
4 files changed+17−2
src/syntax_mapping.rs+5 tests/syntax-tests/create_highlighted_versions.py+4−2 tests/syntax-tests/highlighted/resolv.conf/resolv.conf+4 tests/syntax-tests/source/resolv.conf/resolv.conf+4
src/syntax_mapping.rs+5
@@ -57,6 +57,11 @@ impl<'a> SyntaxMapping<'a> {
5757 .insert("*.conf", MappingTarget::MapToUnknown)
5858 .unwrap();
5959
60+ // Re-insert a mapping for resolv.conf, see #1510
61+ mapping
62+ .insert("resolv.conf", MappingTarget::MapTo("resolv"))
63+ .unwrap();
64+
6065 for glob in &[
6166 "/etc/nginx/**/*.conf",
6267 "/etc/nginx/sites-*/**/*",
tests/syntax-tests/create_highlighted_versions.py+4−2
@@ -12,7 +12,7 @@ BAT_OPTIONS = [
1212 "--no-config",
1313 "--style=plain",
1414 "--color=always",
15− "--theme='1337'",
15+ "--theme=default",
1616 "--italic-text=always",
1717]
1818
@@ -41,7 +41,9 @@ def create_highlighted_versions(output_basepath):
4141 root = os.path.dirname(os.path.abspath(__file__))
4242 sources = path.join(root, "source", "*")
4343
44− for source in glob.glob(path.join(sources, "*")) + glob.glob(path.join(sources, ".*")):
44+ for source in glob.glob(path.join(sources, "*")) + glob.glob(
45+ path.join(sources, ".*")
46+ ):
4547 try:
4648 env = os.environ.copy()
4749 env.pop("PAGER", None)
tests/syntax-tests/highlighted/resolv.conf/resolv.confnew file+4
@@ -0,0 +1,4 @@
1+# A comment
2+domain example.com
3+nameserver 192.168.123.123
4+nameserver aa00::aaaa:0000:1234:abcd
tests/syntax-tests/source/resolv.conf/resolv.confnew file+4
@@ -0,0 +1,4 @@
1+# A comment
2+domain example.com
3+nameserver 192.168.123.123
4+nameserver aa00::aaaa:0000:1234:abcd