blob: 3d93598b7aa43ac5bbd8bfbef797a78b3d11940d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
|
#include "lines.hpp"
TexoProducerLines::TexoProducerLines(TexoExporter &exporter):
TexoProducer(exporter), newline(false)
{}
void TexoProducerLines::Put(const Texo &piece)
{
if (piece.c == '\n') {
if (!newline) {
exporter.Put(' ');
newline = true;
}
} else {
exporter.Put(piece.c);
newline = false;
}
}
void TexoProducerLines::Put(const TexoParagraph &piece)
{
exporter.Put('\n');
newline = true;
}
void TexoProducerLines::Put(const TexoQuote &piece)
{
exporter.Put("\n>");
newline = false;
}
TexoImporterLines::TexoImporterLines(TexoProducer &producer):
TexoImporter(producer), newline(true)
{}
void TexoImporterLines::Put(char c)
{
if (c == '\n') {
if (!newline) {
newline = true;
}
} else if (newline) {
if (c == '>') {
producer.Put(TexoQuote());
} else {
producer.Put(TexoParagraph());
producer.Put(c);
}
newline = false;
} else {
producer.Put(c);
}
}
void TexoImporterLines::Put(const ScriptVariable &str)
{
TexoImporter::Put(str);
}
void TexoImporterLines::Put(FILE *file)
{
TexoImporter::Put(file);
}
|