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"
28 StartTag(std::string const & tag, std::string const & attr,
29 bool keepempty = false)
30 : tag_(tag), attr_(attr), keepempty_(keepempty) {}
35 /// whether to keep things like "<tag></tag>" or discard them
36 /// you would want this for td, e.g, but maybe not for a div
43 EndTag(std::string tag) : tag_(tag) {}
52 CompTag(std::string const & tag, std::string const & attr)
53 : tag_(tag), attr_(attr) {}
64 explicit XHTMLStream(odocstream & os);
68 odocstream & os() { return os_; }
70 // int & tab() { return tab_; }
71 /// closes any font tags that are eligible to be closed,
72 /// i.e., last on the tag_stack_.
73 /// \return false if there are open font tags we could not close.
74 /// because they are "blocked" by open non-font tags on the stack.
77 XHTMLStream & operator<<(docstring const &);
79 //XHTMLStream & operator<<(char_type);
81 XHTMLStream & operator<<(StartTag const &);
83 XHTMLStream & operator<<(EndTag const &);
85 XHTMLStream & operator<<(CompTag const &);
90 bool isTagOpen(std::string const &);
96 typedef std::deque<StartTag> TagDeque;
98 typedef std::vector<StartTag> TagStack;
99 /// holds start tags until we know there is content in them.
100 TagDeque pending_tags_;
101 /// remembers the history, so we can make sure we nest properly.
106 void xhtmlParagraphs(Text const & text,
109 OutputParams const & runparams);
113 docstring escapeChar(char_type c);
114 /// converts a string to a form safe for links, etc
115 docstring htmlize(docstring const & str);
116 /// \return true if tag was opened, false if not
117 bool openTag(odocstream & os, std::string const & tag,
118 std::string const & attr);
119 /// \return true if tag was opened, false if not
120 bool closeTag(odocstream & os, std::string const & tag);