4 * This file is part of LyX, the document processor.
5 * Licence details can be found in the file COPYING.
9 * Full author contact details are available in file CREDITS.
12 #ifndef OUTPUT_XHTML_H
13 #define OUTPUT_XHTML_H
15 #include "support/docstream.h"
27 void xhtmlParagraphs(Text const & text,
30 OutputParams const & runparams);
35 StartTag(std::string const & tag, std::string const & attr,
36 bool keepempty = false)
37 : tag_(tag), attr_(attr), keepempty_(keepempty) {}
42 /// whether to keep things like "<tag></tag>" or discard them
43 /// you would want this for td, e.g, but maybe not for a div
50 EndTag(std::string tag) : tag_(tag) {}
59 CompTag(std::string const & tag, std::string const & attr)
60 : tag_(tag), attr_(attr) {}
71 explicit XHTMLStream(odocstream & os);
75 odocstream & os() { return os_; }
77 // int & tab() { return tab_; }
78 /// closes any font tags that are eligible to be closed,
79 /// i.e., last on the tag_stack_.
80 /// \return false if there are open font tags we could not close.
81 /// because they are "blocked" by open non-font tags on the stack.
84 XHTMLStream & operator<<(docstring const &);
86 //XHTMLStream & operator<<(char_type);
88 XHTMLStream & operator<<(StartTag const &);
90 XHTMLStream & operator<<(EndTag const &);
92 XHTMLStream & operator<<(CompTag const &);
97 bool isTagOpen(std::string const &);
103 typedef std::deque<StartTag> TagDeque;
105 typedef std::vector<StartTag> TagStack;
106 /// holds start tags until we know there is content in them.
107 TagDeque pending_tags_;
108 /// remembers the history, so we can make sure we nest properly.
114 docstring escapeChar(char_type c);
115 /// converts a string to a form safe for links, etc
116 docstring htmlize(docstring const & str);
117 /// \return true if tag was opened, false if not
118 bool openTag(odocstream & os, std::string const & tag,
119 std::string const & attr);
120 /// \return true if tag was opened, false if not
121 bool closeTag(odocstream & os, std::string const & tag);