|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r60054 - in trunk/tools/quickbook: detail test
From: daniel_james_at_[hidden]
Date: 2010-03-01 14:40:31
Author: danieljames
Date: 2010-03-01 14:40:30 EST (Mon, 01 Mar 2010)
New Revision: 60054
URL: http://svn.boost.org/trac/boost/changeset/60054
Log:
Actually just pass through escaped unicoded characters as entities.
Text files modified:
trunk/tools/quickbook/detail/actions.cpp | 21 +++++++++------
trunk/tools/quickbook/test/unicode-escape.gold | 52 ++++++++++++++++++++--------------------
2 files changed, 38 insertions(+), 35 deletions(-)
Modified: trunk/tools/quickbook/detail/actions.cpp
==============================================================================
--- trunk/tools/quickbook/detail/actions.cpp (original)
+++ trunk/tools/quickbook/detail/actions.cpp 2010-03-01 14:40:30 EST (Mon, 01 Mar 2010)
@@ -14,7 +14,6 @@
#include <boost/filesystem/convenience.hpp>
#include <boost/filesystem/fstream.hpp>
#include <boost/lexical_cast.hpp>
-#include <boost/regex/pending/unicode_iterator.hpp>
#include "./quickbook.hpp"
#include "./actions.hpp"
#include "./utils.hpp"
@@ -418,16 +417,20 @@
void escape_unicode_action::operator()(iterator first, iterator last) const
{
- using namespace std;
- std::string value(first, last);
- boost::uint32_t unicode_value = strtol(value.c_str(), 0, 16);
- if(unicode_value < 128) {
- detail::print_char(unicode_value, phrase.get());
+ while(first != last && *first == '0') ++first;
+
+ // Just ignore \u0000
+ // Maybe I should issue a warning?
+ if(first == last) return;
+
+ std::string hex_digits(first, last);
+
+ if(hex_digits.size() == 2 && *first > '0' && *first <= '7') {
+ using namespace std;
+ detail::print_char(strtol(hex_digits.c_str(), 0, 16), phrase.get());
}
else {
- boost::utf8_output_iterator<ostream_iterator<char> > phrase_iter(
- ostream_iterator<char>(phrase.get()));
- *phrase_iter++ = unicode_value;
+ phrase << "&#x" << hex_digits << ";";
}
}
Modified: trunk/tools/quickbook/test/unicode-escape.gold
==============================================================================
--- trunk/tools/quickbook/test/unicode-escape.gold (original)
+++ trunk/tools/quickbook/test/unicode-escape.gold 2010-03-01 14:40:30 EST (Mon, 01 Mar 2010)
@@ -4,82 +4,82 @@
<title>UTF-8 test</title>
<articleinfo>
</articleinfo>
- <anchor id="utf_8_test.i__t__rn__ti__n__liz__ti__n"/>
+ <anchor id="utf_8_test.i__xf1_t__xeb_rn__xe2_ti__xf4_n__xe0_liz__xe6_ti__xf8_n"/>
<bridgehead renderas="sect2">
- <link linkend="utf_8_test.i__t__rn__ti__n__liz__ti__n">Iñtërnâtiônà lizætiøn</link>
+ <link linkend="utf_8_test.i__xf1_t__xeb_rn__xe2_ti__xf4_n__xe0_liz__xe6_ti__xf8_n">Iñtërnâtiônàlizætiøn</link>
</bridgehead>
<itemizedlist>
<listitem>
- Îα Alpha
+ Αα Alpha
</listitem>
<listitem>
- Îβ Beta
+ Ββ Beta
</listitem>
<listitem>
- Îγ Gamma
+ Γγ Gamma
</listitem>
<listitem>
- Îδ Delta
+ Δδ Delta
</listitem>
<listitem>
- Îε Epsilon
+ Εε Epsilon
</listitem>
<listitem>
- Îζ Zeta
+ Ζζ Zeta
</listitem>
<listitem>
- Îη Eta
+ Ηη Eta
</listitem>
<listitem>
- Îθ Theta
+ Θθ Theta
</listitem>
<listitem>
- Îι Iota
+ Ιι Iota
</listitem>
<listitem>
- Îκ Kappa
+ Κκ Kappa
</listitem>
<listitem>
- Îλ Lambda
+ Λλ Lambda
</listitem>
<listitem>
- Îμ Mu
+ Μμ Mu
</listitem>
<listitem>
- Îν Nu
+ Νν Nu
</listitem>
<listitem>
- Îξ Xi
+ Ξξ Xi
</listitem>
<listitem>
- Îο Omicron
+ Οο Omicron
</listitem>
<listitem>
- Î Ï Pi
+ Ππ Pi
</listitem>
<listitem>
- Î¡Ï Rho
+ Ρρ Rho
</listitem>
<listitem>
- ΣÏÏ Sigma
+ Σσς Sigma
</listitem>
<listitem>
- Î¤Ï Tau
+ Ττ Tau
</listitem>
<listitem>
- Î¥Ï
Upsilon
+ Υυ Upsilon
</listitem>
<listitem>
- Î¦Ï Phi
+ Φφ Phi
</listitem>
<listitem>
- Î§Ï Chi
+ Χχ Chi
</listitem>
<listitem>
- Î¨Ï Psi
+ Ψψ Psi
</listitem>
<listitem>
- Î©Ï Omega
+ Ωω Omega
</listitem>
</itemizedlist>
</article>
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