Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r67090 - in trunk/tools: boostbook/test/more/tests/book boostbook/xsl quickbook/src quickbook/test
From: dnljms_at_[hidden]
Date: 2010-12-07 15:44:25


Author: danieljames
Date: 2010-12-07 15:44:23 EST (Tue, 07 Dec 2010)
New Revision: 67090
URL: http://svn.boost.org/trac/boost/changeset/67090

Log:
Implement lang attribute in quickbook/boostbook.
Added:
   trunk/tools/boostbook/test/more/tests/book/chapter.gold (contents, props changed)
   trunk/tools/boostbook/test/more/tests/book/chapter.xml
      - copied, changed from r67089, /trunk/tools/boostbook/test/more/tests/book/boostbook.xml
   trunk/tools/boostbook/test/more/tests/book/library-autoid.gold (contents, props changed)
   trunk/tools/boostbook/test/more/tests/book/library-autoid.xml (contents, props changed)
   trunk/tools/boostbook/test/more/tests/book/library.gold (contents, props changed)
   trunk/tools/boostbook/test/more/tests/book/library.xml
      - copied, changed from r67089, /trunk/tools/boostbook/test/more/tests/book/boostbook.xml
Text files modified:
   trunk/tools/boostbook/test/more/tests/book/boostbook.gold | 2 +-
   trunk/tools/boostbook/test/more/tests/book/boostbook.xml | 3 ++-
   trunk/tools/boostbook/test/more/tests/book/chapter.xml | 9 +++++----
   trunk/tools/boostbook/test/more/tests/book/library.xml | 6 +++---
   trunk/tools/boostbook/xsl/docbook.xsl | 21 ++++++++++-----------
   trunk/tools/quickbook/src/actions_class.cpp | 1 +
   trunk/tools/quickbook/src/actions_class.hpp | 2 ++
   trunk/tools/quickbook/src/doc_info_actions.cpp | 7 +++++++
   trunk/tools/quickbook/src/doc_info_grammar.cpp | 9 ++++++++-
   trunk/tools/quickbook/test/doc-info-1.gold | 4 ++--
   trunk/tools/quickbook/test/doc-info-1.quickbook | 1 +
   11 files changed, 42 insertions(+), 23 deletions(-)

Modified: trunk/tools/boostbook/test/more/tests/book/boostbook.gold
==============================================================================
--- trunk/tools/boostbook/test/more/tests/book/boostbook.gold (original)
+++ trunk/tools/boostbook/test/more/tests/book/boostbook.gold 2010-12-07 15:44:23 EST (Tue, 07 Dec 2010)
@@ -1,4 +1,4 @@
 <!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
-<book xmlns:xi="http://www.w3.org/2001/XInclude" id="test" last-revision="$Date: 2010-10-30 15:29:27 +0100 (Sat, 30 Oct 2010) $">
+<book xmlns:xi="http://www.w3.org/2001/XInclude" id="test" lang="en">
   <title>Test 'boostbook' root.</title>
 </book>
\ No newline at end of file

Modified: trunk/tools/boostbook/test/more/tests/book/boostbook.xml
==============================================================================
--- trunk/tools/boostbook/test/more/tests/book/boostbook.xml (original)
+++ trunk/tools/boostbook/test/more/tests/book/boostbook.xml 2010-12-07 15:44:23 EST (Tue, 07 Dec 2010)
@@ -2,7 +2,8 @@
 <!DOCTYPE boostbook PUBLIC "-//Boost//DTD BoostBook XML V1.0//EN"
   "http://www.boost.org/tools/boostbook/dtd/boostbook.dtd">
 <boostbook id="test" xmlns:xi="http://www.w3.org/2001/XInclude"
- last-revision="$Date: 2010-10-30 15:29:27 +0100 (Sat, 30 Oct 2010) $">
+ last-revision="$Date: 2010-10-30 15:29:27 +0100 (Sat, 30 Oct 2010) $"
+ lang="en">
   <title>Test 'boostbook' root.</title>
 </boostbook>
 

