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 |
> |
xhtml.OutputText(" " + pronunciation); |
37 |
> |
|
38 |
> |
if (!grammar.IsEmpty()) xhtml.OutputText(", " + grammar); |
39 |
> |
} |
40 |
> |
|
41 |
> |
for (xml::NodeSet::ConstIterator node(definition.Begin()); |
42 |
> |
node != definition.End(); ++node) |
43 |
> |
{ |
44 |
> |
xml::ScopeElement p(xhtml, "p"); |
45 |
> |
|
46 |
> |
xhtml.OutputText(**node); |
47 |
> |
} |
48 |
|
} |
49 |
|
|
50 |
|
struct Section |
59 |
|
{ |
60 |
|
if (jargon.include) |
61 |
|
{ |
62 |
< |
// |
62 |
> |
xml::TextWriter xhtml(pout); |
63 |
> |
|
64 |
> |
jargon.display(pout, xhtml); |
65 |
|
|
66 |
|
return pout; |
67 |
|
} |
68 |
|
|
69 |
< |
xml::TextWriter xhtml(pout); |
45 |
< |
|
46 |
< |
pout << "\n<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\"\n" |
69 |
> |
pout << "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\"\n" |
70 |
|
<< "\t\"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\n"; |
71 |
|
|
72 |
+ |
xml::TextWriter xhtml(pout); |
73 |
|
xml::ScopeElement html(xhtml, "html"); |
74 |
|
|
75 |
|
xhtml.SetAttribute("xmlns", "http://www.w3.org/1999/xhtml"); |
78 |
|
xml::ScopeElement head(xhtml, "head"); |
79 |
|
|
80 |
|
xhtml.OpenElement("title"); |
81 |
< |
xhtml.OutputText("Douglas Thrift's Computers Website | Jargon: \"" |
82 |
< |
+ jargon.word + "\""); |
81 |
> |
xhtml.OutputText("Douglas Thrift"); |
82 |
> |
|
83 |
> |
pout << "'"; |
84 |
> |
|
85 |
> |
xhtml.OutputText("s Computers Website | Jargon: " + jargon.word); |
86 |
|
xhtml.CloseElement(); |
87 |
|
xhtml.OpenElement("link"); |
88 |
|
xhtml.SetAttribute("rel", "stylesheet"); |
166 |
|
xhtml.OpenElement("h1"); |
167 |
|
xhtml.SetAttribute("id", "title"); |
168 |
|
xhtml.SetAttribute("class", "center"); |
169 |
< |
xhtml.OutputText("Jargon: \"" + jargon.word + "\""); |
169 |
> |
xhtml.OutputText("Jargon: " + jargon.word); |
170 |
|
xhtml.CloseElement(); |
171 |
|
} |
172 |
|
|
174 |
|
xml::ScopeElement div(xhtml, "div"); |
175 |
|
|
176 |
|
xhtml.SetAttribute("class", "hr"); |
177 |
+ |
jargon.display(pout, xhtml); |
178 |
|
} |
179 |
|
|
180 |
|
{ |