7 |
|
#include "Jargon.hpp" |
8 |
|
#include "Matcher.hpp" |
9 |
|
|
10 |
< |
Jargon::Jargon(const ext::String& path, bool include) |
11 |
< |
{ |
12 |
< |
std::vector<std::string> args(1, FeepingCreaturism::program); |
10 |
> |
#include <menes-ios/stdadapters.hpp> |
11 |
|
|
12 |
+ |
Jargon::Jargon(const ext::String& path, const ext::String& jargon, bool include, |
13 |
+ |
const ext::String& relative) : include(include), |
14 |
+ |
args(1, FeepingCreaturism::program) |
15 |
+ |
{ |
16 |
+ |
args.push_back("-m"); |
17 |
+ |
args.push_back("-p"); |
18 |
+ |
args.push_back("jargon"); |
19 |
+ |
args.push_back("\"" + jargon + "\""); |
20 |
|
args.push_back("-p"); |
21 |
|
args.push_back("include"); |
22 |
|
args.push_back(lexical_cast<ext::String>(include) + "()"); |
23 |
< |
args.push_back(path); |
23 |
> |
|
24 |
> |
if (!relative.IsEmpty()) |
25 |
> |
{ |
26 |
> |
args.push_back("-p"); |
27 |
> |
args.push_back("relative"); |
28 |
> |
args.push_back("\"" + relative + "\""); |
29 |
> |
} |
30 |
> |
|
31 |
> |
args.push_back(path + "/" + jargon); |
32 |
|
args.push_back("jargon.xsl"); |
33 |
+ |
} |
34 |
|
|
35 |
< |
redi::ipstream pin("/usr/local/bin/Xalan", args); |
35 |
> |
ios::PrintWriter& operator<<(ios::PrintWriter& pout, const Jargon& jargon) |
36 |
> |
{ |
37 |
> |
redi::ipstream pin("/usr/local/bin/Xalan", jargon.args); |
38 |
|
|
39 |
< |
if (include) |
39 |
> |
if (jargon.include) |
40 |
|
{ |
41 |
|
std::string ignore; |
42 |
|
|
49 |
|
|
50 |
|
std::getline(pin, line); |
51 |
|
|
52 |
< |
buffer << line << '\n'; |
52 |
> |
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()); |
62 |
+ |
|
63 |
+ |
return pout; |
64 |
|
} |