// Feeping Creaturism // // Douglas Thrift // // $Id$ #include "Jargon.hpp" #include "Matcher.hpp" Jargon::Jargon(const ext::String& path, const ext::String& jargon, bool include, const ext::String& relative) : include(include) { args.InsertLast("--stringparam"); args.InsertLast("jargon"); args.InsertLast(jargon); args.InsertLast("--param"); args.InsertLast("include"); args.InsertLast(ios::String() << include << "()"); if (!relative.IsEmpty()) { args.InsertLast("--stringparam"); args.InsertLast("relative"); args.InsertLast(relative); } args.InsertLast("jargon.xsl"); args.InsertLast(ios::String() << path << "/" << jargon); } ios::PrintWriter& operator<<(ios::PrintWriter& pout, const Jargon& jargon) { _S xslt("/usr/local/bin/xsltproc", jargon.args); if (jargon.include) ios::ReadLine(*xslt.GetReader()); if (jargon.include) { ext::String line; Matcher matcher("^(.*) xmlns=\"http://www.w3.org/1999/xhtml\"(.*)$"); while (ios::ReadLine(*xslt.GetReader(), line)) { while (line == matcher) line = matcher[1] + matcher[2]; pout << line << ios::NewLine; } } else ios::ReadToWrite(*xslt.GetReader(), pout); return pout; }