summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGrégoire Duchêne <gduchene@fastmail.net>2010-12-06 08:04:58 +0100
committerGrégoire Duchêne <gduchene@fastmail.net>2010-12-06 08:04:58 +0100
commit52abe044a7b6b8be364f91be4ab52d4972431163 (patch)
tree0162ea42d13efd495831ec28da93d57f1eda39b1
parent8b189b14c897058dd9ef4d67f42c04d23bdee84f (diff)
Superscript text support added.
-rw-r--r--src/elements.h3
-rw-r--r--src/generators/latex/text_g.cpp3
-rw-r--r--src/parser/document_p.cpp2
-rw-r--r--src/parser/text_p.cpp4
4 files changed, 8 insertions, 4 deletions
diff --git a/src/elements.h b/src/elements.h
index 2c6cf1d..7f77914 100644
--- a/src/elements.h
+++ b/src/elements.h
@@ -33,7 +33,8 @@ enum stattribute_t {
ALT,
SALT,
CODE,
- MATH
+ MATH,
+ SUPER
};
struct stext_t {
diff --git a/src/generators/latex/text_g.cpp b/src/generators/latex/text_g.cpp
index c7cc2a0..3a4d066 100644
--- a/src/generators/latex/text_g.cpp
+++ b/src/generators/latex/text_g.cpp
@@ -27,7 +27,8 @@ latex::text_g::text_g() : text_g::base_type(text_) {
| &uint_(ALT) << L"\\textit{" << +text_ << '}'
| &uint_(SALT) << L"\\textit{\\textbf{" << +text_ << L"}}"
| &uint_(CODE) << L"\\texttt{" << +text_ << '}'
- | &uint_(MATH) << L"$" << +text_ << '$';
+ | &uint_(MATH) << L"$" << +text_ << '$'
+ | &uint_(SUPER) << L"^{" << +text_ << '}';
ptext_ = +char_;
}
diff --git a/src/parser/document_p.cpp b/src/parser/document_p.cpp
index 7852649..1c1a884 100644
--- a/src/parser/document_p.cpp
+++ b/src/parser/document_p.cpp
@@ -16,5 +16,5 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include "document_p.h"
document_p::document_p() : document_p::base_type(document_) {
- document_ = +text_(ph::val(L"*'`$"));
+ document_ = +text_(ph::val(L"*'`$^"));
}
diff --git a/src/parser/text_p.cpp b/src/parser/text_p.cpp
index 2fcdc7c..658aad0 100644
--- a/src/parser/text_p.cpp
+++ b/src/parser/text_p.cpp
@@ -28,7 +28,9 @@ text_p::text_p() : text_p::base_type(text_) {
| lit("''") >> attr(SALT) >> +text_(_r1)>> "''"
| lit('\'') >> attr(ALT) >> +text_(_r1) >> '\''
| lit('`') >> attr(CODE) >> +ptext_(val(L"`")) >> '`'
- | lit('$') >> attr(MATH) >> +ptext_(val(L"$")) >> '$';
+ | lit('$') >> attr(MATH) >> +ptext_(val(L"$")) >> '$'
+ | lit("^{") >> attr(SUPER) >> +text_(val(L"*'`$^}")) >> '}'
+ | lit('^') >> attr(SUPER) >> +text_(val(L"*'`$ "));
ptext_ = +(echar_ | rchar_(_r1));
echar_ = lit('\\') >> char_;