Added: trunk/tools/boostbook/test/more/tests/book/chapter.gold
==============================================================================
--- (empty file)
+++ trunk/tools/boostbook/test/more/tests/book/chapter.gold 2010-12-07 15:44:23 EST (Tue, 07 Dec 2010)
@@ -0,0 +1,4 @@
+<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
+<chapter id="test" last-revision="$Date: 2010-10-30 15:29:27 +0100 (Sat, 30 Oct 2010) $" lang="en">
+ <title>Test 'boostbook' root.</title>
+</chapter>
\ No newline at end of file

Copied: trunk/tools/boostbook/test/more/tests/book/chapter.xml (from r67089, /trunk/tools/boostbook/test/more/tests/book/boostbook.xml)
==============================================================================
--- /trunk/tools/boostbook/test/more/tests/book/boostbook.xml (original)
+++ trunk/tools/boostbook/test/more/tests/book/chapter.xml 2010-12-07 15:44:23 EST (Tue, 07 Dec 2010)
@@ -1,9 +1,10 @@
 <?xml version="1.0" encoding="utf-8"?>
-<!DOCTYPE boostbook PUBLIC "-//Boost//DTD BoostBook XML V1.0//EN"
+<!DOCTYPE chapter PUBLIC "-//Boost//DTD BoostBook XML V1.0//EN"
   "http://www.boost.org/tools/boostbook/dtd/boostbook.dtd">
-<boostbook id="test" xmlns:xi="http://www.w3.org/2001/XInclude"
- last-revision="$Date: 2010-10-30 15:29:27 +0100 (Sat, 30 Oct 2010) $">
+<chapter id="test" xmlns:xi="http://www.w3.org/2001/XInclude"
+ last-revision="$Date: 2010-10-30 15:29:27 +0100 (Sat, 30 Oct 2010) $"
+ lang="en">
   <title>Test 'boostbook' root.</title>
-</boostbook>
+</chapter>
 
 

Added: trunk/tools/boostbook/test/more/tests/book/library-autoid.gold
==============================================================================
--- (empty file)
+++ trunk/tools/boostbook/test/more/tests/book/library-autoid.gold 2010-12-07 15:44:23 EST (Tue, 07 Dec 2010)
@@ -0,0 +1,4 @@
+<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
+<chapter lang="en" id="id1-bb">
+ <title>Test 'boostbook' root.</title>
+</chapter>
\ No newline at end of file

Added: trunk/tools/boostbook/test/more/tests/book/library-autoid.xml
==============================================================================
--- (empty file)
+++ trunk/tools/boostbook/test/more/tests/book/library-autoid.xml 2010-12-07 15:44:23 EST (Tue, 07 Dec 2010)
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE library PUBLIC "-//Boost//DTD BoostBook XML V1.0//EN"
+ "http://www.boost.org/tools/boostbook/dtd/boostbook.dtd">
+<library lang="en">
+ <title>Test 'boostbook' root.</title>
+</library>
+
+

Added: trunk/tools/boostbook/test/more/tests/book/library.gold
==============================================================================
--- (empty file)
+++ trunk/tools/boostbook/test/more/tests/book/library.gold 2010-12-07 15:44:23 EST (Tue, 07 Dec 2010)
@@ -0,0 +1,4 @@
+<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
+<chapter xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" id="test" rev:last-revision="$Date: 2010-10-30 15:29:27 +0100 (Sat, 30 Oct 2010) $">
+ <title>Test 'boostbook' root.</title>
+</chapter>
\ No newline at end of file

Copied: trunk/tools/boostbook/test/more/tests/book/library.xml (from r67089, /trunk/tools/boostbook/test/more/tests/book/boostbook.xml)
==============================================================================
--- /trunk/tools/boostbook/test/more/tests/book/boostbook.xml (original)
+++ trunk/tools/boostbook/test/more/tests/book/library.xml 2010-12-07 15:44:23 EST (Tue, 07 Dec 2010)
@@ -1,9 +1,9 @@
 <?xml version="1.0" encoding="utf-8"?>
