From e14f6ed69e23c10ed7088ce26586d67a7cf0a5d6 Mon Sep 17 00:00:00 2001 From: Peter Dimov Date: Tue, 15 Feb 2022 20:48:18 +0200 Subject: [PATCH] Add line numbers to examples, highlight throw line --- doc/examples.adoc | 20 ++++++++++++-------- doc/index-docinfo-footer.html | 3 +++ 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/doc/examples.adoc b/doc/examples.adoc index 105a0dd..aa4f52c 100644 --- a/doc/examples.adoc +++ b/doc/examples.adoc @@ -14,7 +14,8 @@ http://www.boost.org/LICENSE_1_0.txt Demonstrates the use of `BOOST_THROW_EXCEPTION`. -``` +[source,c++,linenums,highlight=8] +---- #include #include #include @@ -36,7 +37,7 @@ int main() std::cerr << boost::diagnostic_information( x ) << std::endl; } } -``` +---- Sample output: @@ -54,7 +55,8 @@ unnecessary code duplication. The source location is passed explicitly to the helper function so that it can still record the logical throw point, instead of always pointing into the helper. -``` +[source,c++,linenums,highlight=31] +---- #include #include #include @@ -101,7 +103,7 @@ int main() std::cerr << boost::diagnostic_information( x ) << std::endl; } } -``` +---- Sample output: @@ -117,7 +119,8 @@ This example demonstrates a trivial use of `boost::throw_with_location`. Since a source location is not supplied, the location of the call to `boost::throw_with_location` is implicitly captured. -``` +[source,c++,linenums,highlight=9] +---- #include #include #include @@ -139,7 +142,7 @@ int main() return f1( -4 ); } -``` +---- Sample output: @@ -164,7 +167,8 @@ in the program, this is usually what we want, because it enables us to identify the throwing call, rather than merely to know that it was `f2` that threw. -``` +[source,c++,linenums,highlight=38] +---- #include #include #include @@ -204,7 +208,7 @@ int main() return f1( 3 ) + f2( -11 ); } -``` +---- Sample output: diff --git a/doc/index-docinfo-footer.html b/doc/index-docinfo-footer.html index 51969f4..15563d2 100644 --- a/doc/index-docinfo-footer.html +++ b/doc/index-docinfo-footer.html @@ -3,4 +3,7 @@ *:not(pre)>code { background: none; color: #600000; } :not(pre):not([class^=L])>code { background: none; color: #600000; } +pre.rouge .hll { background-color: #ffd; } +pre.rouge .hll * { background-color: initial; } +