summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGrégoire Duchêne <gduchene@fastmail.net>2010-12-05 23:13:29 +0100
committerGrégoire Duchêne <gduchene@fastmail.net>2010-12-05 23:13:29 +0100
commit1c52895b126efe2e0b715608978a76a779d4ecf9 (patch)
tree96c0fa06639e9a68c75b6c30ed5639ad1d5ddd7b
parentf7d1468cc0fe4237b702252f9bbaae5ba61b6bfd (diff)
Inline math 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.cpp13
4 files changed, 12 insertions, 9 deletions
diff --git a/src/elements.h b/src/elements.h
index 78560d7..2c6cf1d 100644
--- a/src/elements.h
+++ b/src/elements.h
@@ -32,7 +32,8 @@ enum stattribute_t {
VSEMPH,
ALT,
SALT,
- CODE
+ CODE,
+ MATH
};
struct stext_t {
diff --git a/src/generators/latex/text_g.cpp b/src/generators/latex/text_g.cpp
index 93b1716..940e734 100644
--- a/src/generators/latex/text_g.cpp
+++ b/src/generators/latex/text_g.cpp
@@ -26,7 +26,8 @@ latex::text_g::text_g() : text_g::base_type(text_) {
| &uint_(VSEMPH) << L"\\texttt{\\textit{\\emph{" << +text_ << L"}}}"
| &uint_(ALT) << L"\\texttt{" << +text_ << '}'
| &uint_(SALT) << L"\\texttt{\\textbf{" << +text_ << L"}}"
- | &uint_(CODE) << L"\\texttt{" << +text_ << '}';
+ | &uint_(CODE) << L"\\texttt{" << +text_ << '}'
+ | &uint_(MATH) << L"$" << +text_ << '$';
ptext_ = +char_;
}
diff --git a/src/parser/document_p.cpp b/src/parser/document_p.cpp
index f4a95e2..7852649 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 46dd37b..2fcdc7c 100644
--- a/src/parser/text_p.cpp
+++ b/src/parser/text_p.cpp
@@ -22,12 +22,13 @@ text_p::text_p() : text_p::base_type(text_) {
text_ = stext_(_r1) | ptext_(_r1);
- stext_ = lit("***") >> attr(VSEMPH) >> +text_(val(L"*'`")) >> "***"
- | lit("**") >> attr(SEMPH) >> +text_(val(L"*'`")) >> "**"
- | lit('*') >> attr(EMPH) >> +text_(val(L"*'`")) >> '*'
- | lit("''") >> attr(SALT) >> +text_(val(L"*'`"))>> "''"
- | lit('\'') >> attr(ALT) >> +text_(val(L"*'`")) >> '\''
- | lit('`') >> attr(CODE) >> +ptext_(val(L"`")) >> '`';
+ stext_ = lit("***") >> attr(VSEMPH) >> +text_(_r1) >> "***"
+ | lit("**") >> attr(SEMPH) >> +text_(_r1) >> "**"
+ | lit('*') >> attr(EMPH) >> +text_(_r1) >> '*'
+ | lit("''") >> attr(SALT) >> +text_(_r1)>> "''"
+ | lit('\'') >> attr(ALT) >> +text_(_r1) >> '\''
+ | lit('`') >> attr(CODE) >> +ptext_(val(L"`")) >> '`'
+ | lit('$') >> attr(MATH) >> +ptext_(val(L"$")) >> '$';
ptext_ = +(echar_ | rchar_(_r1));
echar_ = lit('\\') >> char_;