From 9c97e5495ffeb57e2a89f7303d2977b886e56d73 Mon Sep 17 00:00:00 2001 From: 2bndy5 <2bndy5@gmail.com> Date: Tue, 15 Feb 2022 03:30:38 -0800 Subject: [PATCH 1/2] treat .unparsed as plain text #805 --- breathe/filetypes.py | 2 +- documentation/source/codeblocks.rst | 5 +++++ examples/specific/code_blocks.h | 5 +++++ 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/breathe/filetypes.py b/breathe/filetypes.py index f64b0092..47bce1a5 100644 --- a/breathe/filetypes.py +++ b/breathe/filetypes.py @@ -18,4 +18,4 @@ def get_extension(filename: str) -> str: # If the filename is just '.ext' then we get ('.ext', '') so we fall back to first part if # the second isn't there (first, second) = os.path.splitext(filename) - return (second or first).lstrip(".") + return (second or first).lstrip(".").replace("unparsed", "text") diff --git a/documentation/source/codeblocks.rst b/documentation/source/codeblocks.rst index ca3ed92e..fff93ec9 100644 --- a/documentation/source/codeblocks.rst +++ b/documentation/source/codeblocks.rst @@ -91,6 +91,11 @@ recognize the code block's contained syntax as a C++ snippet. * message(STATUS "Element is ${element}") * endforeach() * @endcode + * + * Another code-block that explicitly remains not highlighted. + * @code{.unparsed} + * Show this as is. + * @endcode */ void with_unannotated_cmake_code_block(); diff --git a/examples/specific/code_blocks.h b/examples/specific/code_blocks.h index 390616ba..d2ee92d1 100644 --- a/examples/specific/code_blocks.h +++ b/examples/specific/code_blocks.h @@ -16,6 +16,11 @@ void with_standard_code_block(); * message(STATUS "Element is ${element}") * endforeach() * @endcode + * + * Another code-block that explicitly remains not highlighted. + * @code{.unparsed} + * Show this as is. + * @endcode */ void with_unannotated_cmake_code_block(); From 5602cf5a7a1f4eb60bb85fdc3f86e7555349232e Mon Sep 17 00:00:00 2001 From: Michael Jones Date: Fri, 18 Feb 2022 15:28:17 +0000 Subject: [PATCH 2/2] Add explanatory comment for '.unparsed' As I don't feel it is completely obvious. --- breathe/filetypes.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/breathe/filetypes.py b/breathe/filetypes.py index 47bce1a5..f16776f3 100644 --- a/breathe/filetypes.py +++ b/breathe/filetypes.py @@ -18,4 +18,7 @@ def get_extension(filename: str) -> str: # If the filename is just '.ext' then we get ('.ext', '') so we fall back to first part if # the second isn't there (first, second) = os.path.splitext(filename) + + # Doxygen allows users to specify the file extension ".unparsed" to disable syntax highlighting. + # We translate it into the pygments unhighlighted 'text' type return (second or first).lstrip(".").replace("unparsed", "text")