3 * This file is part of LyX, the document processor.
4 * Licence details can be found in the file COPYING.
6 * \author Lars Gullik Bjønnes
7 * \author Jean-Marc Lasgouttes
10 * Full author contact details are available in file CREDITS.
19 #include "output_xhtml.h"
20 #include "TextClass.h"
22 #include "support/debug.h"
23 #include "support/lassert.h"
24 #include "support/lstrings.h"
25 #include "support/Messages.h"
26 #include "support/textutils.h"
30 using namespace lyx::support;
34 /// Special value of toclevel for layouts that do not belong to a TOC
35 const int Layout::NOT_IN_TOC = -1000;
37 // The order of the LayoutTags enum is no more important. [asierra300396]
57 LT_PARBREAK_IS_NEWLINE,
67 LT_LABELSTRING_APPENDIX,
110 LT_DOCBOOKWRAPPERTAG,
111 LT_DOCBOOKWRAPPERATTR,
112 LT_DOCBOOKSECTIONTAG,
113 LT_DOCBOOKITEMWRAPPERTAG,
114 LT_DOCBOOKITEMWRAPPERATTR,
117 LT_DOCBOOKITEMLABELTAG,
118 LT_DOCBOOKITEMLABELATTR,
119 LT_DOCBOOKITEMINNERTAG,
120 LT_DOCBOOKITEMINNERATTR,
121 LT_DOCBOOKFORCEABSTRACTTAG,
128 LT_STEPMASTERCOUNTER,
134 LT_INTITLE // keep this last!
137 /////////////////////
140 : add_to_toc_(false), is_toc_caption_(true)
143 margintype = MARGIN_STATIC;
144 latextype = LATEX_PARAGRAPH;
145 resumecounter = false;
146 stepmastercounter = false;
150 needcprotect = false;
151 needmboxprotect = false;
154 labelfont = inherit_font;
156 reslabelfont = sane_font;
157 nextnoindent = false;
162 labelbottomsep = 0.0;
164 align = LYX_ALIGN_BLOCK;
165 alignpossible = LYX_ALIGN_NONE | LYX_ALIGN_LAYOUT;
166 labeltype = LABEL_NO_LABEL;
167 endlabeltype = END_LABEL_NO_LABEL;
168 // Should or should not. That is the question.
169 // spacing.set(Spacing::OneHalf);
170 newline_allowed = true;
171 free_spacing = false;
173 parbreak_is_newline = false;
174 toclevel = NOT_IN_TOC;
176 htmllabelfirst_ = false;
177 htmlforcecss_ = false;
181 itemcommand_ = "item";
182 toggle_indent = ITOGGLE_DOCUMENT_DEFAULT;
187 bool Layout::read(Lexer & lex, TextClass const & tclass)
189 // If this is an empty layout, or if no force local version is set,
190 // we know that we will not discard the stuff to read
192 return readIgnoreForcelocal(lex, tclass);
195 bool const ret = tmp.readIgnoreForcelocal(lex, tclass);
197 // - the read version is higher
198 // - both versions are infinity (arbitrary decision)
199 // - the file did not contain any local version (needed for not
200 // skipping user defined local layouts)
201 if (tmp.forcelocal <= 0 || tmp.forcelocal > forcelocal)
207 bool Layout::readIgnoreForcelocal(Lexer & lex, TextClass const & tclass)
209 // This table is sorted alphabetically [asierra 30March96]
210 LexerKeyword layoutTags[] = {
211 { "addtotoc", LT_ADDTOTOC },
212 { "align", LT_ALIGN },
213 { "alignpossible", LT_ALIGNPOSSIBLE },
214 { "argument", LT_ARGUMENT },
215 { "autonests", LT_AUTONESTS },
216 { "babelpreamble", LT_BABELPREAMBLE },
217 { "bottomsep", LT_BOTTOMSEP },
218 { "category", LT_CATEGORY },
219 { "commanddepth", LT_COMMANDDEPTH },
220 { "copystyle", LT_COPYSTYLE },
221 { "dependson", LT_DEPENDSON },
222 { "docbookattr", LT_DOCBOOKATTR },
223 { "docbookforceabstracttag", LT_DOCBOOKFORCEABSTRACTTAG },
224 { "docbookininfo", LT_DOCBOOKININFO },
225 { "docbookitemattr", LT_DOCBOOKITEMATTR },
226 { "docbookiteminnerattr", LT_DOCBOOKITEMINNERATTR },
227 { "docbookiteminnertag", LT_DOCBOOKITEMINNERTAG },
228 { "docbookitemlabelattr", LT_DOCBOOKITEMLABELATTR },
229 { "docbookitemlabeltag", LT_DOCBOOKITEMLABELTAG },
230 { "docbookitemtag", LT_DOCBOOKITEMTAG },
231 { "docbookitemwrapperattr", LT_DOCBOOKITEMWRAPPERATTR },
232 { "docbookitemwrappertag", LT_DOCBOOKITEMWRAPPERTAG },
233 { "docbooksectiontag", LT_DOCBOOKSECTIONTAG },
234 { "docbooktag", LT_DOCBOOKTAG },
235 { "docbookwrapperattr", LT_DOCBOOKWRAPPERATTR },
236 { "docbookwrappertag", LT_DOCBOOKWRAPPERTAG },
238 { "endlabelstring", LT_ENDLABELSTRING },
239 { "endlabeltype", LT_ENDLABELTYPE },
241 { "forcelocal", LT_FORCELOCAL },
242 { "freespacing", LT_FREE_SPACING },
243 { "htmlattr", LT_HTMLATTR },
244 { "htmlforcecss", LT_HTMLFORCECSS },
245 { "htmlitem", LT_HTMLITEM },
246 { "htmlitemattr", LT_HTMLITEMATTR },
247 { "htmllabel", LT_HTMLLABEL },
248 { "htmllabelattr", LT_HTMLLABELATTR },
249 { "htmllabelfirst", LT_HTMLLABELFIRST },
250 { "htmlpreamble", LT_HTMLPREAMBLE },
251 { "htmlstyle", LT_HTMLSTYLE },
252 { "htmltag", LT_HTMLTAG },
253 { "htmltitle", LT_HTMLTITLE },
254 { "innertag", LT_INNERTAG },
255 { "inpreamble", LT_INPREAMBLE },
256 { "intitle", LT_INTITLE },
257 { "isautonestedby", LT_AUTONESTEDBY },
258 { "istoccaption", LT_ISTOCCAPTION },
259 { "itemcommand", LT_ITEMCOMMAND },
260 { "itemsep", LT_ITEMSEP },
261 { "itemtag", LT_ITEMTAG },
262 { "keepempty", LT_KEEPEMPTY },
263 { "labelbottomsep", LT_LABEL_BOTTOMSEP },
264 { "labelcounter", LT_LABELCOUNTER },
265 { "labelfont", LT_LABELFONT },
266 { "labelindent", LT_LABELINDENT },
267 { "labelsep", LT_LABELSEP },
268 { "labelstring", LT_LABELSTRING },
269 { "labelstringappendix", LT_LABELSTRING_APPENDIX },
270 { "labeltag", LT_LABELTAG },
271 { "labeltype", LT_LABELTYPE },
272 { "langpreamble", LT_LANGPREAMBLE },
273 { "latexname", LT_LATEXNAME },
274 { "latexparam", LT_LATEXPARAM },
275 { "latextype", LT_LATEXTYPE },
276 { "leftdelim", LT_LEFTDELIM },
277 { "leftmargin", LT_LEFTMARGIN },
278 { "margin", LT_MARGIN },
279 { "needcprotect", LT_NEED_CPROTECT },
280 { "needmboxprotect", LT_NEED_MBOXPROTECT },
281 { "needprotect", LT_NEED_PROTECT },
282 { "newline", LT_NEWLINE },
283 { "nextnoindent", LT_NEXTNOINDENT },
284 { "obsoletedby", LT_OBSOLETEDBY },
285 { "paragraphgroup", LT_PAR_GROUP },
286 { "parbreakisnewline", LT_PARBREAK_IS_NEWLINE },
287 { "parindent", LT_PARINDENT },
288 { "parsep", LT_PARSEP },
289 { "parskip", LT_PARSKIP },
290 { "passthru", LT_PASS_THRU },
291 { "passthruchars", LT_PASS_THRU_CHARS },
292 { "preamble", LT_PREAMBLE },
293 { "refprefix", LT_REFPREFIX },
294 { "requires", LT_REQUIRES },
295 { "resetargs", LT_RESETARGS },
296 { "resumecounter", LT_RESUMECOUNTER },
297 { "rightdelim", LT_RIGHTDELIM },
298 { "rightmargin", LT_RIGHTMARGIN },
299 { "spacing", LT_SPACING },
300 { "spellcheck", LT_SPELLCHECK },
301 { "stepmastercounter", LT_STEPMASTERCOUNTER },
302 { "textfont", LT_TEXTFONT },
303 { "toclevel", LT_TOCLEVEL },
304 { "toggleindent", LT_TOGGLE_INDENT },
305 { "topsep", LT_TOPSEP }
309 bool finished = false;
310 lex.pushTable(layoutTags);
312 // parse style section
313 while (!finished && lex.isOK() && !error) {
315 // See comment in LyXRC.cpp.
317 case Lexer::LEX_FEOF:
320 case Lexer::LEX_UNDEF:
322 lex.printError("Unknown layout tag `$$Token'");
329 switch (static_cast<LayoutTags>(le)) {
341 style = subst(style, '_', ' ');
343 if (tclass.hasLayout(style)) {
344 docstring const tmpname = name_;
345 this->operator=(tclass[style]);
348 LYXERR0("Cannot copy unknown style `"
350 << "All layouts so far:");
351 DocumentClass::const_iterator lit = tclass.begin();
352 DocumentClass::const_iterator len = tclass.end();
353 for (; lit != len; ++lit)
354 LYXERR0(lit->name());
359 case LT_OBSOLETEDBY: {
362 style = subst(style, '_', ' ');
364 if (tclass.hasLayout(style)) {
365 docstring const tmpname = name_;
366 this->operator=(tclass[style]);
368 if (obsoleted_by().empty())
369 obsoleted_by_ = style;
371 LYXERR0("Cannot replace with unknown style `"
374 //lex.printError("Cannot replace with"
383 depends_on_ = subst(depends_on_, '_', ' ');
412 postcommandargs_.clear();
413 listpreamble_.clear();
417 case LT_RESUMECOUNTER:
418 lex >> resumecounter;
421 case LT_STEPMASTERCOUNTER:
422 lex >> stepmastercounter;
429 case LT_NEED_PROTECT:
433 case LT_NEED_CPROTECT:
437 case LT_NEED_MBOXPROTECT:
438 lex >> needmboxprotect;
446 font = lyxRead(lex, font);
451 font = lyxRead(lex, font);
455 labelfont = lyxRead(lex, labelfont);
458 case LT_NEXTNOINDENT:
462 case LT_TOGGLE_INDENT: {
465 tog = support::ascii_lowercase(tog);
467 toggle_indent = ITOGGLE_ALWAYS;
468 else if (tog == "never")
469 toggle_indent = ITOGGLE_NEVER;
471 toggle_indent = ITOGGLE_DOCUMENT_DEFAULT;
475 case LT_COMMANDDEPTH:
485 latexparam_ = subst(latexparam_, """, "\"");
490 leftdelim_ = support::subst(leftdelim_, from_ascii("<br/>"),
496 rightdelim_ = support::subst(rightdelim_, from_ascii("<br/>"),
517 preamble_ = lex.getLongString(from_ascii("EndPreamble"));
520 case LT_LANGPREAMBLE:
521 langpreamble_ = lex.getLongString(from_ascii("EndLangPreamble"));
524 case LT_BABELPREAMBLE:
525 babelpreamble_ = lex.getLongString(from_ascii("EndBabelPreamble"));
532 case LT_ENDLABELTYPE:
533 readEndLabelType(lex);
568 case LT_LABEL_BOTTOMSEP:
569 lex >> labelbottomsep;
574 labelsep = subst(labelsep, 'x', ' ');
582 lex >> newline_allowed;
589 case LT_ALIGNPOSSIBLE:
590 readAlignPossible(lex);
594 // FIXME: this means LT_LABELSTRING_APPENDIX may only
595 // occur after LT_LABELSTRING
597 labelstring_appendix_ = labelstring_;
600 case LT_ENDLABELSTRING:
601 lex >> endlabelstring_;
604 case LT_LABELSTRING_APPENDIX:
605 lex >> labelstring_appendix_;
608 case LT_LABELCOUNTER:
616 case LT_FREE_SPACING:
624 case LT_PASS_THRU_CHARS:
625 lex >> pass_thru_chars;
628 case LT_PARBREAK_IS_NEWLINE:
629 lex >> parbreak_is_newline;
638 vector<string> const req =
639 getVectorFromString(lex.getString(true));
640 required_.insert(req.begin(), req.end());
645 docstring autonest = lex.getLongString(from_ascii("EndAutoNests"));
646 autonest = subst(autonest, from_ascii("\n"), docstring());
647 autonest = subst(autonest, from_ascii("\t"), docstring());
648 autonest = subst(autonest, from_ascii("\""), docstring());
649 autonest = subst(autonest, '_', ' ');
650 vector<docstring> const autonests =
651 getVectorFromString(autonest, from_ascii(","), false, true);
652 autonests_.insert(autonests.begin(), autonests.end());
656 case LT_AUTONESTEDBY: {
657 docstring autonest = lex.getLongString(from_ascii("EndIsAutoNestedBy"));
658 autonest = subst(autonest, from_ascii("\n"), docstring());
659 autonest = subst(autonest, from_ascii("\t"), docstring());
660 autonest = subst(autonest, from_ascii("\""), docstring());
661 autonest = subst(autonest, '_', ' ');
662 vector<docstring> const autonests =
663 getVectorFromString(autonest, from_ascii(","), false, true);
664 autonested_by_.insert(autonests.begin(), autonests.end());
690 case LT_HTMLITEMATTR:
691 lex >> htmlitemattr_;
695 lex >> htmllabeltag_;
698 case LT_HTMLLABELATTR:
699 lex >> htmllabelattr_;
702 case LT_HTMLLABELFIRST:
703 lex >> htmllabelfirst_;
707 htmlstyle_ = lex.getLongString(from_ascii("EndHTMLStyle"));
710 case LT_HTMLFORCECSS:
711 lex >> htmlforcecss_;
714 case LT_HTMLPREAMBLE:
715 htmlpreamble_ = lex.getLongString(from_ascii("EndPreamble"));
730 case LT_DOCBOOKFORCEABSTRACTTAG:
731 lex >> docbookforceabstracttag_;
734 case LT_DOCBOOKININFO:
735 lex >> docbookininfo_;
738 case LT_DOCBOOKWRAPPERTAG:
739 lex >> docbookwrappertag_;
742 case LT_DOCBOOKWRAPPERATTR:
743 lex >> docbookwrapperattr_;
746 case LT_DOCBOOKSECTIONTAG:
747 lex >> docbooksectiontag_;
750 case LT_DOCBOOKITEMWRAPPERTAG:
751 lex >> docbookitemwrappertag_;
754 case LT_DOCBOOKITEMWRAPPERATTR:
755 lex >> docbookitemwrapperattr_;
758 case LT_DOCBOOKITEMTAG:
759 lex >> docbookitemtag_;
762 case LT_DOCBOOKITEMATTR:
763 lex >> docbookitemattr_;
766 case LT_DOCBOOKITEMLABELTAG:
767 lex >> docbookitemlabeltag_;
770 case LT_DOCBOOKITEMLABELATTR:
771 lex >> docbookitemlabelattr_;
774 case LT_DOCBOOKITEMINNERTAG:
775 lex >> docbookiteminnertag_;
778 case LT_DOCBOOKITEMINNERATTR:
779 lex >> docbookiteminnerattr_;
792 add_to_toc_ = !toc_type_.empty();
795 case LT_ISTOCCAPTION:
796 lex >> is_toc_caption_;
802 // make sure we only have inpreamble = true for commands
803 if (inpreamble && latextype != LATEX_COMMAND && latextype != LATEX_PARAGRAPH) {
804 LYXERR0("InPreamble not permitted except with command and paragraph layouts.");
805 LYXERR0("Layout name: " << name());
809 return finished && !error;
822 LexerKeyword alignTags[] = {
823 { "block", AT_BLOCK },
824 { "center", AT_CENTER },
825 { "layout", AT_LAYOUT },
827 { "right", AT_RIGHT }
831 void Layout::readAlign(Lexer & lex)
833 PushPopHelper pph(lex, alignTags);
836 case Lexer::LEX_UNDEF:
837 lex.printError("Unknown alignment `$$Token'");
843 align = LYX_ALIGN_BLOCK;
846 align = LYX_ALIGN_LEFT;
849 align = LYX_ALIGN_RIGHT;
852 align = LYX_ALIGN_CENTER;
855 align = LYX_ALIGN_LAYOUT;
861 void Layout::readAlignPossible(Lexer & lex)
863 lex.pushTable(alignTags);
864 alignpossible = LYX_ALIGN_NONE | LYX_ALIGN_LAYOUT;
865 int lineno = lex.lineNumber();
869 case Lexer::LEX_UNDEF:
870 lex.printError("Unknown alignment `$$Token'");
876 alignpossible |= LYX_ALIGN_BLOCK;
879 alignpossible |= LYX_ALIGN_LEFT;
882 alignpossible |= LYX_ALIGN_RIGHT;
885 alignpossible |= LYX_ALIGN_CENTER;
888 alignpossible |= LYX_ALIGN_LAYOUT;
891 } while (lineno == lex.lineNumber());
896 void Layout::readLabelType(Lexer & lex)
911 LexerKeyword labelTypeTags[] = {
912 { "above", LA_ABOVE },
913 { "bibliography", LA_BIBLIO },
914 { "centered", LA_CENTERED },
915 { "enumerate", LA_ENUMERATE },
916 { "itemize", LA_ITEMIZE },
917 { "manual", LA_MANUAL },
918 { "no_label", LA_NO_LABEL },
919 { "sensitive", LA_SENSITIVE },
920 { "static", LA_STATIC }
923 PushPopHelper pph(lex, labelTypeTags);
926 case Lexer::LEX_UNDEF:
927 lex.printError("Unknown labeltype tag `$$Token'");
933 labeltype = LABEL_NO_LABEL;
936 labeltype = LABEL_MANUAL;
939 labeltype = LABEL_ABOVE;
942 labeltype = LABEL_CENTERED;
945 labeltype = LABEL_STATIC;
948 labeltype = LABEL_SENSITIVE;
951 labeltype = LABEL_ENUMERATE;
954 labeltype = LABEL_ITEMIZE;
957 labeltype = LABEL_BIBLIO;
963 void Layout::readEndLabelType(Lexer & lex)
965 // this should be const, but can't be because
967 static LexerKeyword endlabelTypeTags[] = {
968 { "box", END_LABEL_BOX },
969 { "filled_box", END_LABEL_FILLED_BOX },
970 { "no_label", END_LABEL_NO_LABEL },
971 { "static", END_LABEL_STATIC }
974 PushPopHelper pph(lex, endlabelTypeTags);
977 case Lexer::LEX_UNDEF:
978 lex.printError("Unknown labeltype tag `$$Token'");
980 case END_LABEL_STATIC:
982 case END_LABEL_FILLED_BOX:
983 case END_LABEL_NO_LABEL:
984 endlabeltype = static_cast<EndLabelType>(le);
987 LYXERR0("Unhandled value " << le);
993 void Layout::readMargin(Lexer & lex)
995 LexerKeyword marginTags[] = {
996 { "dynamic", MARGIN_DYNAMIC },
997 { "first_dynamic", MARGIN_FIRST_DYNAMIC },
998 { "manual", MARGIN_MANUAL },
999 { "right_address_box", MARGIN_RIGHT_ADDRESS_BOX },
1000 { "static", MARGIN_STATIC }
1003 PushPopHelper pph(lex, marginTags);
1007 case Lexer::LEX_UNDEF:
1008 lex.printError("Unknown margin type tag `$$Token'");
1012 case MARGIN_DYNAMIC:
1013 case MARGIN_FIRST_DYNAMIC:
1014 case MARGIN_RIGHT_ADDRESS_BOX:
1015 margintype = static_cast<MarginType>(le);
1018 LYXERR0("Unhandled value " << le);
1024 void Layout::readLatexType(Lexer & lex)
1026 LexerKeyword latexTypeTags[] = {
1027 { "bib_environment", LATEX_BIB_ENVIRONMENT },
1028 { "command", LATEX_COMMAND },
1029 { "environment", LATEX_ENVIRONMENT },
1030 { "item_environment", LATEX_ITEM_ENVIRONMENT },
1031 { "list_environment", LATEX_LIST_ENVIRONMENT },
1032 { "paragraph", LATEX_PARAGRAPH }
1035 PushPopHelper pph(lex, latexTypeTags);
1038 case Lexer::LEX_UNDEF:
1039 lex.printError("Unknown latextype tag `$$Token'");
1041 case LATEX_PARAGRAPH:
1043 case LATEX_ITEM_ENVIRONMENT:
1044 case LATEX_LIST_ENVIRONMENT:
1045 latextype = static_cast<LatexType>(le);
1047 case LATEX_ENVIRONMENT:
1048 case LATEX_BIB_ENVIRONMENT:
1049 latextype = static_cast<LatexType>(le);
1053 LYXERR0("Unhandled value " << le);
1059 void Layout::readSpacing(Lexer & lex)
1062 ST_SPACING_SINGLE = 1,
1068 LexerKeyword spacingTags[] = {
1069 {"double", ST_SPACING_DOUBLE },
1070 {"onehalf", ST_SPACING_ONEHALF },
1071 {"other", ST_OTHER },
1072 {"single", ST_SPACING_SINGLE }
1075 PushPopHelper pph(lex, spacingTags);
1078 case Lexer::LEX_UNDEF:
1079 lex.printError("Unknown spacing token `$$Token'");
1084 case ST_SPACING_SINGLE:
1085 spacing.set(Spacing::Single);
1087 case ST_SPACING_ONEHALF:
1088 spacing.set(Spacing::Onehalf);
1090 case ST_SPACING_DOUBLE:
1091 spacing.set(Spacing::Double);
1095 spacing.set(Spacing::Other, lex.getString());
1101 void Layout::readArgument(Lexer & lex)
1104 // writeArgument() makes use of these default values
1105 arg.mandatory = false;
1106 arg.nodelims = false;
1107 arg.autoinsert = false;
1108 arg.insertcotext = false;
1109 arg.insertonnewline = false;
1111 bool finished = false;
1112 arg.font = inherit_font;
1113 arg.labelfont = inherit_font;
1114 arg.is_toc_caption = false;
1115 arg.passthru = PT_INHERITED;
1116 arg.free_spacing = false;
1119 bool const itemarg = prefixIs(id, "item:");
1120 bool const postcmd = prefixIs(id, "post:");
1121 bool const listpreamble = prefixIs(id, "listpreamble:");
1123 while (!finished && lex.isOK() && !error) {
1125 string const tok = ascii_lowercase(lex.getString());
1129 } else if (tok == "endargument") {
1131 } else if (tok == "labelstring") {
1133 arg.labelstring = lex.getDocString();
1134 } else if (tok == "menustring") {
1136 arg.menustring = lex.getDocString();
1137 } else if (tok == "mandatory") {
1139 arg.mandatory = lex.getBool();
1140 } else if (tok == "autoinsert") {
1142 arg.autoinsert = lex.getBool();
1143 } else if (tok == "insertcotext") {
1145 arg.insertcotext = lex.getBool();
1146 } else if (tok == "leftdelim") {
1148 arg.ldelim = lex.getDocString();
1149 arg.ldelim = support::subst(arg.ldelim, from_ascii("<br/>"),
1151 } else if (tok == "rightdelim") {
1153 arg.rdelim = lex.getDocString();
1154 arg.rdelim = support::subst(arg.rdelim, from_ascii("<br/>"),
1156 } else if (tok == "defaultarg") {
1158 arg.defaultarg = lex.getDocString();
1159 } else if (tok == "presetarg") {
1161 arg.presetarg = lex.getDocString();
1162 } else if (tok == "tooltip") {
1164 arg.tooltip = lex.getDocString();
1165 } else if (tok == "requires") {
1167 arg.required = lex.getString();
1168 } else if (tok == "decoration") {
1170 arg.decoration = lex.getString();
1171 } else if (tok == "newlinecmd") {
1173 arg.newlinecmd = lex.getString();
1174 } else if (tok == "font") {
1175 arg.font = lyxRead(lex, arg.font);
1176 } else if (tok == "labelfont") {
1177 arg.labelfont = lyxRead(lex, arg.labelfont);
1178 } else if (tok == "passthruchars") {
1180 arg.pass_thru_chars = lex.getDocString();
1181 } else if (tok == "passthru") {
1183 docstring value = lex.getDocString();
1184 if (value == "true" || value == "1")
1185 arg.passthru = PT_TRUE;
1186 else if (value == "false" || value == "0")
1187 arg.passthru = PT_FALSE;
1189 arg.passthru = PT_INHERITED;
1190 } else if (tok == "istoccaption") {
1192 arg.is_toc_caption = lex.getBool();
1193 } else if (tok == "freespacing") {
1195 arg.free_spacing = lex.getBool();
1197 lex.printError("Unknown tag");
1201 if (arg.labelstring.empty())
1202 LYXERR0("Incomplete Argument definition!");
1204 itemargs_[id] = arg;
1206 postcommandargs_[id] = arg;
1207 else if (listpreamble) {
1208 // list preamble has no delimiters by default
1209 arg.nodelims = true;
1210 listpreamble_[id] = arg;
1212 latexargs_[id] = arg;
1216 void writeArgument(ostream & os, string const & id, Layout::latexarg const & arg)
1218 os << "\tArgument " << id << '\n';
1219 if (!arg.labelstring.empty())
1220 os << "\t\tLabelString \"" << to_utf8(arg.labelstring) << "\"\n";
1221 if (!arg.menustring.empty())
1222 os << "\t\tMenuString \"" << to_utf8(arg.menustring) << "\"\n";
1224 os << "\t\tMandatory " << arg.mandatory << '\n';
1226 os << "\t\tAutoinsert " << arg.autoinsert << '\n';
1227 if (arg.insertcotext)
1228 os << "\t\tInsertCotext " << arg.insertcotext << '\n';
1229 if (!arg.ldelim.empty())
1230 os << "\t\tLeftDelim \""
1231 << to_utf8(subst(arg.ldelim, from_ascii("\n"), from_ascii("<br/>")))
1233 if (!arg.rdelim.empty())
1234 os << "\t\tRightDelim \""
1235 << to_utf8(subst(arg.rdelim, from_ascii("\n"), from_ascii("<br/>")))
1237 if (!arg.defaultarg.empty())
1238 os << "\t\tDefaultArg \"" << to_utf8(arg.defaultarg) << "\"\n";
1239 if (!arg.presetarg.empty())
1240 os << "\t\tPresetArg \"" << to_utf8(arg.presetarg) << "\"\n";
1241 if (!arg.tooltip.empty())
1242 os << "\t\tToolTip \"" << to_utf8(arg.tooltip) << "\"\n";
1243 if (!arg.required.empty())
1244 os << "\t\tRequires \"" << arg.required << "\"\n";
1245 if (!arg.decoration.empty())
1246 os << "\t\tDecoration \"" << arg.decoration << "\"\n";
1247 if (!arg.newlinecmd.empty())
1248 os << "\t\tNewlineCmd \"" << arg.newlinecmd << "\"\n";
1249 if (arg.font != inherit_font)
1250 lyxWrite(os, arg.font, "Font", 2);
1251 if (arg.labelfont != inherit_font)
1252 lyxWrite(os, arg.labelfont, "LabelFont", 2);
1253 switch (arg.passthru) {
1255 os << "\t\tPassThru true\n";
1258 os << "\t\tPassThru false\n";
1261 os << "\t\tPassThru inherited\n";
1264 if (!arg.pass_thru_chars.empty())
1265 os << "\t\tPassThruChars \"" << to_utf8(arg.pass_thru_chars) << "\"\n";
1266 if (arg.free_spacing)
1267 os << "\t\tFreeSpacing " << arg.free_spacing << "\n";
1268 os << "\tEndArgument\n";
1272 void Layout::write(ostream & os) const
1274 os << "Style \"" << to_utf8(name_) << "\"\n";
1275 if (!category_.empty() && obsoleted_by_.empty())
1276 os << "\tCategory \"" << to_utf8(category_) << "\"\n";
1277 // Can't deduce Copystyle here :-(
1278 if (!obsoleted_by_.empty()) {
1279 os << "\tObsoletedBy \"" << to_utf8(obsoleted_by_)
1283 if (!depends_on_.empty())
1284 os << "\tDependsOn " << to_utf8(depends_on_) << '\n';
1285 switch (margintype) {
1286 case MARGIN_DYNAMIC:
1287 os << "\tMargin Dynamic\n";
1289 case MARGIN_FIRST_DYNAMIC:
1290 os << "\tMargin First_Dynamic\n";
1293 os << "\tMargin Manual\n";
1295 case MARGIN_RIGHT_ADDRESS_BOX:
1296 os << "\tMargin Right_Address_Box\n";
1299 os << "\tMargin Static\n";
1302 switch (latextype) {
1303 case LATEX_BIB_ENVIRONMENT:
1304 os << "\tLatexType Bib_Environment\n";
1307 os << "\tLatexType Command\n";
1309 case LATEX_ENVIRONMENT:
1310 os << "\tLatexType Environment\n";
1312 case LATEX_ITEM_ENVIRONMENT:
1313 os << "\tLatexType Item_Environment\n";
1315 case LATEX_LIST_ENVIRONMENT:
1316 os << "\tLatexType List_Environment\n";
1318 case LATEX_PARAGRAPH:
1319 os << "\tLatexType Paragraph\n";
1322 os << "\tInTitle " << intitle << "\n"
1323 "\tInPreamble " << inpreamble << "\n"
1324 "\tTocLevel " << toclevel << "\n"
1325 "\tResumeCounter " << resumecounter << "\n"
1326 "\tStepMasterCounter " << stepmastercounter << '\n';
1327 // ResetArgs does not make sense here
1328 for (LaTeXArgMap::const_iterator it = latexargs_.begin();
1329 it != latexargs_.end(); ++it)
1330 writeArgument(os, it->first, it->second);
1331 for (LaTeXArgMap::const_iterator it = itemargs_.begin();
1332 it != itemargs_.end(); ++it)
1333 writeArgument(os, it->first, it->second);
1334 for (LaTeXArgMap::const_iterator it = postcommandargs_.begin();
1335 it != postcommandargs_.end(); ++it)
1336 writeArgument(os, it->first, it->second);
1337 for (LaTeXArgMap::const_iterator it = listpreamble_.begin();
1338 it != listpreamble_.end(); ++it)
1339 writeArgument(os, it->first, it->second);
1340 os << "\tNeedProtect " << needprotect << "\n"
1341 "\tNeedCProtect " << needcprotect << "\n"
1342 "\tNeedMBoxProtect " << needmboxprotect << "\n"
1343 "\tKeepEmpty " << keepempty << '\n';
1344 if (labelfont == font)
1345 lyxWrite(os, font, "Font", 1);
1347 lyxWrite(os, font, "TextFont", 1);
1348 lyxWrite(os, labelfont, "LabelFont", 1);
1350 os << "\tNextNoIndent " << nextnoindent << "\n"
1351 "\tCommandDepth " << commanddepth << '\n';
1352 if (!latexname_.empty())
1353 os << "\tLatexName \"" << latexname_ << "\"\n";
1354 if (!latexparam_.empty())
1355 os << "\tLatexParam \"" << subst(latexparam_, "\"", """)
1357 if (!leftdelim_.empty())
1358 os << "\tLeftDelim "
1359 << to_utf8(subst(leftdelim_, from_ascii("\n"), from_ascii("<br/>")))
1361 if (!rightdelim_.empty())
1362 os << "\tRightDelim "
1363 << to_utf8(subst(rightdelim_, from_ascii("\n"), from_ascii("<br/>")))
1365 if (!innertag_.empty())
1366 os << "\tInnerTag \"" << innertag_ << "\"\n";
1367 if (!labeltag_.empty())
1368 os << "\tLabelTag \"" << labeltag_ << "\"\n";
1369 if (!itemtag_.empty())
1370 os << "\tItemTag \"" << itemtag_ << "\"\n";
1371 if (!itemcommand_.empty())
1372 os << "\tItemCommand " << itemcommand_ << '\n';
1373 if (!preamble_.empty())
1374 os << "\tPreamble\n\t"
1375 << to_utf8(subst(rtrim(preamble_, "\n"),
1376 from_ascii("\n"), from_ascii("\n\t")))
1377 << "\n\tEndPreamble\n";
1378 if (!langpreamble_.empty())
1379 os << "\tLangPreamble\n\t"
1380 << to_utf8(subst(rtrim(langpreamble_, "\n"),
1381 from_ascii("\n"), from_ascii("\n\t")))
1382 << "\n\tEndLangPreamble\n";
1383 if (!babelpreamble_.empty())
1384 os << "\tBabelPreamble\n\t"
1385 << to_utf8(subst(rtrim(babelpreamble_, "\n"),
1386 from_ascii("\n"), from_ascii("\n\t")))
1387 << "\n\tEndBabelPreamble\n";
1388 switch (labeltype) {
1390 os << "\tLabelType Above\n";
1393 os << "\tLabelType Bibliography\n";
1395 case LABEL_CENTERED:
1396 os << "\tLabelType Centered\n";
1398 case LABEL_ENUMERATE:
1399 os << "\tLabelType Enumerate\n";
1402 os << "\tLabelType Itemize\n";
1405 os << "\tLabelType Manual\n";
1407 case LABEL_NO_LABEL:
1408 os << "\tLabelType No_Label\n";
1410 case LABEL_SENSITIVE:
1411 os << "\tLabelType Sensitive\n";
1414 os << "\tLabelType Static\n";
1417 switch (endlabeltype) {
1419 os << "\tEndLabelType Box\n";
1421 case END_LABEL_FILLED_BOX:
1422 os << "\tEndLabelType Filled_Box\n";
1424 case END_LABEL_NO_LABEL:
1425 os << "\tEndLabelType No_Label\n";
1427 case END_LABEL_STATIC:
1428 os << "\tEndLabelType Static\n";
1431 os << "\tParagraphGroup \"" << par_group_ << "\"\n";
1432 if (!leftmargin.empty())
1433 os << "\tLeftMargin \"" << to_utf8(leftmargin) << "\"\n";
1434 if (!rightmargin.empty())
1435 os << "\tRightMargin \"" << to_utf8(rightmargin) << "\"\n";
1436 if (!labelindent.empty())
1437 os << "\tLabelIndent " << to_utf8(labelindent) << '\n';
1438 if (!parindent.empty())
1439 os << "\tParIndent " << to_utf8(parindent) << '\n';
1440 os << "\tParSkip " << parskip << "\n"
1441 "\tItemSep " << itemsep << "\n"
1442 "\tTopSep " << topsep << "\n"
1443 "\tBottomSep " << bottomsep << "\n"
1444 "\tLabelBottomSep " << labelbottomsep << '\n';
1445 if (!labelsep.empty())
1446 os << "\tLabelSep " << to_utf8(subst(labelsep, ' ', 'x'))
1448 os << "\tParSep " << parsep << "\n"
1449 "\tNewLine " << newline_allowed << '\n';
1451 case LYX_ALIGN_BLOCK:
1452 os << "\tAlign Block\n";
1454 case LYX_ALIGN_CENTER:
1455 os << "\tAlign Center\n";
1457 case LYX_ALIGN_LAYOUT:
1458 os << "\tAlign Layout\n";
1460 case LYX_ALIGN_LEFT:
1461 os << "\tAlign Left\n";
1463 case LYX_ALIGN_RIGHT:
1464 os << "\tAlign Right\n";
1466 case LYX_ALIGN_DECIMAL:
1467 case LYX_ALIGN_SPECIAL:
1468 case LYX_ALIGN_NONE:
1471 if (alignpossible & (LYX_ALIGN_BLOCK | LYX_ALIGN_CENTER |
1472 LYX_ALIGN_LAYOUT | LYX_ALIGN_LEFT | LYX_ALIGN_RIGHT)) {
1474 os << "\tAlignPossible";
1475 if (alignpossible & LYX_ALIGN_BLOCK) {
1479 if (alignpossible & LYX_ALIGN_CENTER) {
1485 if (alignpossible & LYX_ALIGN_LAYOUT) {
1491 if (alignpossible & LYX_ALIGN_LEFT) {
1497 if (alignpossible & LYX_ALIGN_RIGHT) {
1505 // LabelString must come before LabelStringAppendix
1506 if (!labelstring_.empty())
1507 os << "\tLabelString \"" << to_utf8(labelstring_) << "\"\n";
1508 if (!endlabelstring_.empty())
1509 os << "\tEndLabelString \"" << to_utf8(endlabelstring_) << "\"\n";
1510 if (!labelstring_appendix_.empty() && labelstring_appendix_ != labelstring_)
1511 os << "\tLabelStringAppendix \""
1512 << to_utf8(labelstring_appendix_) << "\"\n";
1513 if (!counter.empty())
1514 os << "\tLabelCounter \"" << to_utf8(counter) << "\"\n";
1515 os << "\tFreeSpacing " << free_spacing << '\n';
1516 os << "\tPassThru " << pass_thru << '\n';
1517 if (!pass_thru_chars.empty())
1518 os << "\tPassThruChars " << to_utf8(pass_thru_chars) << '\n';
1519 os << "\tParbreakIsNewline " << parbreak_is_newline << '\n';
1520 switch (spacing.getSpace()) {
1521 case Spacing::Double:
1522 os << "\tSpacing Double\n";
1524 case Spacing::Onehalf:
1525 os << "\tSpacing Onehalf\n";
1527 case Spacing::Other:
1528 os << "\tSpacing Other " << spacing.getValueAsString() << '\n';
1530 case Spacing::Single:
1531 os << "\tSpacing Single\n";
1533 case Spacing::Default:
1536 if (!required_.empty()) {
1537 os << "\tRequires ";
1538 for (set<string>::const_iterator it = required_.begin();
1539 it != required_.end(); ++it) {
1540 if (it != required_.begin())
1546 if (!autonests_.empty()) {
1547 os << "\tAutoNests\n\t";
1548 for (set<docstring>::const_iterator it = autonests_.begin();
1549 it != autonests_.end(); ++it) {
1550 if (it != autonests_.begin())
1554 os << "\n\tEndAutoNests\n";
1556 if (!autonested_by_.empty()) {
1557 os << "\tIsAutoNestedBy\n\t\t";
1558 for (set<docstring>::const_iterator it = autonested_by_.begin();
1559 it != autonested_by_.end(); ++it) {
1560 if (it != autonested_by_.begin())
1564 os << "\n\tEndIsAutoNestedBy\n";
1566 if (refprefix.empty())
1567 os << "\tRefPrefix OFF\n";
1569 os << "\tRefPrefix " << to_utf8(refprefix) << '\n';
1570 if (!htmltag_.empty())
1571 os << "\tHTMLTag " << htmltag_ << '\n';
1572 if (!htmlattr_.empty())
1573 os << "\tHTMLAttr " << htmlattr_ << '\n';
1574 if (!htmlitemtag_.empty())
1575 os << "\tHTMLItem " << htmlitemtag_ << '\n';
1576 if (!htmlitemattr_.empty())
1577 os << "\tHTMLItemAttr " << htmlitemattr_ << '\n';
1578 if (!htmllabeltag_.empty())
1579 os << "\tHTMLLabel " << htmllabeltag_ << '\n';
1580 if (!htmllabelattr_.empty())
1581 os << "\tHTMLLabelAttr " << htmllabelattr_ << '\n';
1582 os << "\tHTMLLabelFirst " << htmllabelfirst_ << '\n';
1583 if (!htmlstyle_.empty())
1584 os << "\tHTMLStyle\n"
1585 << to_utf8(rtrim(htmlstyle_, "\n"))
1586 << "\n\tEndHTMLStyle\n";
1587 os << "\tHTMLForceCSS " << htmlforcecss_ << '\n';
1588 if (!htmlpreamble_.empty())
1589 os << "\tHTMLPreamble\n"
1590 << to_utf8(rtrim(htmlpreamble_, "\n"))
1591 << "\n\tEndPreamble\n";
1592 os << "\tHTMLTitle " << htmltitle_ << "\n";
1593 if(!docbooktag_.empty())
1594 os << "\tDocBookTag " << docbooktag_ << '\n';
1595 if(!docbookattr_.empty())
1596 os << "\tDocBookAttr " << docbookattr_ << '\n';
1597 if(!docbookininfo_.empty())
1598 os << "\tDocBookInInfo " << docbookininfo_ << '\n';
1599 if(!docbookwrappertag_.empty())
1600 os << "\tDocBookWrapperTag " << docbookwrappertag_ << '\n';
1601 if(!docbookwrapperattr_.empty())
1602 os << "\tDocBookWrapperAttr " << docbookwrapperattr_ << '\n';
1603 if(!docbooksectiontag_.empty())
1604 os << "\tDocBookSectionTag " << docbooksectiontag_ << '\n';
1605 if(!docbookitemtag_.empty())
1606 os << "\tDocBookItemTag " << docbookitemtag_ << '\n';
1607 if(!docbookitemattr_.empty())
1608 os << "\tDocBookItemAttr " << docbookitemattr_ << '\n';
1609 if(!docbookitemwrappertag_.empty())
1610 os << "\tDocBookItemWrapperTag " << docbookitemwrappertag_ << '\n';
1611 if(!docbookitemwrapperattr_.empty())
1612 os << "\tDocBookItemWrapperAttr " << docbookitemwrapperattr_ << '\n';
1613 if(!docbookitemlabeltag_.empty())
1614 os << "\tDocBookItemLabelTag " << docbookitemlabeltag_ << '\n';
1615 if(!docbookitemlabelattr_.empty())
1616 os << "\tDocBookItemLabelAttr " << docbookitemlabelattr_ << '\n';
1617 if(!docbookiteminnertag_.empty())
1618 os << "\tDocBookItemInnerTag " << docbookiteminnertag_ << '\n';
1619 if(!docbookiteminnerattr_.empty())
1620 os << "\tDocBookItemInnerAttr " << docbookiteminnerattr_ << '\n';
1621 if(!docbookforceabstracttag_.empty())
1622 os << "\tDocBookForceAbstractTag " << docbookforceabstracttag_ << '\n';
1623 os << "\tSpellcheck " << spellcheck << "\n"
1624 "\tForceLocal " << forcelocal << "\n"
1629 bool Layout::hasArgs() const
1631 return !latexargs_.empty() || !postcommandargs_.empty() ||
1632 !itemargs_.empty() || !listpreamble_.empty();
1636 Layout::LaTeXArgMap Layout::args() const
1638 LaTeXArgMap args = latexargs_;
1639 if (!postcommandargs_.empty())
1640 args.insert(postcommandargs_.begin(), postcommandargs_.end());
1641 if (!listpreamble_.empty())
1642 args.insert(listpreamble_.begin(), listpreamble_.end());
1643 if (!itemargs_.empty())
1644 args.insert(itemargs_.begin(), itemargs_.end());
1649 int Layout::optArgs() const
1652 LaTeXArgMap::const_iterator it = latexargs_.begin();
1653 for (; it != latexargs_.end(); ++it) {
1654 if (!(*it).second.mandatory)
1657 LaTeXArgMap::const_iterator iit = postcommandargs_.begin();
1658 for (; iit != postcommandargs_.end(); ++iit) {
1659 if (!(*iit).second.mandatory)
1666 int Layout::requiredArgs() const
1669 LaTeXArgMap::const_iterator it = latexargs_.begin();
1670 for (; it != latexargs_.end(); ++it) {
1671 if ((*it).second.mandatory)
1674 LaTeXArgMap::const_iterator iit = postcommandargs_.begin();
1675 for (; iit != postcommandargs_.end(); ++iit) {
1676 if (!(*iit).second.mandatory)
1683 string const & Layout::htmltag() const
1685 if (htmltag_.empty())
1691 string const & Layout::htmlattr() const
1693 if (htmlattr_.empty())
1694 htmlattr_ = "class=\"" + defaultCSSClass() + "\"";
1699 string const & Layout::htmlitemtag() const
1701 if (htmlitemtag_.empty())
1702 htmlitemtag_ = "div";
1703 return htmlitemtag_;
1707 string const & Layout::htmlitemattr() const
1709 if (htmlitemattr_.empty())
1710 htmlitemattr_ = "class=\"" + defaultCSSItemClass() + "\"";
1711 return htmlitemattr_;
1715 string const & Layout::htmllabeltag() const
1717 if (htmllabeltag_.empty())
1718 htmllabeltag_ = "span";
1719 return htmllabeltag_;
1723 string const & Layout::htmllabelattr() const
1725 if (htmllabelattr_.empty())
1726 htmllabelattr_ = "class=\"" + defaultCSSLabelClass() + "\"";
1727 return htmllabelattr_;
1731 docstring Layout::htmlstyle() const
1733 if (!htmlstyle_.empty() && !htmlforcecss_)
1735 if (htmldefaultstyle_.empty())
1737 docstring retval = htmldefaultstyle_;
1738 if (!htmlstyle_.empty())
1739 retval += '\n' + htmlstyle_;
1744 string Layout::defaultCSSClass() const
1746 if (!defaultcssclass_.empty())
1747 return defaultcssclass_;
1749 docstring::const_iterator it = name().begin();
1750 docstring::const_iterator en = name().end();
1751 for (; it != en; ++it) {
1752 char_type const c = *it;
1753 if (!isAlphaASCII(c)) {
1755 // make sure we don't start with an underscore,
1756 // as that sometimes causes problems.
1757 d = from_ascii("lyx_");
1760 } else if (isLower(c))
1763 // this is slow, so do it only if necessary
1766 defaultcssclass_ = to_utf8(d);
1767 return defaultcssclass_;
1771 string const & Layout::docbooktag() const
1773 // No sensible default value, unhappily...
1774 if (docbooktag_.empty())
1775 docbooktag_ = to_utf8(name_);
1780 string const & Layout::docbookattr() const
1782 // Perfectly OK to return no attributes, so docbookattr_ does not need to be filled.
1783 return docbookattr_;
1787 string const & Layout::docbookininfo() const
1789 // Indeed, a trilean. Only titles should be "maybe": otherwise, metadata is "always", content is "never".
1790 if (docbookininfo_.empty() || (docbookininfo_ != "never" && docbookininfo_ != "always" && docbookininfo_ != "maybe"))
1791 docbookininfo_ = "never";
1792 return docbookininfo_;
1796 string const & Layout::docbookwrappertag() const
1798 if (docbookwrappertag_.empty())
1799 docbookwrappertag_ = "NONE";
1800 return docbookwrappertag_;
1804 string const & Layout::docbookwrapperattr() const
1806 return docbookwrapperattr_;
1810 string const & Layout::docbooksectiontag() const
1812 if (docbooksectiontag_.empty())
1813 docbooksectiontag_ = "section";
1814 return docbooksectiontag_;
1818 string const & Layout::docbookitemwrappertag() const
1820 if (docbookitemwrappertag_.empty())
1821 docbookitemwrappertag_ = "NONE";
1822 return docbookitemwrappertag_;
1826 string const & Layout::docbookitemwrapperattr() const
1828 return docbookitemwrapperattr_;
1832 string const & Layout::docbookitemtag() const
1834 return docbookitemtag_;
1838 string const & Layout::docbookitemattr() const
1840 return docbookitemattr_;
1844 string const & Layout::docbookitemlabeltag() const
1846 if (docbookitemlabeltag_.empty())
1847 docbookitemlabeltag_ = "NONE";
1848 return docbookitemlabeltag_;
1852 string const & Layout::docbookitemlabelattr() const
1854 return docbookitemlabelattr_;
1858 string const & Layout::docbookiteminnertag() const
1860 if (docbookiteminnertag_.empty())
1861 docbookiteminnertag_ = "NONE";
1862 return docbookiteminnertag_;
1866 string const & Layout::docbookiteminnerattr() const
1868 return docbookiteminnerattr_;
1872 std::string const & Layout::docbookforceabstracttag() const
1874 if (docbookforceabstracttag_.empty())
1875 docbookforceabstracttag_ = "NONE";
1876 return docbookforceabstracttag_;
1883 string makeMarginValue(char const * side, double d)
1886 os << "margin-" << side << ": " << d << "ex;\n";
1893 void Layout::makeDefaultCSS() const
1895 // this never needs to be redone, since reloading layouts will
1896 // wipe out what we did before.
1897 if (!htmldefaultstyle_.empty())
1901 htmldefaultstyle_ = font.asCSS();
1906 tmp += makeMarginValue("top", topsep);
1908 tmp += makeMarginValue("bottom", bottomsep);
1909 if (!leftmargin.empty()) {
1910 // we can't really do what LyX does with the margin, so
1911 // we'll just figure out how many characters it is
1912 int const len = leftmargin.length();
1913 tmp += makeMarginValue("left", len);
1915 if (!rightmargin.empty()) {
1916 int const len = rightmargin.length();
1917 tmp += makeMarginValue("right", len);
1921 if (!htmldefaultstyle_.empty())
1922 htmldefaultstyle_ += from_ascii("\n");
1923 htmldefaultstyle_ += from_ascii(tmp);
1927 string where = alignmentToCSS(align);
1928 if (!where.empty()) {
1929 htmldefaultstyle_ += from_ascii("text-align: " + where + ";\n");
1932 // wrap up what we have, if anything
1933 if (!htmldefaultstyle_.empty())
1935 from_ascii(htmltag() + "." + defaultCSSClass() + " {\n") +
1936 htmldefaultstyle_ + from_ascii("\n}\n");
1938 if (labeltype == LABEL_NO_LABEL || htmllabeltag() == "NONE")
1944 if (labelfont != font)
1945 labelCSS = labelfont.asCSS() + from_ascii("\n");
1946 if (labeltype == LABEL_CENTERED)
1947 labelCSS += from_ascii("text-align: center;\n");
1949 if (!labelCSS.empty())
1950 htmldefaultstyle_ +=
1951 from_ascii(htmllabeltag() + "." + defaultCSSLabelClass() + " {\n") +
1952 labelCSS + from_ascii("\n}\n");
1956 bool Layout::operator==(Layout const & rhs) const
1958 // This is enough for the applications we actually make,
1959 // at least at the moment. But we could check more.
1960 return name() == rhs.name()
1961 && latexname() == rhs.latexname()
1962 && latextype == rhs.latextype;