ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/repos/FeepingCreaturism/Jargon.cpp
Revision: 256
Committed: 2004-09-17T16:37:49-07:00 (20 years, 9 months ago) by Douglas Thrift
File size: 1244 byte(s)
Log Message:
Applied Jay's patch.

File Contents

# User Rev Content
1 Douglas Thrift 196 // Feeping Creaturism
2     //
3     // Douglas Thrift
4     //
5     // $Id$
6    
7     #include "Jargon.hpp"
8 Douglas Thrift 224 #include "Matcher.hpp"
9 Douglas Thrift 196
10 Douglas Thrift 256 #include <menes-ios/stdadapters.hpp>
11    
12 Douglas Thrift 230 Jargon::Jargon(const ext::String& path, const ext::String& jargon, bool include,
13 Douglas Thrift 227 const ext::String& relative) : include(include),
14     args(1, FeepingCreaturism::program)
15 Douglas Thrift 196 {
16 Douglas Thrift 229 args.push_back("-m");
17 Douglas Thrift 223 args.push_back("-p");
18 Douglas Thrift 230 args.push_back("jargon");
19     args.push_back("\"" + jargon + "\"");
20     args.push_back("-p");
21 Douglas Thrift 223 args.push_back("include");
22     args.push_back(lexical_cast<ext::String>(include) + "()");
23 Douglas Thrift 225
24     if (!relative.IsEmpty())
25     {
26     args.push_back("-p");
27     args.push_back("relative");
28     args.push_back("\"" + relative + "\"");
29     }
30    
31 Douglas Thrift 230 args.push_back(path + "/" + jargon);
32 Douglas Thrift 201 args.push_back("jargon.xsl");
33 Douglas Thrift 227 }
34 Douglas Thrift 196
35 Douglas Thrift 227 ios::PrintWriter& operator<<(ios::PrintWriter& pout, const Jargon& jargon)
36     {
37     redi::ipstream pin("/usr/local/bin/Xalan", jargon.args);
38 Douglas Thrift 196
39 Douglas Thrift 227 if (jargon.include)
40 Douglas Thrift 224 {
41     std::string ignore;
42    
43     std::getline(pin, ignore);
44     }
45    
46 Douglas Thrift 223 do
47 Douglas Thrift 208 {
48 Douglas Thrift 223 std::string line;
49 Douglas Thrift 208
50 Douglas Thrift 223 std::getline(pin, line);
51 Douglas Thrift 208
52 Douglas Thrift 229 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 Douglas Thrift 254 pout << line << "\n";
60 Douglas Thrift 203 }
61 Douglas Thrift 223 while (pin.good());
62 Douglas Thrift 227
63     return pout;
64 Douglas Thrift 196 }

Properties

Name Value
svn:eol-style native
svn:keywords Id