7 |
|
#include "Jargon.hpp" |
8 |
|
#include "Matcher.hpp" |
9 |
|
|
10 |
– |
#include <menes-ios/stdadapters.hpp> |
11 |
– |
|
10 |
|
Jargon::Jargon(const ext::String& path, const ext::String& jargon, bool include, |
11 |
< |
const ext::String& relative) : include(include), |
14 |
< |
args(1, FeepingCreaturism::program) |
11 |
> |
const ext::String& relative) : include(include), args(1, "jargon.xsl") |
12 |
|
{ |
13 |
< |
args.push_back("-m"); |
14 |
< |
args.push_back("-p"); |
15 |
< |
args.push_back("jargon"); |
16 |
< |
args.push_back("\"" + jargon + "\""); |
20 |
< |
args.push_back("-p"); |
21 |
< |
args.push_back("include"); |
22 |
< |
args.push_back(lexical_cast<ext::String>(include) + "()"); |
13 |
> |
args.InsertLast(ios::String() << path << "/" << jargon); |
14 |
> |
args.InsertLast(ios::String() << "$jargon=" << jargon); |
15 |
> |
|
16 |
> |
if (include) args.InsertLast("$include=true()"); |
17 |
|
|
18 |
|
if (!relative.IsEmpty()) |
19 |
|
{ |
20 |
< |
args.push_back("-p"); |
27 |
< |
args.push_back("relative"); |
28 |
< |
args.push_back("\"" + relative + "\""); |
20 |
> |
args.InsertLast(ios::String() << "$relative=" << relative); |
21 |
|
} |
30 |
– |
|
31 |
– |
args.push_back(path + "/" + jargon); |
32 |
– |
args.push_back("jargon.xsl"); |
22 |
|
} |
23 |
|
|
24 |
|
ios::PrintWriter& operator<<(ios::PrintWriter& pout, const Jargon& jargon) |
25 |
|
{ |
26 |
< |
redi::ipstream pin("/usr/local/bin/Xalan", jargon.args); |
38 |
< |
|
39 |
< |
if (jargon.include) |
40 |
< |
{ |
41 |
< |
std::string ignore; |
42 |
< |
|
43 |
< |
std::getline(pin, ignore); |
44 |
< |
} |
45 |
< |
|
46 |
< |
do |
47 |
< |
{ |
48 |
< |
std::string line; |
26 |
> |
_S<api::Process> xslt("/usr/local/bin/sabcmd", jargon.args); |
27 |
|
|
28 |
< |
std::getline(pin, line); |
28 |
> |
if (jargon.include) ios::ReadLine(*xslt.GetReader()); |
29 |
|
|
30 |
< |
while (jargon.include && line.find(" xmlns=") != std::string::npos) |
53 |
< |
{ |
54 |
< |
std::string::size_type position(line.find(" xmlns=")); |
55 |
< |
|
56 |
< |
line.replace(position, 37, ""); |
57 |
< |
} |
58 |
< |
|
59 |
< |
pout << line << "\n"; |
60 |
< |
} |
61 |
< |
while (pin.good()); |
30 |
> |
ios::ReadToWrite(*xslt.GetReader(), pout); |
31 |
|
|
32 |
|
return pout; |
33 |
|
} |