-<!DOCTYPE boostbook PUBLIC "-//Boost//DTD BoostBook XML V1.0//EN"
+<!DOCTYPE library PUBLIC "-//Boost//DTD BoostBook XML V1.0//EN"
   "http://www.boost.org/tools/boostbook/dtd/boostbook.dtd">
-<boostbook id="test" xmlns:xi="http://www.w3.org/2001/XInclude"
+<library id="test" xmlns:xi="http://www.w3.org/2001/XInclude"
            last-revision="$Date: 2010-10-30 15:29:27 +0100 (Sat, 30 Oct 2010) $">
   <title>Test 'boostbook' root.</title>
-</boostbook>
+</library>
 
 

Modified: trunk/tools/boostbook/xsl/docbook.xsl
==============================================================================
--- trunk/tools/boostbook/xsl/docbook.xsl (original)
+++ trunk/tools/boostbook/xsl/docbook.xsl 2010-12-07 15:44:23 EST (Tue, 07 Dec 2010)
@@ -399,16 +399,12 @@
                   ($boost.include.libraries='' or
                    contains($boost.include.libraries, @id))">
       <chapter>
- <xsl:attribute name="id">
- <xsl:choose>
- <xsl:when test="@id">
- <xsl:value-of select="@id"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:call-template name="generate.id"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:attribute>
+ <xsl:copy-of select="@*[not(contains(' last-revision name dirname html-only url ', concat(' ',local-name(),' ')))]"/>
+ <xsl:if test="not(@id)">
+ <xsl:attribute name="id">
+ <xsl:call-template name="generate.id"/>
+ </xsl:attribute>
+ </xsl:if>
 
         <xsl:if test="@last-revision">
           <xsl:attribute
@@ -437,7 +433,10 @@
   </xsl:template>
 
   <xsl:template match="boostbook">
- <book><xsl:copy-of select="@*"/><xsl:apply-templates/></book>
+ <book>
+ <xsl:copy-of select="@*[not(contains(' last-revision name dirname html-only url ', concat(' ',local-name(),' ')))]"/>
+ <xsl:apply-templates/>
+ </book>
   </xsl:template>
 
   <xsl:template match="programlisting">

Modified: trunk/tools/quickbook/src/actions_class.cpp
==============================================================================
--- trunk/tools/quickbook/src/actions_class.cpp (original)
+++ trunk/tools/quickbook/src/actions_class.cpp 2010-12-07 15:44:23 EST (Tue, 07 Dec 2010)
@@ -83,6 +83,7 @@
         , extract_doc_last_revision(doc_last_revision, phrase)
         , extract_doc_category(doc_category, phrase)
         , extract_doc_biblioid(doc_biblioid.second, phrase)
+ , extract_doc_lang(doc_lang, phrase)
         , code(out, phrase, *this)
         , code_block(phrase, phrase, *this)
         , inline_code(phrase, *this)

Modified: trunk/tools/quickbook/src/actions_class.hpp
==============================================================================
--- trunk/tools/quickbook/src/actions_class.hpp (original)
+++ trunk/tools/quickbook/src/actions_class.hpp 2010-12-07 15:44:23 EST (Tue, 07 Dec 2010)
@@ -51,6 +51,7 @@
         docinfo_string doc_license;
         docinfo_string doc_last_revision;
         biblioid_list doc_biblioid_items;
+ docinfo_string doc_lang;
         std::string include_doc_id;
         //temporary state
         biblioid_item doc_biblioid;
@@ -136,6 +137,7 @@
         phrase_to_docinfo_action extract_doc_last_revision;
         phrase_to_docinfo_action extract_doc_category;
         phrase_to_docinfo_action extract_doc_biblioid;
+ phrase_to_docinfo_action extract_doc_lang;
 
         code_action code;
         code_action code_block;

Modified: trunk/tools/quickbook/src/doc_info_actions.cpp
==============================================================================
--- trunk/tools/quickbook/src/doc_info_actions.cpp (original)
+++ trunk/tools/quickbook/src/doc_info_actions.cpp 2010-12-07 15:44:23 EST (Tue, 07 Dec 2010)
@@ -143,6 +143,13 @@
             << actions.doc_id
             << "\"\n";
         
+ if(!actions.doc_lang.empty())
+ {
+ out << " lang=\""
+ << actions.doc_lang.get(106)
+ << "\"\n";
+ }
+
         if(actions.doc_type == "library")
         {
             out << " name=\"" << actions.doc_title.get(106) << "\"\n";

Modified: trunk/tools/quickbook/src/doc_info_grammar.cpp
==============================================================================
--- trunk/tools/quickbook/src/doc_info_grammar.cpp (original)
+++ trunk/tools/quickbook/src/doc_info_grammar.cpp 2010-12-07 15:44:23 EST (Tue, 07 Dec 2010)
@@ -33,7 +33,7 @@
                         doc_info, doc_title, doc_version, doc_id, doc_dirname,
                         doc_copyright, doc_purpose, doc_category, doc_authors,
                         doc_author, space, hard_space, doc_license,
- doc_last_revision, doc_source_mode, doc_biblioid,
+ doc_last_revision, doc_source_mode, doc_biblioid, doc_lang,
                         phrase, quickbook_version, char_, comment, dummy_block;
         phrase_grammar common;
         cl::symbols<> doc_types;
@@ -81,6 +81,7 @@
                     | doc_last_revision
                     | doc_source_mode
                     | doc_biblioid
+ | doc_lang
                     )
>> space >> ']' >> +cl::eol_p
                 )
@@ -189,6 +190,12 @@
                                             [cl::push_back_a(actions.doc_biblioid_items, actions.doc_biblioid)]
             ;
 
+ doc_lang =
+ "lang" >> hard_space
+ >> (*(~cl::eps_p(']') >> char_))
+ [actions.extract_doc_lang]
+ ;
+
         comment =
             "[/" >> *(dummy_block | (cl::anychar_p - ']')) >> ']'
             ;

Modified: trunk/tools/quickbook/test/doc-info-1.gold
==============================================================================
--- trunk/tools/quickbook/test/doc-info-1.gold (original)
+++ trunk/tools/quickbook/test/doc-info-1.gold 2010-12-07 15:44:23 EST (Tue, 07 Dec 2010)
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE article PUBLIC "-//Boost//DTD BoostBook XML V1.0//EN" "http://www.boost.org/tools/boostbook/dtd/boostbook.dtd">
-<article id="karel_vom_u00e1_u010dka_and_tom_u00e1_u0161_martin_u00edk" last-revision="DEBUG MODE Date: 2000/12/20 12:00:00 $"
- xmlns:xi="http://www.w3.org/2001/XInclude">
+<article id="karel_vom_u00e1_u010dka_and_tom_u00e1_u0161_martin_u00edk" lang="en"
+last-revision="DEBUG MODE Date: 2000/12/20 12:00:00 $" xmlns:xi="http://www.w3.org/2001/XInclude">
   <title>Karel Vom&#xE1;&#x10D;ka and Tom&#xE1;&#x161; Martin&#xED;k</title>
   <articleinfo>
     <authorgroup>

Modified: trunk/tools/quickbook/test/doc-info-1.quickbook
==============================================================================
--- trunk/tools/quickbook/test/doc-info-1.quickbook (original)
+++ trunk/tools/quickbook/test/doc-info-1.quickbook 2010-12-07 15:44:23 EST (Tue, 07 Dec 2010)
@@ -8,4 +8,5 @@
 [category irrelevance]
 [/ [category commented out] ]
 [biblioid uri http://www.boost.org/tools/quickbook/test/doc-info-1.quickbook]
+[lang en]
 ]


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