Quickbook: support escapes in simple markup.

[SVN r70204]
This commit is contained in:
Daniel James
2011-03-19 19:13:38 +00:00
parent f317bddc34
commit 35cae039f4
10 changed files with 138 additions and 60 deletions

View File

@@ -7,7 +7,6 @@
http://www.boost.org/LICENSE_1_0.txt)
=============================================================================*/
#include "post_process.hpp"
#include "input_path.hpp"
#include <boost/spirit/include/classic_core.hpp>
#include <boost/bind.hpp>
#include <set>
@@ -403,6 +402,9 @@ namespace quickbook
void do_end_tag(iter_type f, iter_type l) const
{
if (state.tags.empty())
throw quickbook::post_process_failure("Mismatched tags.");
bool is_flow_tag = state.is_flow_tag(state.tags.top());
if (!is_flow_tag)
{
@@ -419,9 +421,8 @@ namespace quickbook
int indent;
};
int post_process(
std::string post_process(
std::string const& in
, std::ostream& out
, int indent
, int linewidth)
{
@@ -430,36 +431,17 @@ namespace quickbook
if (linewidth == -1)
linewidth = 80; // set default to 80
try
std::string tidy;
tidy_compiler state(tidy, linewidth);
tidy_grammar g(state, indent);
cl::parse_info<iter_type> r = parse(in.begin(), in.end(), g, cl::space_p);
if (r.full)
{
std::string tidy;
tidy_compiler state(tidy, linewidth);
tidy_grammar g(state, indent);
cl::parse_info<iter_type> r = parse(in.begin(), in.end(), g, cl::space_p);
if (r.full)
{
out << tidy;
return 0;
}
else
{
// fallback!
::quickbook::detail::outerr()
<< "Warning: Post Processing Failed."
<< std::endl;
out << in;
return 1;
}
return tidy;
}
catch(...)
else
{
// fallback!
::quickbook::detail::outerr()
<< "Post Processing Failed."
<< std::endl;
out << in;
return 1;
throw quickbook::post_process_failure("Post Processing Failed.");
}
}
}