Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r76647 - in branches/quickbook-dev/tools/quickbook: doc src test
From: dnljms_at_[hidden]
Date: 2012-01-22 18:08:22


Author: danieljames
Date: 2012-01-22 18:08:21 EST (Sun, 22 Jan 2012)
New Revision: 76647
URL: http://svn.boost.org/trac/boost/changeset/76647

Log:
Quickbook: Initial implementation of templates in link values.
Added:
   branches/quickbook-dev/tools/quickbook/test/link-1_7.gold (contents, props changed)
   branches/quickbook-dev/tools/quickbook/test/link-1_7.quickbook (contents, props changed)
Text files modified:
   branches/quickbook-dev/tools/quickbook/doc/1_6.qbk | 15 +++++++++++++++
   branches/quickbook-dev/tools/quickbook/src/grammar_impl.hpp | 1 +
   branches/quickbook-dev/tools/quickbook/src/main_grammar.cpp | 21 +++++++++++++++++++++
   branches/quickbook-dev/tools/quickbook/src/phrase_element_grammar.cpp | 4 +++-
   branches/quickbook-dev/tools/quickbook/test/Jamfile.v2 | 1 +
   5 files changed, 41 insertions(+), 1 deletions(-)

Modified: branches/quickbook-dev/tools/quickbook/doc/1_6.qbk
==============================================================================
--- branches/quickbook-dev/tools/quickbook/doc/1_6.qbk (original)
+++ branches/quickbook-dev/tools/quickbook/doc/1_6.qbk 2012-01-22 18:08:21 EST (Sun, 22 Jan 2012)
@@ -365,4 +365,19 @@
 
 [endsect] [/escaped_docinfo_attributes]
 
+[section:templates_in_link_values Templates in link values]
+
+There's very premilinary support for calling templates in link values. A lot
+more work needs to be done, including:
+
+* Considering other places where templates could be called (e.g. images are
+ quite tricky, as templates could get confused with attributes, should
+ templates be callable from something like an element's id?).
+* Trimming spaces from the body of the template (which can cause surprising
+ results).
+* Checking that the contents of the template are appropriate for the context.
+ Possibly even using a different grammar.
+
+[endsect] [/templates_in_link_values]
+
 [endsect] [/ Quickbok 1.7]

Modified: branches/quickbook-dev/tools/quickbook/src/grammar_impl.hpp
==============================================================================
--- branches/quickbook-dev/tools/quickbook/src/grammar_impl.hpp (original)
+++ branches/quickbook-dev/tools/quickbook/src/grammar_impl.hpp 2012-01-22 18:08:21 EST (Sun, 22 Jan 2012)
@@ -73,6 +73,7 @@
         cl::rule<scanner> inside_preformatted;
         cl::rule<scanner> inside_paragraph;
         cl::rule<scanner> command_line;
+ cl::rule<scanner> attribute_value_1_7;
         cl::rule<scanner> escape;
         cl::rule<scanner> raw_escape;
 

Modified: branches/quickbook-dev/tools/quickbook/src/main_grammar.cpp
==============================================================================
--- branches/quickbook-dev/tools/quickbook/src/main_grammar.cpp (original)
+++ branches/quickbook-dev/tools/quickbook/src/main_grammar.cpp 2012-01-22 18:08:21 EST (Sun, 22 Jan 2012)
@@ -753,6 +753,27 @@
                 ) [element]
             ;
 
+ attribute_value_1_7 =
+ *( ~cl::eps_p(']' | cl::space_p | comment)
+ >> ( cl::eps_p
+ ( cl::ch_p('[')
+ >> space
+ >> ( cl::eps_p(cl::punct_p)
+ >> elements
+ | elements
+ >> (cl::eps_p - (cl::alnum_p | '_'))
+ )
+ ) [error("Elements not allowed in attribute values.")]
+ >> local.square_brackets
+ | local.template_
+ | cl::eps_p(cl::ch_p('[')) [error("Unmatched template in attribute value.")]
+ >> local.square_brackets
+ | raw_escape
+ | cl::anychar_p [raw_char]
+ )
+ )
+ ;
+
         //
         // Command line
         //

