Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r86665 - in trunk/tools/quickbook: src test
From: dnljms_at_[hidden]
Date: 2013-11-12 15:34:23


Author: danieljames
Date: 2013-11-12 15:34:23 EST (Tue, 12 Nov 2013)
New Revision: 86665
URL: http://svn.boost.org/trac/boost/changeset/86665

Log:
Support source code tagging for lists.

Text files modified:
   trunk/tools/quickbook/src/actions.cpp | 5 +++++
   trunk/tools/quickbook/src/state.cpp | 2 +-
   trunk/tools/quickbook/test/source_mode-1_7.gold | 9 ++++++++-
   trunk/tools/quickbook/test/source_mode-1_7.quickbook | 3 ++-
   4 files changed, 16 insertions(+), 3 deletions(-)

Modified: trunk/tools/quickbook/src/actions.cpp
==============================================================================
--- trunk/tools/quickbook/src/actions.cpp Tue Nov 12 15:33:59 2013 (r86664)
+++ trunk/tools/quickbook/src/actions.cpp 2013-11-12 15:34:23 EST (Tue, 12 Nov 2013) (r86665)
@@ -510,6 +510,9 @@
 
     void state::start_list(char mark)
     {
+ push_tagged_source_mode(source_mode_next);
+ source_mode_next = 0;
+
         write_anchors(*this, (in_list ? phrase : out));
         assert(mark == '*' || mark == '#');
         push_output();
@@ -529,6 +532,8 @@
         pop_output();
 
         (in_list ? phrase : out) << list_output;
+
+ pop_tagged_source_mode();
     }
 
     void state::start_list_item()

Modified: trunk/tools/quickbook/src/state.cpp
==============================================================================
--- trunk/tools/quickbook/src/state.cpp Tue Nov 12 15:33:59 2013 (r86664)
+++ trunk/tools/quickbook/src/state.cpp 2013-11-12 15:34:23 EST (Tue, 12 Nov 2013) (r86665)
@@ -119,7 +119,7 @@
 
     void state::push_tagged_source_mode(source_mode_type s) {
         tagged_source_mode_stack.push_back(
- source_mode_info(s, get_new_order_pos()));
+ source_mode_info(s, s ? get_new_order_pos() : 0));
     }
 
     void state::pop_tagged_source_mode() {

Modified: trunk/tools/quickbook/test/source_mode-1_7.gold
==============================================================================
--- trunk/tools/quickbook/test/source_mode-1_7.gold Tue Nov 12 15:33:59 2013 (r86664)
+++ trunk/tools/quickbook/test/source_mode-1_7.gold 2013-11-12 15:34:23 EST (Tue, 12 Nov 2013) (r86665)
@@ -26,7 +26,14 @@
   <itemizedlist>
     <listitem>
       <simpara>
- Sadly this doesn't work.
+ <code><phrase role="keyword">int</phrase> <phrase role="identifier">main</phrase><phrase
+ role="special">()</phrase> <phrase role="special">{}</phrase></code>
+ </simpara>
+ </listitem>
+ <listitem>
+ <simpara>
+ <code><phrase role="keyword">int</phrase> <phrase role="identifier">main</phrase><phrase
+ role="special">()</phrase> <phrase role="special">{}</phrase></code>
       </simpara>
     </listitem>
     <listitem>

Modified: trunk/tools/quickbook/test/source_mode-1_7.quickbook
==============================================================================
--- trunk/tools/quickbook/test/source_mode-1_7.quickbook Tue Nov 12 15:33:59 2013 (r86664)
+++ trunk/tools/quickbook/test/source_mode-1_7.quickbook 2013-11-12 15:34:23 EST (Tue, 12 Nov 2013) (r86665)
@@ -8,5 +8,6 @@
 [!c++]`int main() {}` but `plain text`.
 
 [!c++]
-* Sadly this doesn't work.
 * `int main() {}`
+* `int main() {}`
+* [teletype] `int main() {}` [/ shouldn't be highlighted]


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk