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, bool include, |
11 |
> |
const ext::String& relative) : include(include), |
12 |
> |
args(1, FeepingCreaturism::program) |
13 |
|
{ |
14 |
< |
std::vector<std::string> args(1, FeepingCreaturism::program); |
13 |
< |
|
14 |
> |
args.push_back("-m"); |
15 |
|
args.push_back("-p"); |
16 |
|
args.push_back("include"); |
17 |
|
args.push_back(lexical_cast<ext::String>(include) + "()"); |
18 |
+ |
|
19 |
+ |
if (!relative.IsEmpty()) |
20 |
+ |
{ |
21 |
+ |
args.push_back("-p"); |
22 |
+ |
args.push_back("relative"); |
23 |
+ |
args.push_back("\"" + relative + "\""); |
24 |
+ |
} |
25 |
+ |
|
26 |
|
args.push_back(path); |
27 |
|
args.push_back("jargon.xsl"); |
28 |
+ |
} |
29 |
|
|
30 |
< |
redi::ipstream pin("/usr/local/bin/Xalan", args); |
30 |
> |
ios::PrintWriter& operator<<(ios::PrintWriter& pout, const Jargon& jargon) |
31 |
> |
{ |
32 |
> |
redi::ipstream pin("/usr/local/bin/Xalan", jargon.args); |
33 |
|
|
34 |
< |
if (include) |
34 |
> |
if (jargon.include) |
35 |
|
{ |
36 |
|
std::string ignore; |
37 |
|
|
44 |
|
|
45 |
|
std::getline(pin, line); |
46 |
|
|
47 |
< |
buffer << line << '\n'; |
47 |
> |
while (jargon.include && line.find(" xmlns=") != std::string::npos) |
48 |
> |
{ |
49 |
> |
std::string::size_type position(line.find(" xmlns=")); |
50 |
> |
|
51 |
> |
line.replace(position, 37, ""); |
52 |
> |
} |
53 |
> |
|
54 |
> |
pout << line << '\n'; |
55 |
|
} |
56 |
|
while (pin.good()); |
57 |
+ |
|
58 |
+ |
return pout; |
59 |
|
} |