summaryrefslogtreecommitdiff
path: root/src/lines.cpp
diff options
context:
space:
mode:
authorAleksey Veresov <aleksey@veresov.pro>2019-11-05 19:46:50 +0300
committerAleksey Veresov <aleksey@veresov.pro>2019-11-05 19:46:50 +0300
commit73345c7dc06a6488f34d4a76906a62171a519278 (patch)
tree28b1c588873a8154db03ba9abe344412c5ef2587 /src/lines.cpp
parent55fd715a4ea184644600be54531ce5b28bec9a90 (diff)
downloadtexo-73345c7dc06a6488f34d4a76906a62171a519278.tar
texo-73345c7dc06a6488f34d4a76906a62171a519278.tar.xz
texo-73345c7dc06a6488f34d4a76906a62171a519278.zip
[texo] Medium has been changed.
Diffstat (limited to 'src/lines.cpp')
-rw-r--r--src/lines.cpp54
1 files changed, 13 insertions, 41 deletions
diff --git a/src/lines.cpp b/src/lines.cpp
index f77ae40..3d93598 100644
--- a/src/lines.cpp
+++ b/src/lines.cpp
@@ -10,6 +10,7 @@ void TexoProducerLines::Put(const Texo &piece)
if (piece.c == '\n') {
if (!newline) {
exporter.Put(' ');
+ newline = true;
}
} else {
exporter.Put(piece.c);
@@ -19,65 +20,36 @@ void TexoProducerLines::Put(const Texo &piece)
void TexoProducerLines::Put(const TexoParagraph &piece)
{
- if (piece.closing) {
- exporter.Put('\n');
- newline = true;
- }
+ exporter.Put('\n');
+ newline = true;
}
void TexoProducerLines::Put(const TexoQuote &piece)
{
- if (piece.closing) {
- exporter.Put('\n');
- newline = true;
- } else {
- exporter.Put('>');
- }
-}
-
-void TexoProducerLines::Put(const TexoLineBreak &piece)
-{
- exporter.Put('\n');
- newline = true;
+ exporter.Put("\n>");
+ newline = false;
}
TexoImporterLines::TexoImporterLines(TexoProducer &producer):
- TexoImporter(producer), quoted(false), newline(true)
+ TexoImporter(producer), newline(true)
{}
-TexoImporterLines::~TexoImporterLines()
-{
- if (!newline) {
- if (quoted) {
- producer.Put(TexoQuote(true));
- } else {
- producer.Put(TexoParagraph(true));
- }
- }
-}
-
void TexoImporterLines::Put(char c)
{
if (c == '\n') {
if (!newline) {
- if (quoted) {
- producer.Put(TexoQuote(true));
- quoted = false;
- } else {
- producer.Put(TexoParagraph(true));
- }
newline = true;
}
- } else if (newline && c == '>') {
- producer.Put(TexoQuote());
- newline = false;
- quoted = true;
- } else {
- if (newline) {
+ } else if (newline) {
+ if (c == '>') {
+ producer.Put(TexoQuote());
+ } else {
producer.Put(TexoParagraph());
- newline = false;
+ producer.Put(c);
}
+ newline = false;
+ } else {
producer.Put(c);
}
}