diff options
| author | Grégoire Duchêne <gduchene@fastmail.net> | 2011-03-11 16:53:04 +0100 |
|---|---|---|
| committer | Grégoire Duchêne <gduchene@fastmail.net> | 2011-03-11 16:57:33 +0100 |
| commit | e837682344d6edd2012d1ab2fd30d77ffa486593 (patch) | |
| tree | 4ce2a33d6bd68d1e88dc57cb6b446b75c940da93 /src | |
| parent | 7acf15c1f0623f157e6abdf4a9bff5b050add967 (diff) | |
Paragraph element added.
This element will allow me to add more cool things like real paragraphs,
lists, or quotation blocks. Please check the MDOWN file for an
exhaustive list of blocks.
Diffstat (limited to 'src')
| -rw-r--r-- | src/elements.h | 3 | ||||
| -rw-r--r-- | src/generators/latex/paragraph_g.cpp | 20 | ||||
| -rw-r--r-- | src/generators/latex/paragraph_g.h | 32 | ||||
| -rw-r--r-- | src/generators/latex_g.cpp | 2 | ||||
| -rw-r--r-- | src/generators/latex_g.h | 4 | ||||
| -rw-r--r-- | src/parser/document_p.cpp | 2 | ||||
| -rw-r--r-- | src/parser/document_p.h | 5 | ||||
| -rw-r--r-- | src/parser/paragraph_p.cpp | 20 | ||||
| -rw-r--r-- | src/parser/paragraph_p.h | 31 |
9 files changed, 112 insertions, 7 deletions
diff --git a/src/elements.h b/src/elements.h index 0c7b1bf..88161e1 100644 --- a/src/elements.h +++ b/src/elements.h @@ -57,7 +57,8 @@ struct pstext_t { std::wstring parameter; }; -typedef std::vector<text_t> document_t; +typedef std::vector<text_t> paragraph_t; +typedef std::vector<paragraph_t> document_t; BOOST_FUSION_ADAPT_STRUCT (stext_t, (stattribute_t, attribute) diff --git a/src/generators/latex/paragraph_g.cpp b/src/generators/latex/paragraph_g.cpp new file mode 100644 index 0000000..d93bc10 --- /dev/null +++ b/src/generators/latex/paragraph_g.cpp @@ -0,0 +1,20 @@ +/* +Copyright (c) 2010, 2011, Grégoire Duchêne <gduchene@fastmail.net> + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted, provided that the above +copyright notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +*/ +#include "paragraph_g.h" + +latex::paragraph_g::paragraph_g() : paragraph_g::base_type(paragraph_) { + paragraph_ = +text_; +} diff --git a/src/generators/latex/paragraph_g.h b/src/generators/latex/paragraph_g.h new file mode 100644 index 0000000..8cbb750 --- /dev/null +++ b/src/generators/latex/paragraph_g.h @@ -0,0 +1,32 @@ +/* +Copyright (c) 2010, 2011, Grégoire Duchêne <gduchene@fastmail.net> + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted, provided that the above +copyright notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +*/ +#ifndef _MPPDOWN_LATEX_PARAGRAPH_G +#define _MPPDOWN_LATEX_PARAGRAPH_G +#include <boost/spirit/include/karma.hpp> +#include "../../elements.h" +#include "text_g.h" + +namespace ka = boost::spirit::karma; + +namespace latex { +struct paragraph_g : ka::grammar<oiterator, paragraph_t()> { + ka::rule<oiterator, paragraph_t()> paragraph_; + text_g text_; + + paragraph_g(); +}; +} +#endif diff --git a/src/generators/latex_g.cpp b/src/generators/latex_g.cpp index a8d5191..8d5326f 100644 --- a/src/generators/latex_g.cpp +++ b/src/generators/latex_g.cpp @@ -16,5 +16,5 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. #include "latex_g.h" latex_g::latex_g() : latex_g::base_type(latex_) { - latex_ = +text_; + latex_ = +paragraph_; } diff --git a/src/generators/latex_g.h b/src/generators/latex_g.h index 29f1835..260e288 100644 --- a/src/generators/latex_g.h +++ b/src/generators/latex_g.h @@ -17,13 +17,13 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. #define _MPPDOWN_LATEX_G #include <boost/spirit/include/karma.hpp> #include "../elements.h" -#include "latex/text_g.h" +#include "latex/paragraph_g.h" namespace ka = boost::spirit::karma; struct latex_g : ka::grammar<oiterator, document_t()> { ka::rule<oiterator, document_t()> latex_; - latex::text_g text_; + latex::paragraph_g paragraph_; latex_g(); }; diff --git a/src/parser/document_p.cpp b/src/parser/document_p.cpp index 5b45212..fe11aed 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_ = +paragraph_; } diff --git a/src/parser/document_p.h b/src/parser/document_p.h index f3b66cb..19565d7 100644 --- a/src/parser/document_p.h +++ b/src/parser/document_p.h @@ -16,14 +16,15 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. #ifndef _MPPDOWN_DOCUMENT_P #define _MPPDOWN_DOCUMENT_P #include <boost/spirit/include/qi.hpp> -#include "text_p.h" +#include "../elements.h" +#include "paragraph_p.h" namespace qi = boost::spirit::qi; namespace ph = boost::phoenix; struct document_p : qi::grammar<iiterator, document_t()> { qi::rule<iiterator, document_t()> document_; - text_p text_; + paragraph_p paragraph_; document_p(); }; diff --git a/src/parser/paragraph_p.cpp b/src/parser/paragraph_p.cpp new file mode 100644 index 0000000..46f0935 --- /dev/null +++ b/src/parser/paragraph_p.cpp @@ -0,0 +1,20 @@ +/* +Copyright (c) 2010, 2011, Grégoire Duchêne <gduchene@fastmail.net> + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted, provided that the above +copyright notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +*/ +#include "paragraph_p.h" + +paragraph_p::paragraph_p() : paragraph_p::base_type(paragraph_) { + paragraph_ = +text_(ph::val(L"*`$^@[")); +} diff --git a/src/parser/paragraph_p.h b/src/parser/paragraph_p.h new file mode 100644 index 0000000..7409b52 --- /dev/null +++ b/src/parser/paragraph_p.h @@ -0,0 +1,31 @@ +/* +Copyright (c) 2010, 2011, Grégoire Duchêne <gduchene@fastmail.net> + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted, provided that the above +copyright notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +*/ +#ifndef _MPPDOWN_PARAGRAPH_P +#define _MPPDOWN_PARAGRAPH_P +#include <boost/spirit/include/qi.hpp> +#include "../elements.h" +#include "text_p.h" + +namespace qi = boost::spirit::qi; +namespace ph = boost::phoenix; + +struct paragraph_p : qi::grammar<iiterator, paragraph_t()> { + qi::rule<iiterator, paragraph_t()> paragraph_; + text_p text_; + + paragraph_p(); +}; +#endif |
