15 |
|
|
16 |
|
redi::pstreambuf pin("/usr/local/bin/Xalan", args, std::ios_base::in); |
17 |
|
ios::FromStreamBuf adaptor(pin); |
18 |
+ |
|
19 |
|
ext::Handle<xml::Document> document(xml::Parse(adaptor)); |
20 |
|
ext::Handle<xml::Node> jargon(*document/"jargon"); |
21 |
|
|
22 |
|
word = *jargon/"word"; |
23 |
|
pronunciation = *jargon/"pronunciation"; |
24 |
|
grammar = *jargon/"grammar"; |
25 |
< |
definition = *jargon/"definition"; |
25 |
> |
definition = *jargon/"definition"/"p"; |
26 |
> |
} |
27 |
> |
|
28 |
> |
void Jargon::display(ios::PrintWriter& pout, xml::TextWriter& xhtml) const |
29 |
> |
{ |
30 |
> |
{ |
31 |
> |
xml::ScopeElement p(xhtml, "p"); |
32 |
> |
|
33 |
> |
xhtml.OpenElement("strong"); |
34 |
> |
xhtml.OutputText(word + ":"); |
35 |
> |
xhtml.CloseElement(); |
36 |
> |
|
37 |
> |
if (!pronunciation.IsEmpty()) xhtml.OutputText(" " + pronunciation); |
38 |
> |
if (!pronunciation.IsEmpty() && !grammar.IsEmpty()) xhtml.OutputText(","); |
39 |
> |
if (!grammar.IsEmpty()) xhtml.OutputText(" " + grammar); |
40 |
> |
} |
41 |
> |
|
42 |
> |
for (xml::NodeSet::ConstIterator node(definition.Begin()); |
43 |
> |
node != definition.End(); ++node) |
44 |
> |
{ |
45 |
> |
xml::ScopeElement p(xhtml, "p"); |
46 |
> |
|
47 |
> |
xhtml.OutputText(**node); |
48 |
> |
} |
49 |
|
} |
50 |
|
|
51 |
|
struct Section |
60 |
|
{ |
61 |
|
if (jargon.include) |
62 |
|
{ |
63 |
< |
// |
63 |
> |
xml::TextWriter xhtml(pout); |
64 |
> |
|
65 |
> |
jargon.display(pout, xhtml); |
66 |
|
|
67 |
|
return pout; |
68 |
|
} |
69 |
|
|
70 |
< |
xml::TextWriter xhtml(pout); |
45 |
< |
|
46 |
< |
pout << "\n<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\"\n" |
70 |
> |
pout << "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\"\n" |
71 |
|
<< "\t\"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\n"; |
72 |
|
|
73 |
+ |
xml::TextWriter xhtml(pout); |
74 |
|
xml::ScopeElement html(xhtml, "html"); |
75 |
|
|
76 |
|
xhtml.SetAttribute("xmlns", "http://www.w3.org/1999/xhtml"); |
79 |
|
xml::ScopeElement head(xhtml, "head"); |
80 |
|
|
81 |
|
xhtml.OpenElement("title"); |
82 |
< |
xhtml.OutputText("Douglas Thrift's Computers Website | Jargon: \"" |
83 |
< |
+ jargon.word + "\""); |
82 |
> |
xhtml.OutputText("Douglas Thrift"); |
83 |
> |
|
84 |
> |
pout << "'"; |
85 |
> |
|
86 |
> |
xhtml.OutputText("s Computers Website | Jargon: " + jargon.word); |
87 |
|
xhtml.CloseElement(); |
88 |
|
xhtml.OpenElement("link"); |
89 |
|
xhtml.SetAttribute("rel", "stylesheet"); |
167 |
|
xhtml.OpenElement("h1"); |
168 |
|
xhtml.SetAttribute("id", "title"); |
169 |
|
xhtml.SetAttribute("class", "center"); |
170 |
< |
xhtml.OutputText("Jargon: \"" + jargon.word + "\""); |
170 |
> |
xhtml.OutputText("Jargon: " + jargon.word); |
171 |
|
xhtml.CloseElement(); |
172 |
|
} |
173 |
|
|
175 |
|
xml::ScopeElement div(xhtml, "div"); |
176 |
|
|
177 |
|
xhtml.SetAttribute("class", "hr"); |
178 |
+ |
jargon.display(pout, xhtml); |
179 |
|
} |
180 |
|
|
181 |
|
{ |