Modified: branches/quickbook-dev/tools/quickbook/src/phrase_element_grammar.cpp
==============================================================================
--- branches/quickbook-dev/tools/quickbook/src/phrase_element_grammar.cpp (original)
+++ branches/quickbook-dev/tools/quickbook/src/phrase_element_grammar.cpp 2012-01-22 18:08:21 EST (Sun, 22 Jan 2012)
@@ -121,7 +121,7 @@
>> ( qbk_ver(0, 106u)
>> (*(cl::anychar_p - (']' | space)))
                                                 [state.values.entry(ph::arg1, ph::arg2)]
- | qbk_ver(106u)
+ | qbk_ver(106u, 107u)
>> to_value()
                     [ *( raw_escape
                         | (cl::anychar_p - (cl::ch_p('[') | ']' | space))
@@ -131,6 +131,8 @@
>> !( ~cl::eps_p(comment)
>> cl::eps_p('[') [error("Open bracket in link value.")]
                         )
+ | qbk_ver(107u)
+ >> to_value() [attribute_value_1_7]
                 )
>> hard_space
>> local.inner_phrase

Modified: branches/quickbook-dev/tools/quickbook/test/Jamfile.v2
==============================================================================
--- branches/quickbook-dev/tools/quickbook/test/Jamfile.v2 (original)
+++ branches/quickbook-dev/tools/quickbook/test/Jamfile.v2 2012-01-22 18:08:21 EST (Sun, 22 Jan 2012)
@@ -67,6 +67,7 @@
     [ quickbook-error-test include_win_path-1_6-fail ]
     [ quickbook-test link-1_1 ]
     [ quickbook-test link-1_6 ]
+ [ quickbook-test link-1_7 ]
     [ quickbook-test list_test-1_5 ]
     [ quickbook-test list_test-1_6 ]
     [ quickbook-test macro-1_5 ]

Added: branches/quickbook-dev/tools/quickbook/test/link-1_7.gold
==============================================================================
--- (empty file)
+++ branches/quickbook-dev/tools/quickbook/test/link-1_7.gold 2012-01-22 18:08:21 EST (Sun, 22 Jan 2012)
@@ -0,0 +1,44 @@
+<?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="link_tests" last-revision="DEBUG MODE Date: 2000/12/20 12:00:00 $" xmlns:xi="http://www.w3.org/2001/XInclude">
+ <title>Link tests</title>
+ <section id="link_tests.different_types_of_links">
+ <title><link linkend="link_tests.different_types_of_links">Different types of
+ links</link></title>
+ <para>
+ <ulink url="http://www.boost.org/">http://www.boost.org/> <ulink url="http://www.boost.org/">Boost</ulink>
+ <link linkend="link-id">link-id</link> <link linkend="link-id">Link Text</link>
+ <anchor id="link-id"/><functionname alt="foo">foo</functionname> <functionname
+ alt="foo">link text</functionname> <classname alt="foo">foo</classname> <classname
+ alt="foo">link text</classname> <methodname alt="foo">foo</methodname> <methodname
+ alt="foo">link text</methodname> <enumname alt="foo">foo</enumname> <enumname
+ alt="foo">link text</enumname> <macroname alt="foo">foo</macroname> <macroname
+ alt="foo">link text</macroname> <headername alt="foo">foo</headername> <headername
+ alt="foo">link text</headername> <conceptname alt="foo">foo</conceptname>
+ <conceptname alt="foo">link text</conceptname> <globalname alt="foo">foo</globalname>
+ <globalname alt="foo">link text</globalname>
+ </para>
+ <para>
+ <link linkend="link">description</link>
+ </para>
+ <para>
+ <link linkend="link[Hello]">description</link>
+ </para>
+ </section>
+ <section id="link_tests.side_by_side_links">
+ <title><link linkend="link_tests.side_by_side_links">Side-by-side links</link></title>
+ <para>
+ <link linkend="x">x</link> and <link linkend="y">y</link> are two distinct
+ links, which should be separated by whitespace when they appear together as
+ in <link linkend="x">x</link> <link linkend="y">y</link>. Also in <link linkend="x">x</link>
+ <link linkend="y">y</link>, and in <link linkend="x">x</link> <link linkend="y">y</link>
+ as well.
+ </para>
+ </section>
+ <section id="link_tests.templates_is_links">
+ <title><link linkend="link_tests.templates_is_links">Templates is links....</link></title>
+ <para>
+ <link linkend="blah.x2">Templated link?</link>
+ </para>
+ </section>
+</article>

Added: branches/quickbook-dev/tools/quickbook/test/link-1_7.quickbook
==============================================================================
--- (empty file)
+++ branches/quickbook-dev/tools/quickbook/test/link-1_7.quickbook 2012-01-22 18:08:21 EST (Sun, 22 Jan 2012)
@@ -0,0 +1,52 @@
+[article Link tests
+[quickbook 1.7]
+]
+
+[section Different types of links]
+
+[@http://www.boost.org/]
+[@ http://www.boost.org/ Boost]
+[link link-id]
+[link link-id Link Text]
+[#link-id]
+[funcref foo]
+[funcref foo link text]
+[classref foo]
+[classref foo link text]
+[memberref foo]
+[memberref foo link text]
+[enumref foo]
+[enumref foo link text]
+[macroref foo]
+[macroref foo link text]
+[headerref foo]
+[headerref foo link text]
+[conceptref foo]
+[conceptref foo link text]
+[globalref foo]
+[globalref foo link text]
+
+[link link[/ comment]description]
+
+[link link\[Hello\] description]
+
+
+[endsect]
+
+[section Side-by-side links]
+
+[link x] and [link y] are two distinct links, which should be separated by
+whitespace when they appear together as in [link x] [link y]. Also in [link x]
+[link y], and in
+[link x]
+[link y]
+as well.
+
+[endsect]
+
+[section Templates is links....]
+
+[template thing[]x]
+[link blah.[thing]2 Templated link?]
+
+[endsect]


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