7 |
|
#include "Jargon.hpp" |
8 |
|
#include "Matcher.hpp" |
9 |
|
|
10 |
< |
Jargon::Jargon(const ext::String& path, bool include) |
10 |
> |
Jargon::Jargon(const ext::String& path, const ext::String& jargon, bool include, |
11 |
> |
const ext::String& relative) : include(include), args(1, "jargon.xsl") |
12 |
|
{ |
13 |
< |
std::vector<std::string> args(1, FeepingCreaturism::program); |
13 |
> |
args.InsertLast(ios::String() << path << "/" << jargon); |
14 |
> |
args.InsertLast(ios::String() << "$jargon=" << jargon); |
15 |
|
|
16 |
< |
args.push_back("-p"); |
15 |
< |
args.push_back("include"); |
16 |
< |
args.push_back(lexical_cast<ext::String>(include) + "()"); |
17 |
< |
args.push_back(path); |
18 |
< |
args.push_back("jargon.xsl"); |
16 |
> |
if (include) args.InsertLast("$include=true()"); |
17 |
|
|
18 |
< |
redi::ipstream pin("/usr/local/bin/Xalan", args); |
21 |
< |
|
22 |
< |
if (include) |
18 |
> |
if (!relative.IsEmpty()) |
19 |
|
{ |
20 |
< |
std::string ignore; |
25 |
< |
|
26 |
< |
std::getline(pin, ignore); |
20 |
> |
args.InsertLast(ios::String() << "$relative=" << relative); |
21 |
|
} |
22 |
+ |
} |
23 |
|
|
24 |
< |
do |
25 |
< |
{ |
26 |
< |
std::string line; |
24 |
> |
ios::PrintWriter& operator<<(ios::PrintWriter& pout, const Jargon& jargon) |
25 |
> |
{ |
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 |
< |
buffer << line << '\n'; |
31 |
< |
} |
32 |
< |
while (pin.good()); |
30 |
> |
ios::ReadToWrite(*xslt.GetReader(), pout); |
31 |
> |
|
32 |
> |
return pout; |
33 |
|
} |