mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-22 10:00:33 +00:00
Put the InsetLayout default CSS stuff to use.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@31776 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
d0d86081ba
commit
001b0d529d
@ -53,7 +53,7 @@
|
||||
# be comma-separated.
|
||||
#End
|
||||
|
||||
Format 16
|
||||
Format 18
|
||||
|
||||
Provides stdinsets 1
|
||||
|
||||
@ -108,23 +108,19 @@ InsetLayout Foot
|
||||
EndFont
|
||||
MultiPar true
|
||||
HTMLTag span
|
||||
HTMLAttr class='footwrapper'
|
||||
HTMLLabel "<span class='notenum'>\arabic{footnote}</span>"
|
||||
HTMLLabel \arabic{footnote}
|
||||
HTMLInnerTag span
|
||||
HTMLInnerAttr class='footnote'
|
||||
HTMLStyle
|
||||
span.notenum {
|
||||
vertical-align: super;
|
||||
font-size: smaller;
|
||||
span.foot_label {
|
||||
vertical-align: super;
|
||||
font-size: smaller;
|
||||
font-weight: bold;
|
||||
text-decoration: underline;
|
||||
}
|
||||
span.footnote {
|
||||
span.foot_inner {
|
||||
display: none;
|
||||
font-size: medium;
|
||||
font-weight: normal;
|
||||
font-style: normal;
|
||||
font-variant: normal;
|
||||
}
|
||||
span.footwrapper:hover span.footnote {
|
||||
span.foot:hover span.foot_inner {
|
||||
display: block;
|
||||
border: 1px double black;
|
||||
margin: 0em 1em;
|
||||
@ -174,9 +170,12 @@ InsetLayout Note:Greyedout
|
||||
EndFont
|
||||
MultiPar true
|
||||
HTMLTag span
|
||||
HTMLAttr class='notegrey'
|
||||
HTMLStyle
|
||||
span.notegrey { color: gray; }
|
||||
span.note_greyedout {
|
||||
background-color: #A0A0A0;
|
||||
padding-left: 1ex;
|
||||
padding-right: 1ex;
|
||||
}
|
||||
EndHTMLStyle
|
||||
HTMLIsBlock false
|
||||
End
|
||||
|
@ -351,23 +351,40 @@ InsetLayout::InsetLyXType translateLyXType(std::string const & str)
|
||||
}
|
||||
|
||||
|
||||
string const & InsetLayout::htmlattr() const
|
||||
{
|
||||
if (htmlattr_.empty())
|
||||
htmlattr_ = "class=\"" + defaultCSSClass() + "\"";
|
||||
return htmlattr_;
|
||||
}
|
||||
|
||||
|
||||
string const & InsetLayout::htmlinnerattr() const
|
||||
{
|
||||
if (htmlinnerattr_.empty())
|
||||
htmlinnerattr_ = "class=\"" + defaultCSSClass() + "_inner\"";
|
||||
return htmlinnerattr_;
|
||||
}
|
||||
|
||||
|
||||
string InsetLayout::defaultCSSClass() const
|
||||
{
|
||||
if (!defaultcssclass_.empty())
|
||||
return defaultcssclass_;
|
||||
docstring d;
|
||||
docstring::const_iterator it = name().begin();
|
||||
docstring::const_iterator en = name().end();
|
||||
string d;
|
||||
string n = to_utf8(name());
|
||||
string::const_iterator it = n.begin();
|
||||
string::const_iterator en = n.end();
|
||||
for (; it != en; ++it) {
|
||||
if (!isalpha(*it))
|
||||
continue;
|
||||
if (islower(*it))
|
||||
d += "_";
|
||||
else if (islower(*it))
|
||||
d += *it;
|
||||
else
|
||||
else
|
||||
d += support::lowercase(*it);
|
||||
}
|
||||
// are there other characters we need to remove?
|
||||
defaultcssclass_ = to_utf8(d);
|
||||
defaultcssclass_ = d;
|
||||
return defaultcssclass_;
|
||||
}
|
||||
|
||||
|
@ -17,6 +17,7 @@
|
||||
#include "FontInfo.h"
|
||||
|
||||
#include "support/docstring.h"
|
||||
#include "support/debug.h"
|
||||
|
||||
#include <set>
|
||||
#include <string>
|
||||
@ -82,16 +83,21 @@ public:
|
||||
docstring preamble() const { return preamble_; }
|
||||
///
|
||||
docstring counter() const { return counter_; }
|
||||
///
|
||||
std::string const & htmlinnertag() const { return htmlinnertag_; }
|
||||
///
|
||||
std::string const & htmlinnerattr() const { return htmlinnerattr_; }
|
||||
///
|
||||
std::string const & htmltag() const { return htmltag_; }
|
||||
///
|
||||
std::string const & htmlattr() const { return htmlattr_; }
|
||||
std::string const & htmlattr() const;
|
||||
///
|
||||
std::string const & htmlinnertag() const { return htmlinnertag_; }
|
||||
///
|
||||
std::string const & htmlinnerattr() const;
|
||||
///
|
||||
std::string const & htmllabel() const { return htmllabel_; }
|
||||
///
|
||||
inline std::string htmllabeltag() const { return "span"; }
|
||||
///
|
||||
std::string htmllabelattr() const
|
||||
{ return "class=\"" + defaultCSSClass() + "_label\""; }
|
||||
///
|
||||
docstring htmlstyle() const;
|
||||
///
|
||||
@ -158,12 +164,12 @@ private:
|
||||
std::string htmltag_;
|
||||
/// Additional attributes for inclusion with the start tag. Default (if
|
||||
/// a tag is provided) is: class="name".
|
||||
std::string htmlattr_;
|
||||
mutable std::string htmlattr_;
|
||||
/// Tag for individual paragraphs in the inset. Default is none.
|
||||
std::string htmlinnertag_;
|
||||
/// Attributes for that tag. Default (if a tag is provided) is:
|
||||
/// class="name_inner".
|
||||
std::string htmlinnerattr_;
|
||||
mutable std::string htmlinnerattr_;
|
||||
/// A label for this environment, possibly including a reference
|
||||
/// to a counter. E.g., for footnote, it might be:
|
||||
/// <span class='notenum'>\arabic{footnote}</span>
|
||||
|
@ -496,21 +496,31 @@ int InsetText::docbook(odocstream & os, OutputParams const & runparams) const
|
||||
|
||||
docstring InsetText::xhtml(odocstream & os, OutputParams const & runparams) const
|
||||
{
|
||||
InsetLayout const & il = getLayout();
|
||||
if (undefined()) {
|
||||
xhtmlParagraphs(text_, buffer(), os, runparams);
|
||||
return docstring();
|
||||
}
|
||||
|
||||
InsetLayout const & il = getLayout();
|
||||
bool const opened = html::openTag(os, il.htmltag(), il.htmlattr());
|
||||
if (!il.counter().empty()) {
|
||||
BufferParams const & bp = buffer().masterBuffer()->params();
|
||||
Counters & cntrs = bp.documentClass().counters();
|
||||
cntrs.step(il.counter());
|
||||
// FIXME: translate to paragraph language
|
||||
if (!il.htmllabel().empty())
|
||||
os << cntrs.counterLabel(from_utf8(il.htmllabel()), bp.language->code());
|
||||
if (!il.htmllabel().empty()) {
|
||||
docstring const lbl =
|
||||
cntrs.counterLabel(from_utf8(il.htmllabel()), bp.language->code());
|
||||
// FIXME is this check necessary?
|
||||
if (!lbl.empty()) {
|
||||
bool const lopen = html::openTag(os, il.htmllabeltag(), il.htmllabelattr());
|
||||
os << lbl;
|
||||
if (lopen)
|
||||
html::closeTag(os, il.htmllabeltag());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool innertag_opened = false;
|
||||
if (!il.htmlinnertag().empty())
|
||||
innertag_opened = html::openTag(os, il.htmlinnertag(), il.htmlinnerattr());
|
||||
|
Loading…
Reference in New Issue
Block a user