Update of /cvsroot/boost/boost/tools/quickbook
In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv15575
Modified Files:
code_snippet.hpp phrase.hpp
Log Message:
added callouts
Index: code_snippet.hpp
===================================================================
RCS file: /cvsroot/boost/boost/tools/quickbook/code_snippet.hpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- code_snippet.hpp 12 Jan 2007 05:39:52 -0000 1.2
+++ code_snippet.hpp 21 Feb 2007 00:48:28 -0000 1.3
@@ -18,8 +18,10 @@
struct cpp_code_snippet_grammar
: grammar<cpp_code_snippet_grammar>
{
- cpp_code_snippet_grammar(std::vector<template_symbol>& storage)
- : storage(storage) {}
+ cpp_code_snippet_grammar(std::vector<template_symbol>& storage,
std::string const& doc_id)
+ : storage(storage)
+ , doc_id(doc_id)
+ {}
template <typename Scanner>
struct definition
@@ -27,7 +29,7 @@
definition(cpp_code_snippet_grammar const& self)
{
typedef cpp_code_snippet_grammar self_type;
- start_ =
+ start_ =
+(
snippet
[boost::bind(&self_type::compile, &self, _1, _2)]
| anychar_p
@@ -38,18 +40,25 @@
(alpha_p | '_') >> *(alnum_p | '_')
;
- snippet =
+ snippet =
"//[" >> *space_p
>> identifier [assign_a(self.id)]
>> (*(code_elements - "//]"))
>> "//]"
;
-
+
code_elements =
- escaped_comment
+ escaped_comment
+ | callout
| (anychar_p - "//]")
[boost::bind(&self_type::pass_thru, &self, _1, _2)]
;
-
+
+ callout =
+ "/*<"
+ >> (*(anychar_p - ">*/"))
[boost::bind(&self_type::callout, &self, _1, _2)]
+ >> ">*/"
+ ;
+
escaped_comment =
*space_p >> "//`" >> *space_p
>> ((*(anychar_p - eol_p))
@@ -60,7 +69,7 @@
;
}
- rule<Scanner> start_, snippet, identifier, code_elements,
escaped_comment;
+ rule<Scanner> start_, snippet, identifier, code_elements,
escaped_comment, callout;
rule<Scanner> const&
start() const { return start_; }
@@ -69,10 +78,13 @@
void pass_thru(iterator first, iterator last) const;
void escaped_comment(iterator first, iterator last) const;
void compile(iterator first, iterator last) const;
+ void callout(iterator first, iterator last) const;
mutable std::string code;
mutable std::string snippet;
mutable std::string id;
+ mutable std::vector<std::string> callouts;
+ std::string doc_id;
std::vector<template_symbol>& storage;
};
}
Index: phrase.hpp
===================================================================
RCS file: /cvsroot/boost/boost/tools/quickbook/phrase.hpp,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -d -r1.21 -r1.22
--- phrase.hpp 19 Nov 2006 16:11:51 -0000 1.21
+++ phrase.hpp 21 Feb 2007 00:48:28 -0000 1.22
@@ -31,10 +31,10 @@
(
graph_p // A single char. e.g. *c*
>> eps_p(mark
- >> (space_p | punct_p | end_p))
- // space_p, punct_p or end_p
+ >> (space_p | punct_p | end_p))
+ // space_p, punct_p or end_p
) // must follow mark
- |
+ |
( graph_p >> // graph_p must follow mark
*(anychar_p -
( eol // Make sure that we don't go
@@ -42,14 +42,14 @@
)
) >> graph_p // graph_p must precede mark
>> eps_p(mark
- >> (space_p | punct_p | end_p))
- // space_p, punct_p or end_p
+ >> (space_p | punct_p | end_p))
+ // space_p, punct_p or end_p
) // must follow mark
) [action]
>> mark
;
}
-
+
template <typename Actions>
struct phrase_grammar : grammar<phrase_grammar<Actions> >
{
@@ -94,7 +94,7 @@
)
[actions.comment]
;
-
+
dummy_block =
'[' >> *(dummy_block | (anychar_p - ']')) >> ']'
;
@@ -108,13 +108,13 @@
| escape
| comment
;
-
- macro =
+
+ macro =
eps_p(actions.macro // must not be
followed by
>> (eps_p - (alpha_p | '_'))) // alpha or underscore
>> actions.macro [actions.do_macro]
;
-
+
template_args =
template_arg
[push_back_a(actions.template_info)]
>> *(
@@ -124,7 +124,7 @@
template_ =
(
- (eps_p(punct_p)
+ (eps_p(punct_p)
>> actions.templates.scope
)
[push_back_a(actions.template_info)]
>> !template_args
@@ -133,16 +133,16 @@
(actions.templates.scope
>> eps_p
)
[push_back_a(actions.template_info)]
- >> !(hard_space
+ >> !(hard_space
>> template_args)
)
;
- brackets =
+ brackets =
'[' >> +template_arg >> ']'
;
- template_arg =
+ template_arg =
+(brackets | (anychar_p - (str_p("..") | ']')))
;
@@ -159,12 +159,22 @@
;
code_block =
- "``" >>
- (
- *(anychar_p - "``")
- >> eps_p("``")
- ) [actions.code_block]
- >> "``"
+ (
+ "```" >>
+ (
+ *(anychar_p - "```")
+ >> eps_p("```")
+ ) [actions.code_block]
+ >> "```"
+ )
+ | (
+ "``" >>
+ (
+ *(anychar_p - "``")
+ >> eps_p("``")
+ ) [actions.code_block]
+ >> "``"
+ )
;
simple_format =
@@ -174,13 +184,13 @@
| simple_teletype
;
- simple_markup(simple_bold,
+ simple_markup(simple_bold,
'*', actions.simple_bold, eol);
- simple_markup(simple_italic,
+ simple_markup(simple_italic,
'/', actions.simple_italic, eol);
- simple_markup(simple_underline,
+ simple_markup(simple_underline,
'_', actions.simple_underline, eol);
- simple_markup(simple_teletype,
+ simple_markup(simple_teletype,
'=', actions.simple_teletype, eol);
phrase =
@@ -197,7 +207,7 @@
| url
| link
| anchor
- | source_mode
+ | source_mode
| funcref
| classref
| memberref
@@ -349,7 +359,7 @@
ch_p('-')
[actions.strikethrough_pre]
>> blank >> phrase
[actions.strikethrough_post]
;
-
+
quote =
ch_p('"') [actions.quote_pre]
>> blank >> phrase [actions.quote_post]
@@ -372,13 +382,13 @@
>> blank >> phrase [actions.footnote_post]
;
}
-
- rule<Scanner> space, blank, comment, phrase, phrase_markup,
image,
- close_bracket, bold, italic, underline, teletype,
- strikethrough, escape, url, common, funcref,
+
+ rule<Scanner> space, blank, comment, phrase, phrase_markup,
image,
+ close_bracket, bold, italic, underline, teletype,
+ strikethrough, escape, url, common, funcref,
classref, memberref, enumref, macroref, headerref,
conceptref,
- anchor, link, hard_space, eol, inline_code,
simple_format,
- simple_bold, simple_italic, simple_underline,
+ anchor, link, hard_space, eol, inline_code,
simple_format,
+ simple_bold, simple_italic, simple_underline,
simple_teletype, source_mode, template_,
template_arg,
quote, code_block, footnote, replaceable, macro,
brackets, template_args, dummy_block;
@@ -420,7 +430,7 @@
)
[actions.comment]
;
-
+
dummy_block =
'[' >> *(dummy_block | (anychar_p - ']')) >> ']'
;
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Boost-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/boost-cvs