mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-23 13:31:49 +00:00
Move the defaults to Layout.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@31751 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
67b7ca00a0
commit
331d8060b5
@ -869,6 +869,54 @@ docstring const Layout::babelpreamble(Language const * lang) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
string const Layout::htmltag() const
|
||||||
|
{
|
||||||
|
if (htmltag_.empty())
|
||||||
|
htmltag_ = "div";
|
||||||
|
return htmltag_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
string const & Layout::htmlattr() const
|
||||||
|
{
|
||||||
|
if (htmlattr_.empty())
|
||||||
|
htmlattr_ = "class=\"" + to_utf8(name()) + "\"";
|
||||||
|
return htmlattr_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
string const & Layout::htmlitem() const
|
||||||
|
{
|
||||||
|
if (htmlitem_.empty())
|
||||||
|
htmlitem_ = "div";
|
||||||
|
return htmlitem_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
string const & Layout::htmlitemattr() const
|
||||||
|
{
|
||||||
|
if (htmlitemattr_.empty())
|
||||||
|
htmlitemattr_ = "class=\"" + to_utf8(name()) + "item\"";
|
||||||
|
return htmlitemattr_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
string const & Layout::htmllabel() const
|
||||||
|
{
|
||||||
|
if (htmllabel_.empty())
|
||||||
|
htmllabel_ = "span";
|
||||||
|
return htmllabel_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
string const & Layout::htmllabelattr() const
|
||||||
|
{
|
||||||
|
if (htmllabelattr_.empty())
|
||||||
|
htmllabelattr_ = "class=\"" + to_utf8(name()) + "label\"";
|
||||||
|
return htmllabelattr_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
docstring Layout::htmlstyle() const {
|
docstring Layout::htmlstyle() const {
|
||||||
if (!htmlstyle_.empty() && !htmlforcedefault_)
|
if (!htmlstyle_.empty() && !htmlforcedefault_)
|
||||||
return htmlstyle_;
|
return htmlstyle_;
|
||||||
|
38
src/Layout.h
38
src/Layout.h
@ -110,17 +110,17 @@ public:
|
|||||||
///
|
///
|
||||||
std::string const & itemtag() const { return itemtag_; }
|
std::string const & itemtag() const { return itemtag_; }
|
||||||
///
|
///
|
||||||
std::string const & htmltag() const { return htmltag_; }
|
std::string const htmltag() const;
|
||||||
///
|
///
|
||||||
std::string const & htmlattr() const { return htmlattr_; }
|
std::string const & htmlattr() const;
|
||||||
///
|
///
|
||||||
std::string const & htmlitem() const { return htmlitem_; }
|
std::string const & htmlitem() const;
|
||||||
///
|
///
|
||||||
std::string const & htmlitemattr() const { return htmlitemattr_; }
|
std::string const & htmlitemattr() const;
|
||||||
///
|
///
|
||||||
std::string const & htmllabel() const { return htmllabel_; }
|
std::string const & htmllabel() const;
|
||||||
///
|
///
|
||||||
std::string const & htmllabelattr() const { return htmllabelattr_; }
|
std::string const & htmllabelattr() const;
|
||||||
///
|
///
|
||||||
bool htmllabelfirst() const { return htmllabelfirst_; }
|
bool htmllabelfirst() const { return htmllabelfirst_; }
|
||||||
///
|
///
|
||||||
@ -289,26 +289,38 @@ private:
|
|||||||
std::string labeltag_;
|
std::string labeltag_;
|
||||||
/// Internal tag to surround the item text in a list.
|
/// Internal tag to surround the item text in a list.
|
||||||
std::string itemtag_;
|
std::string itemtag_;
|
||||||
/// Tag for HTML output, e.g., h2. Defaults to "div".
|
/// The interpretation of this tag varies depending upon the latextype.
|
||||||
std::string htmltag_;
|
/// In an environment, it is the tag enclosing all content for this set of
|
||||||
|
/// paragraphs. So for quote, e.g,. it would be: blockquote. For itemize,
|
||||||
|
/// it would be: ul. (You get the idea.)
|
||||||
|
///
|
||||||
|
/// For a command, it is the tag enclosing the content of the command.
|
||||||
|
/// So, for section, it might be: h2.
|
||||||
|
///
|
||||||
|
/// For the paragraph type, it is the tag that will enclose each paragraph.
|
||||||
|
///
|
||||||
|
/// Defaults to "div".
|
||||||
|
mutable std::string htmltag_;
|
||||||
/// Additional attributes for inclusion with the start tag. Defaults
|
/// Additional attributes for inclusion with the start tag. Defaults
|
||||||
/// to: class="layoutname".
|
/// to: class="layoutname".
|
||||||
std::string htmlattr_;
|
mutable std::string htmlattr_;
|
||||||
/// Tag for individual paragraphs in an environment. In lists, this
|
/// Tag for individual paragraphs in an environment. In lists, this
|
||||||
/// would be something like "li". But it also needs to be set for
|
/// would be something like "li". But it also needs to be set for
|
||||||
/// quotation, e.g., since the paragraphs in a quote need to be
|
/// quotation, e.g., since the paragraphs in a quote need to be
|
||||||
/// in "p" tags. Default is "div".
|
/// in "p" tags. Default is "div".
|
||||||
std::string htmlitem_;
|
/// Note that when I said "environment", I meant it: This has no
|
||||||
|
/// effect for LATEX_PARAGRAPH type layouts.
|
||||||
|
mutable std::string htmlitem_;
|
||||||
/// Attributes for htmlitem_. Default is: class="layoutnameitem".
|
/// Attributes for htmlitem_. Default is: class="layoutnameitem".
|
||||||
std::string htmlitemattr_;
|
mutable std::string htmlitemattr_;
|
||||||
/// Tag for labels, of whatever sort. One use for this is in setting
|
/// Tag for labels, of whatever sort. One use for this is in setting
|
||||||
/// descriptions, in which case it would be: dt. Another use is to
|
/// descriptions, in which case it would be: dt. Another use is to
|
||||||
/// customize the display of, say, the auto-generated label for
|
/// customize the display of, say, the auto-generated label for
|
||||||
/// sections. Defaults to "span".
|
/// sections. Defaults to "span".
|
||||||
/// If set to "NONE", this suppresses the printing of the label.
|
/// If set to "NONE", this suppresses the printing of the label.
|
||||||
std::string htmllabel_;
|
mutable std::string htmllabel_;
|
||||||
/// Attributes for the label. Defaults to: class="layoutnamelabel".
|
/// Attributes for the label. Defaults to: class="layoutnamelabel".
|
||||||
std::string htmllabelattr_;
|
mutable std::string htmllabelattr_;
|
||||||
/// Whether to put the label before the item, or within the item.
|
/// Whether to put the label before the item, or within the item.
|
||||||
/// I.e., do we have (true):
|
/// I.e., do we have (true):
|
||||||
/// <label>...</label><item>...</item>
|
/// <label>...</label><item>...</item>
|
||||||
|
@ -116,60 +116,42 @@ namespace {
|
|||||||
|
|
||||||
bool openTag(odocstream & os, Layout const & lay)
|
bool openTag(odocstream & os, Layout const & lay)
|
||||||
{
|
{
|
||||||
string const tag = lay.htmltag().empty()
|
return html::openTag(os, lay.htmltag(), lay.htmlattr());
|
||||||
? "div" : lay.htmltag();
|
|
||||||
string const attr = lay.htmlattr().empty()
|
|
||||||
? "class=\"" + to_utf8(lay.name()) + "\"" : lay.htmlattr();
|
|
||||||
return html::openTag(os, tag, attr);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool closeTag(odocstream & os, Layout const & lay)
|
bool closeTag(odocstream & os, Layout const & lay)
|
||||||
{
|
{
|
||||||
string const tag = lay.htmltag().empty()
|
return html::closeTag(os, lay.htmltag());
|
||||||
? "div" : lay.htmltag();
|
|
||||||
return html::closeTag(os, tag);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool openLabelTag(odocstream & os, Layout const & lay)
|
bool openLabelTag(odocstream & os, Layout const & lay)
|
||||||
{
|
{
|
||||||
string const tag = lay.htmllabel().empty()
|
return html::openTag(os, lay.htmllabel(), lay.htmllabelattr());
|
||||||
? "span" : lay.htmllabel();
|
|
||||||
string const attr = lay.htmllabelattr().empty()
|
|
||||||
? "class=\"" + to_utf8(lay.name()) + "label\"" : lay.htmllabelattr();
|
|
||||||
return html::openTag(os, tag, attr);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool closeLabelTag(odocstream & os, Layout const & lay)
|
bool closeLabelTag(odocstream & os, Layout const & lay)
|
||||||
{
|
{
|
||||||
string const tag = lay.htmllabel().empty()
|
return html::closeTag(os, lay.htmllabel());
|
||||||
? "span" : lay.htmllabel();
|
|
||||||
return html::closeTag(os, tag);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool openItemTag(odocstream & os, Layout const & lay)
|
bool openItemTag(odocstream & os, Layout const & lay)
|
||||||
{
|
{
|
||||||
string const tag = lay.htmlitem().empty()
|
return html::openTag(os, lay.htmlitem(), lay.htmlitemattr());
|
||||||
? "div" : lay.htmlitem();
|
|
||||||
string const attr = lay.htmlitemattr().empty()
|
|
||||||
? "class=\"" + to_utf8(lay.name()) + "item\"" : lay.htmllabelattr();
|
|
||||||
return html::openTag(os, tag, attr);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool closeItemTag(odocstream & os, Layout const & lay)
|
bool closeItemTag(odocstream & os, Layout const & lay)
|
||||||
{
|
{
|
||||||
string const tag = lay.htmlitem().empty()
|
return html::closeTag(os, lay.htmlitem());
|
||||||
? "div" : lay.htmlitem();
|
|
||||||
return html::closeTag(os, tag);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ParagraphList::const_iterator searchParagraphHtml(
|
ParagraphList::const_iterator searchParagraphHtml(
|
||||||
ParagraphList::const_iterator p,
|
ParagraphList::const_iterator p,
|
||||||
ParagraphList::const_iterator const & pend)
|
ParagraphList::const_iterator const & pend)
|
||||||
{
|
{
|
||||||
for (++p; p != pend && p->layout().latextype == LATEX_PARAGRAPH; ++p)
|
for (++p; p != pend && p->layout().latextype == LATEX_PARAGRAPH; ++p)
|
||||||
;
|
;
|
||||||
|
Loading…
Reference in New Issue
Block a user