ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/repos/FeepingCreaturism/Jargon.cpp
Revision: 229
Committed: 2004-09-06T16:50:13-07:00 (20 years, 9 months ago) by Douglas Thrift
File size: 1075 byte(s)
Log Message:
Stuff.

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 227 Jargon::Jargon(const ext::String& path, bool include,
11     const ext::String& relative) : include(include),
12     args(1, FeepingCreaturism::program)
13 Douglas Thrift 196 {
14 Douglas Thrift 229 args.push_back("-m");
15 Douglas Thrift 223 args.push_back("-p");
16     args.push_back("include");
17     args.push_back(lexical_cast<ext::String>(include) + "()");
18 Douglas Thrift 225
19     if (!relative.IsEmpty())
20     {
21     args.push_back("-p");
22     args.push_back("relative");
23     args.push_back("\"" + relative + "\"");
24     }
25    
26 Douglas Thrift 196 args.push_back(path);
27 Douglas Thrift 201 args.push_back("jargon.xsl");
28 Douglas Thrift 227 }
29 Douglas Thrift 196
30 Douglas Thrift 227 ios::PrintWriter& operator<<(ios::PrintWriter& pout, const Jargon& jargon)
31     {
32     redi::ipstream pin("/usr/local/bin/Xalan", jargon.args);
33 Douglas Thrift 196
34 Douglas Thrift 227 if (jargon.include)
35 Douglas Thrift 224 {
36     std::string ignore;
37    
38     std::getline(pin, ignore);
39     }
40    
41 Douglas Thrift 223 do
42 Douglas Thrift 208 {
43 Douglas Thrift 223 std::string line;
44 Douglas Thrift 208
45 Douglas Thrift 223 std::getline(pin, line);
46 Douglas Thrift 208
47 Douglas Thrift 229 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 Douglas Thrift 227 pout << line << '\n';
55 Douglas Thrift 203 }
56 Douglas Thrift 223 while (pin.good());
57 Douglas Thrift 227
58     return pout;
59 Douglas Thrift 196 }

Properties

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