mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-09-19 22:40:26 +00:00
Introducing a number of tags parametrizing various
XML formats that we may want to support git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@8137 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
1dc2202e8b
commit
af37f0d23e
@ -1,3 +1,23 @@
|
||||
|
||||
2003-11-25 Martin Vermeer <martin.vermeer@hut.fi>
|
||||
|
||||
* lib/layouts/agu-dtd.layout:
|
||||
* lib/layouts/agu_stdclass.inc:
|
||||
* lib/layouts/agu_stdcounters.inc:
|
||||
* lib/layouts/agu_stdlists.inc:
|
||||
* lib/layouts/agu_stdsections.inc:
|
||||
* lib/layouts/db_lyxmacros.inc:
|
||||
* lib/layouts/db_stdclass.inc:
|
||||
* lib/layouts/db_stdlayouts.inc:
|
||||
* lib/layouts/db_stdlists.inc:
|
||||
* lib/layouts/db_stdstarsections.inc:
|
||||
* lib/layouts/db_stdstruct.inc:
|
||||
* lib/layouts/db_stdtitle.inc:
|
||||
* lib/layouts/docbook-book.layout:
|
||||
* lib/layouts/docbook-chapter.layout:
|
||||
* lib/layouts/docbook-section.layout: Introducing a number of tags
|
||||
parametrizing various XML formats that we may want to support
|
||||
|
||||
2003-11-17 Roman Maurer <roman.maurer@amis.net>
|
||||
|
||||
* examples/sl_splash.lyx: update
|
||||
|
14
lib/layouts/agu-dtd.layout
Normal file
14
lib/layouts/agu-dtd.layout
Normal file
@ -0,0 +1,14 @@
|
||||
#% Do not delete the line below; configure depends on this
|
||||
# \DeclareDocBookClass[AGU-article]{AGU Article (SGML)}
|
||||
# AGU XML textclass definition file.
|
||||
# Authors : Jose' Matos <jamatos@lyx.org>
|
||||
# Martin Vermeer <martin.vermeer@hut.fi>
|
||||
|
||||
|
||||
Input agu_stdclass.inc
|
||||
Input numarticle.inc
|
||||
|
||||
|
||||
# Exclude higher, or equal, sections:
|
||||
NoStyle Part
|
||||
NoStyle Chapter
|
89
lib/layouts/agu_stdclass.inc
Normal file
89
lib/layouts/agu_stdclass.inc
Normal file
@ -0,0 +1,89 @@
|
||||
# Textclass definition file for AGU-Article.
|
||||
# Author : José Abílio Oliveira Matos <jamatos@lyx.org>
|
||||
# Martin Vermeer <martin.vermeer@hut.fi>
|
||||
|
||||
# This file is the counterpart of stdclass.inc
|
||||
# It is desirable, as far as possible, to have the same look and feel for
|
||||
# related layouts in latex and docbook.
|
||||
|
||||
OutputType docbook
|
||||
|
||||
Columns 1
|
||||
Sides 1
|
||||
SecNumDepth 3
|
||||
TocDepth 3
|
||||
DefaultStyle Standard
|
||||
|
||||
|
||||
Style Standard
|
||||
Margin Static
|
||||
LatexType Paragraph
|
||||
LatexName p
|
||||
ParIndent MM
|
||||
ParSkip 0.4
|
||||
Align Block
|
||||
AlignPossible Block
|
||||
LabelType No_Label
|
||||
LatexParam "para#"
|
||||
End
|
||||
|
||||
|
||||
CharStyle Firstname
|
||||
LatexType Command
|
||||
LatexName firstname
|
||||
Font
|
||||
Shape SmallCaps
|
||||
EndFont
|
||||
LabelFont
|
||||
Shape Italic
|
||||
Color red
|
||||
EndFont
|
||||
End
|
||||
|
||||
CharStyle Surname
|
||||
LatexType Command
|
||||
LatexName firstname
|
||||
Font
|
||||
Shape SmallCaps
|
||||
EndFont
|
||||
LabelFont
|
||||
Shape Italic
|
||||
Color red
|
||||
EndFont
|
||||
End
|
||||
|
||||
CharStyle Filename
|
||||
LatexType Command
|
||||
LatexName firstname
|
||||
Font
|
||||
Family Typewriter
|
||||
EndFont
|
||||
LabelFont
|
||||
Shape Italic
|
||||
Color red
|
||||
EndFont
|
||||
End
|
||||
|
||||
CharStyle Literal
|
||||
LatexType Command
|
||||
LatexName firstname
|
||||
Font
|
||||
Family Typewriter
|
||||
EndFont
|
||||
LabelFont
|
||||
Shape Italic
|
||||
Color red
|
||||
EndFont
|
||||
End
|
||||
|
||||
|
||||
Input agu_stdlists.inc
|
||||
Input agu_stdsections.inc
|
||||
Input db_stdstarsections.inc
|
||||
Input db_stdtitle.inc
|
||||
Input db_stdstruct.inc
|
||||
Input db_lyxmacros.inc
|
||||
Input db_stdlayouts.inc
|
||||
Input stdcounters.inc
|
||||
Input agu_stdcounters.inc
|
||||
Input stdfloats.inc
|
34
lib/layouts/agu_stdcounters.inc
Normal file
34
lib/layouts/agu_stdcounters.inc
Normal file
@ -0,0 +1,34 @@
|
||||
# Author : José Matos <jamatos@lyx.org>
|
||||
# Martin Vermeer <martin.vermeer@hut.fi>
|
||||
|
||||
# This include file contains all the counters that are defined as standard
|
||||
# in AGU-Article LyX layouts.
|
||||
|
||||
Counter
|
||||
Name sect1
|
||||
Within section
|
||||
End
|
||||
|
||||
Counter
|
||||
Name sect2
|
||||
Within sect1
|
||||
End
|
||||
|
||||
Counter
|
||||
Name sect3
|
||||
Within sect2
|
||||
End
|
||||
|
||||
Counter
|
||||
Name sect4
|
||||
Within sect3
|
||||
End
|
||||
|
||||
Counter
|
||||
Name sect5
|
||||
Within sect4
|
||||
End
|
||||
|
||||
Counter
|
||||
Name para
|
||||
End
|
37
lib/layouts/agu_stdlists.inc
Normal file
37
lib/layouts/agu_stdlists.inc
Normal file
@ -0,0 +1,37 @@
|
||||
# Textclass definition file for AGU-Article.
|
||||
# Author : José Abílio Oliveira Matos <jamatos@lyx.org>
|
||||
# Martin Vermeer <martin.vermeer@hut.fi>
|
||||
|
||||
# This is the counterpart of stdlists.inc
|
||||
# It is desirable, as far as possible, to have the same look and feel for
|
||||
# related layouts in latex and docbook.
|
||||
|
||||
Input stdlists.inc
|
||||
|
||||
|
||||
Style Itemize
|
||||
LatexType Item_Environment
|
||||
LatexName lst
|
||||
Latexparam "type="bulleted""
|
||||
ItemTag item
|
||||
End
|
||||
|
||||
|
||||
Style Enumerate
|
||||
LatexType Item_Environment
|
||||
LatexName lst
|
||||
Latexparam "type="ordered""
|
||||
ItemTag item
|
||||
End
|
||||
|
||||
|
||||
Style Description
|
||||
LatexType Item_environment
|
||||
LatexName lst
|
||||
Latexparam "type="unordered""
|
||||
ItemTag item
|
||||
End
|
||||
|
||||
# maybe List is the same as simplelist (I need to check it).
|
||||
NoStyle List
|
||||
|
86
lib/layouts/agu_stdsections.inc
Normal file
86
lib/layouts/agu_stdsections.inc
Normal file
@ -0,0 +1,86 @@
|
||||
# Textclass definition file for docbook.
|
||||
# Author : José Abílio Oliveira Matos <jamatos@lyx.org>
|
||||
# Martin Vermeer <martin.vermeer@hut.fi>
|
||||
|
||||
# This file is the counterpart of stdsections.inc
|
||||
# It is desirable, as far as possible, to have the same look and feel for
|
||||
# related layouts in latex and docbook.
|
||||
|
||||
Input stdsections.inc
|
||||
|
||||
Style Part
|
||||
LatexType Command
|
||||
LatexName part
|
||||
InnerTag head
|
||||
LabelTag label
|
||||
CommandDepth 0
|
||||
End
|
||||
|
||||
|
||||
Style Chapter
|
||||
LatexType Command
|
||||
LatexName chapter
|
||||
InnerTag head
|
||||
LabelTag label
|
||||
CommandDepth 1
|
||||
End
|
||||
|
||||
|
||||
Style Section
|
||||
LatexType Command
|
||||
LatexName section
|
||||
InnerTag head
|
||||
LabelTag label
|
||||
CommandDepth 2
|
||||
LatexParam "s#"
|
||||
End
|
||||
|
||||
|
||||
Style Subsection
|
||||
LatexType Command
|
||||
LatexName subsect1
|
||||
InnerTag head
|
||||
LabelTag label
|
||||
CommandDepth 3
|
||||
LatexParam "s#"
|
||||
End
|
||||
|
||||
|
||||
Style Subsubsection
|
||||
LatexType Command
|
||||
LatexName subsect2
|
||||
InnerTag head
|
||||
LabelTag label
|
||||
CommandDepth 4
|
||||
LatexParam "s#"
|
||||
End
|
||||
|
||||
|
||||
Style Paragraph
|
||||
LatexType Command
|
||||
LatexName subsect3
|
||||
InnerTag head
|
||||
LabelTag label
|
||||
CommandDepth 5
|
||||
LatexParam "s#"
|
||||
End
|
||||
|
||||
|
||||
Style Subparagraph
|
||||
LatexType Command
|
||||
LatexName subsect4
|
||||
InnerTag head
|
||||
LabelTag label
|
||||
CommandDepth 6
|
||||
LatexParam "s#"
|
||||
End
|
||||
|
||||
Style Subsubparagraph
|
||||
LatexType Command
|
||||
LatexName subsect5
|
||||
InnerTag head
|
||||
LabelTag label
|
||||
CommandDepth 7
|
||||
LatexParam "s#"
|
||||
End
|
||||
|
@ -2,7 +2,7 @@
|
||||
# Author : José Abílio Oliveira Matos <jamatos@lyx.org>
|
||||
|
||||
# This is the counterpart of lyxmacros.inc
|
||||
# It is desireable, as far as possible, to have the same look and feeling for
|
||||
# It is desirable, as far as possible, to have the same look and feel for
|
||||
# related layouts in latex and docbook.
|
||||
|
||||
Input lyxmacros.inc
|
||||
@ -11,7 +11,7 @@ Style Code
|
||||
CopyStyle LyX-Code
|
||||
LatexType Environment
|
||||
LatexName programlisting
|
||||
LatexParam CDATA
|
||||
InnerTag CDATA
|
||||
PassThru 1
|
||||
End
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
# Author : José Abílio Oliveira Matos <jamatos@lyx.org>
|
||||
|
||||
# This file is the counterpart of stdclass.inc
|
||||
# It is desireable, as far as possible, to have the same look and feeling for
|
||||
# It is desirable, as far as possible, to have the same look and feel for
|
||||
# related layouts in latex and docbook.
|
||||
|
||||
OutputType docbook
|
||||
@ -38,7 +38,7 @@ CharStyle Filename
|
||||
EndFont
|
||||
End
|
||||
|
||||
CharStyle FirstName
|
||||
CharStyle Firstname
|
||||
LatexType Command
|
||||
LatexName firstname
|
||||
Font
|
||||
|
@ -2,7 +2,7 @@
|
||||
# Author : José Abílio Oliveira Matos <jamatos@lyx.org>
|
||||
|
||||
# This is the counterpart of stdlayouts.inc
|
||||
# It is desireable, as far as possible, to have the same look and feeling for
|
||||
# It is desirable, as far as possible, to have the same look and feel for
|
||||
# related layouts in latex and docbook.
|
||||
|
||||
Input stdlayouts.inc
|
||||
@ -34,7 +34,7 @@ End
|
||||
Style Quotation
|
||||
LatexType Environment
|
||||
LatexName blockquote
|
||||
LatexParam para
|
||||
InnerTag para
|
||||
End
|
||||
|
||||
# Quote should be an inline element
|
||||
|
@ -2,7 +2,7 @@
|
||||
# Author : José Abílio Oliveira Matos <jamatos@lyx.org>
|
||||
|
||||
# This is the counterpart of stdlists.inc
|
||||
# It is desireable, as far as possible, to have the same look and feeling for
|
||||
# It is desirable, as far as possible, to have the same look and feel for
|
||||
# related layouts in latex and docbook.
|
||||
|
||||
Input stdlists.inc
|
||||
@ -11,18 +11,23 @@ Input stdlists.inc
|
||||
Style Itemize
|
||||
LatexType Item_Environment
|
||||
LatexName itemizedlist
|
||||
ItemTag listitem
|
||||
End
|
||||
|
||||
|
||||
Style Enumerate
|
||||
LatexType Item_Environment
|
||||
LatexName orderedlist
|
||||
ItemTag listitem
|
||||
End
|
||||
|
||||
|
||||
Style Description
|
||||
LatexType Item_environment
|
||||
LatexName variablelist
|
||||
InnerTag varlistentry
|
||||
LabelTag term
|
||||
ItemTag listitem
|
||||
End
|
||||
|
||||
# maybe List is the same as simplelist (I need to check it).
|
||||
|
@ -2,7 +2,7 @@
|
||||
# Author : José Abílio Oliveira Matos <jamatos@lyx.org>
|
||||
|
||||
# This file is the counterpart of stdstarsections.inc
|
||||
# It is desireable, as far as possible, to have the same look and feeling for
|
||||
# It is desirable, as far as possible, to have the same look and feel for
|
||||
# related layouts in latex and docbook.
|
||||
|
||||
# empty for now, it is possible to do it using bridgehead with attribute
|
||||
|
@ -2,7 +2,7 @@
|
||||
# Author : José Abílio Oliveira Matos <jamatos@lyx.org>
|
||||
|
||||
# This file is the counterpart of stdstruct.inc
|
||||
# It is desireable, as far as possible, to have the same look and feeling for
|
||||
# It is desirable, as far as possible, to have the same look and feel for
|
||||
# related layouts in latex and docbook.
|
||||
|
||||
Input stdstruct.inc
|
||||
@ -10,7 +10,7 @@ Input stdstruct.inc
|
||||
Style Abstract
|
||||
LatexType Environment
|
||||
LatexName abstract
|
||||
LatexParam para
|
||||
InnerTag para
|
||||
End
|
||||
|
||||
NoStyle Bibliography
|
||||
|
@ -13,7 +13,7 @@ Style Title
|
||||
LatexType Command
|
||||
LatexName articleinfo
|
||||
CommandDepth 2
|
||||
InnerTag "title"
|
||||
InnerTag title
|
||||
End
|
||||
|
||||
|
||||
@ -28,7 +28,7 @@ Style Authorgroup
|
||||
CopyStyle Author
|
||||
LatexType Environment
|
||||
LatexName authorgroup
|
||||
LatexParam author
|
||||
InnerTag author
|
||||
End
|
||||
|
||||
|
||||
@ -68,7 +68,8 @@ Style RevisionHistory
|
||||
Margin Static
|
||||
LatexType Command
|
||||
LatexName revhistory
|
||||
LatexParam "3|!-- --"
|
||||
CommandDepth 3
|
||||
InnerTag "!-- --"
|
||||
LeftMargin MMM
|
||||
RightMargin MMM
|
||||
ParIndent MM
|
||||
@ -88,7 +89,8 @@ Style Revision
|
||||
Margin Dynamic
|
||||
LatexType Command
|
||||
LatexName revision
|
||||
LatexParam "4|revnumber"
|
||||
CommandDepth 4
|
||||
InnerTag revnumber
|
||||
LabelSep xxx
|
||||
ParSkip 0.4
|
||||
TopSep 0.9
|
||||
|
@ -11,5 +11,5 @@ Input report
|
||||
Style Title
|
||||
LatexType Command
|
||||
LatexName bookinfo
|
||||
LatexParam "1|"
|
||||
CommandDepth 1
|
||||
End
|
||||
|
@ -10,7 +10,7 @@ Input stnumarticle.inc
|
||||
Style Title
|
||||
LatexType Command
|
||||
LatexName "!-- --"
|
||||
LatexParam "2|"
|
||||
CommandDepth 2
|
||||
End
|
||||
|
||||
|
||||
|
@ -10,7 +10,7 @@ Input numarticle.inc
|
||||
Style Title
|
||||
LatexType Command
|
||||
LatexName "!-- --"
|
||||
LatexParam "3|"
|
||||
CommandDepth 3
|
||||
End
|
||||
|
||||
|
||||
|
@ -1,4 +1,19 @@
|
||||
|
||||
2003-11-25 Martin Vermeer <martin.vermeer@hut.fi>
|
||||
|
||||
* src/buffer.C:
|
||||
* src/lyxlayout.C:
|
||||
* src/lyxlayout.h:
|
||||
* src/lyxtext.h:
|
||||
* src/output_docbook.C:
|
||||
* src/output_latex.C:
|
||||
* src/paragraph.C:
|
||||
* src/paragraph.h:
|
||||
* src/sgml.C:
|
||||
* src/sgml.h:
|
||||
* src/text2.C: Introducing a number of tags parametrizing various
|
||||
XML formats that we may want to support
|
||||
|
||||
2003-11-25 André Pönitz <poenitz@gmx.net>
|
||||
|
||||
* InsetList.[Ch] (begein, end): inline as suggested by profiler
|
||||
|
@ -16,6 +16,7 @@
|
||||
#include "buffer_funcs.h"
|
||||
#include "bufferlist.h"
|
||||
#include "bufferparams.h"
|
||||
#include "counters.h"
|
||||
#include "Bullet.h"
|
||||
#include "Chktex.h"
|
||||
#include "debug.h"
|
||||
@ -1148,6 +1149,7 @@ void Buffer::makeDocBookFile(string const & fname,
|
||||
ofs << "<!-- DocBook file was created by LyX " << lyx_version
|
||||
<< "\n See http://www.lyx.org/ for more information -->\n";
|
||||
|
||||
params().getLyXTextClass().counters().reset();
|
||||
docbookParagraphs(*this, paragraphs(), ofs, runparams);
|
||||
|
||||
ofs << "\n\n";
|
||||
|
@ -82,6 +82,8 @@ enum LayoutTags {
|
||||
LT_TOPSEP,
|
||||
LT_TOCLEVEL,
|
||||
LT_INNERTAG,
|
||||
LT_LABELTAG,
|
||||
LT_ITEMTAG,
|
||||
LT_INTITLE // keep this last!
|
||||
};
|
||||
|
||||
@ -145,6 +147,7 @@ bool LyXLayout::Read(LyXLex & lexrc, LyXTextClass const & tclass)
|
||||
{ "innertag", LT_INNERTAG },
|
||||
{ "intitle", LT_INTITLE },
|
||||
{ "itemsep", LT_ITEMSEP },
|
||||
{ "itemtag", LT_ITEMTAG },
|
||||
{ "keepempty", LT_KEEPEMPTY },
|
||||
{ "labelbottomsep", LT_LABEL_BOTTOMSEP },
|
||||
{ "labelcounter", LT_LABELCOUNTER },
|
||||
@ -153,6 +156,7 @@ bool LyXLayout::Read(LyXLex & lexrc, LyXTextClass const & tclass)
|
||||
{ "labelsep", LT_LABELSEP },
|
||||
{ "labelstring", LT_LABELSTRING },
|
||||
{ "labelstringappendix", LT_LABELSTRING_APPENDIX },
|
||||
{ "labeltag", LT_LABELTAG },
|
||||
{ "labeltype", LT_LABELTYPE },
|
||||
{ "latexfooter", LT_LATEXFOOTER },
|
||||
{ "latexheader", LT_LATEXHEADER },
|
||||
@ -331,7 +335,7 @@ bool LyXLayout::Read(LyXLex & lexrc, LyXTextClass const & tclass)
|
||||
|
||||
case LT_LATEXPARAM:
|
||||
if (lexrc.next())
|
||||
latexparam_ = lexrc.getString();
|
||||
latexparam_ = subst(lexrc.getString(), """, "\"");
|
||||
break;
|
||||
|
||||
case LT_INNERTAG:
|
||||
@ -339,6 +343,16 @@ bool LyXLayout::Read(LyXLex & lexrc, LyXTextClass const & tclass)
|
||||
innertag_ = lexrc.getString();
|
||||
break;
|
||||
|
||||
case LT_LABELTAG:
|
||||
if (lexrc.next())
|
||||
labeltag_ = lexrc.getString();
|
||||
break;
|
||||
|
||||
case LT_ITEMTAG:
|
||||
if (lexrc.next())
|
||||
itemtag_ = lexrc.getString();
|
||||
break;
|
||||
|
||||
case LT_PREAMBLE:
|
||||
preamble_ = lexrc.getLongString("EndPreamble");
|
||||
break;
|
||||
|
@ -65,6 +65,10 @@ public:
|
||||
///
|
||||
std::string const & innertag() const { return innertag_; }
|
||||
///
|
||||
std::string const & labeltag() const { return labeltag_; }
|
||||
///
|
||||
std::string const & itemtag() const { return itemtag_; }
|
||||
///
|
||||
std::string const & labelstring_appendix() const {
|
||||
return labelstring_appendix_;
|
||||
}
|
||||
@ -211,6 +215,10 @@ private:
|
||||
std::string latexparam_;
|
||||
/// Internal tag to use (e.g., <title></title> for sect header)
|
||||
std::string innertag_;
|
||||
/// Internal tag to use e.g. to surround varlistentry label)
|
||||
std::string labeltag_;
|
||||
/// Internal tag to surround the item text in a list)
|
||||
std::string itemtag_;
|
||||
/// Macro definitions needed for this layout
|
||||
std::string preamble_;
|
||||
};
|
||||
|
@ -18,6 +18,7 @@
|
||||
#include "Bidi.h"
|
||||
#include "layout.h"
|
||||
#include "lyxfont.h"
|
||||
#include "lyxtextclass.h"
|
||||
#include "ParagraphList_fwd.h"
|
||||
#include "RowList_fwd.h"
|
||||
#include "textcursor.h"
|
||||
@ -478,4 +479,8 @@ private:
|
||||
/// return the default height of a row in pixels, considering font zoom
|
||||
extern int defaultRowHeight();
|
||||
|
||||
///
|
||||
std::string expandLabel(LyXTextClass const & textclass,
|
||||
LyXLayout_ptr const & layout, bool appendix);
|
||||
|
||||
#endif // LYXTEXT_H
|
||||
|
@ -15,6 +15,8 @@
|
||||
|
||||
#include "buffer.h"
|
||||
#include "bufferparams.h"
|
||||
#include "counters.h"
|
||||
#include "lyxtext.h"
|
||||
#include "paragraph.h"
|
||||
#include "paragraph_funcs.h"
|
||||
#include "ParagraphParameters.h"
|
||||
@ -24,6 +26,7 @@
|
||||
|
||||
#include "support/lstrings.h"
|
||||
#include "support/lyxlib.h"
|
||||
#include "support/tostr.h"
|
||||
|
||||
#include <stack>
|
||||
|
||||
@ -32,6 +35,7 @@
|
||||
|
||||
using lyx::support::atoi;
|
||||
using lyx::support::split;
|
||||
using lyx::support::subst;
|
||||
|
||||
using std::endl;
|
||||
using std::ostream;
|
||||
@ -57,20 +61,21 @@ void docbookParagraphs(Buffer const & buf,
|
||||
|
||||
string command_name;
|
||||
|
||||
string item_tag;
|
||||
|
||||
ParagraphList::iterator par = const_cast<ParagraphList&>(paragraphs).begin();
|
||||
ParagraphList::iterator pend = const_cast<ParagraphList&>(paragraphs).end();
|
||||
|
||||
Counters & counters = buf.params().getLyXTextClass().counters();
|
||||
|
||||
for (; par != pend; ++par) {
|
||||
string inner_tag;
|
||||
int desc_on = 0; // description mode
|
||||
|
||||
LyXLayout_ptr const & style = par->layout();
|
||||
|
||||
// environment tag closing
|
||||
for (; depth > par->params().depth(); --depth) {
|
||||
if (!environment_inner[depth].empty())
|
||||
sgml::closeEnvTags(os, false, environment_inner[depth],
|
||||
command_depth + depth);
|
||||
item_tag, command_depth + depth);
|
||||
sgml::closeTag(os, depth + command_depth, false, environment_stack[depth]);
|
||||
environment_stack[depth].erase();
|
||||
environment_inner[depth].erase();
|
||||
@ -80,19 +85,25 @@ void docbookParagraphs(Buffer const & buf,
|
||||
&& environment_stack[depth] != style->latexname()
|
||||
&& !environment_stack[depth].empty()) {
|
||||
sgml::closeEnvTags(os, false, environment_inner[depth],
|
||||
command_depth + depth);
|
||||
item_tag, command_depth + depth);
|
||||
sgml::closeTag(os, depth + command_depth, false, environment_stack[depth]);
|
||||
|
||||
environment_stack[depth].erase();
|
||||
environment_inner[depth].erase();
|
||||
}
|
||||
|
||||
|
||||
string ls = "";
|
||||
bool labelid = false;
|
||||
// Write opening SGML tags.
|
||||
string item_name;
|
||||
switch (style->latextype) {
|
||||
case LATEX_PARAGRAPH:
|
||||
if (!style->latexparam().empty()) {
|
||||
counters.step("para");
|
||||
int i = counters.value("para");
|
||||
ls = "id=\"" + subst(style->latexparam(), "#", tostr(i)) + '"';
|
||||
}
|
||||
sgml::openTag(os, depth + command_depth,
|
||||
false, style->latexname());
|
||||
false, style->latexname(), ls);
|
||||
break;
|
||||
|
||||
case LATEX_COMMAND:
|
||||
@ -103,7 +114,6 @@ void docbookParagraphs(Buffer const & buf,
|
||||
command_name = style->latexname();
|
||||
|
||||
cmd_depth = style->commanddepth;
|
||||
inner_tag = style->innertag();
|
||||
|
||||
if (command_flag) {
|
||||
if (cmd_depth < command_base) {
|
||||
@ -130,6 +140,9 @@ void docbookParagraphs(Buffer const & buf,
|
||||
command_stack.push_back(string());
|
||||
command_stack[command_depth] = command_name;
|
||||
|
||||
if (!style->latexparam().empty()) {
|
||||
counters.step(style->counter);
|
||||
}
|
||||
// treat label as a special case for
|
||||
// more WYSIWYM handling.
|
||||
// This is a hack while paragraphs can't have
|
||||
@ -141,13 +154,29 @@ void docbookParagraphs(Buffer const & buf,
|
||||
command_name += " id=\"";
|
||||
command_name += (static_cast<InsetCommand *>(inset))->getContents();
|
||||
command_name += '"';
|
||||
desc_on = 3;
|
||||
labelid = true;
|
||||
}
|
||||
} else {
|
||||
if (!style->latexparam().empty()) {
|
||||
ls = expandLabel(buf.params().getLyXTextClass(), style, false);
|
||||
ls = "id=\"" + subst(style->latexparam(), "#", ls) + '"';
|
||||
}
|
||||
}
|
||||
|
||||
sgml::openTag(os, depth + command_depth, false, command_name, ls);
|
||||
|
||||
// Label around sectioning number:
|
||||
if (!style->labeltag().empty()) {
|
||||
sgml::openTag(os, depth + 1 + command_depth, false,
|
||||
style->labeltag());
|
||||
os << expandLabel(buf.params().getLyXTextClass(), style, false);
|
||||
sgml::closeTag(os, depth + 1 + command_depth, false,
|
||||
style->labeltag());
|
||||
}
|
||||
|
||||
sgml::openTag(os, depth + command_depth, false, command_name);
|
||||
// Inner tagged header text, e.g. <title> for sectioning:
|
||||
sgml::openTag(os, depth + 1 + command_depth, false, inner_tag);
|
||||
sgml::openTag(os, depth + 1 + command_depth, false,
|
||||
style->innertag());
|
||||
break;
|
||||
|
||||
case LATEX_ENVIRONMENT:
|
||||
@ -164,31 +193,30 @@ void docbookParagraphs(Buffer const & buf,
|
||||
}
|
||||
environment_stack[depth] = style->latexname();
|
||||
environment_inner[depth] = "!-- --";
|
||||
sgml::openTag(os, depth + command_depth, false, environment_stack[depth]);
|
||||
// outputs <environment_stack[depth] latexparam()>
|
||||
sgml::openTag(os, depth + command_depth, false,
|
||||
environment_stack[depth], style->latexparam());
|
||||
} else {
|
||||
sgml::closeEnvTags(os, false, environment_inner[depth],
|
||||
command_depth + depth);
|
||||
sgml::closeEnvTags(os, false, environment_inner[depth],
|
||||
style->itemtag(), command_depth + depth);
|
||||
}
|
||||
|
||||
if (style->latextype == LATEX_ENVIRONMENT) {
|
||||
if (!style->latexparam().empty()) {
|
||||
if (style->latexparam() == "CDATA")
|
||||
if (!style->innertag().empty()) {
|
||||
if (style->innertag() == "CDATA")
|
||||
os << "<![CDATA[";
|
||||
else
|
||||
sgml::openTag(os, depth + command_depth, false, style->latexparam());
|
||||
sgml::openTag(os, depth + command_depth, false,
|
||||
style->innertag());
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
desc_on = (style->labeltype == LABEL_MANUAL);
|
||||
environment_inner[depth] = style->innertag();
|
||||
|
||||
environment_inner[depth] = desc_on ? "varlistentry" : "listitem";
|
||||
sgml::openTag(os, depth + 1 + command_depth,
|
||||
if (!environment_inner[depth].empty())
|
||||
sgml::openTag(os, depth + 1 + command_depth,
|
||||
false, environment_inner[depth]);
|
||||
|
||||
item_name = desc_on ? "term" : "para";
|
||||
sgml::openTag(os, depth + 1 + command_depth,
|
||||
false, item_name);
|
||||
break;
|
||||
default:
|
||||
sgml::openTag(os, depth + command_depth,
|
||||
@ -196,27 +224,26 @@ void docbookParagraphs(Buffer const & buf,
|
||||
break;
|
||||
}
|
||||
|
||||
par->simpleDocBookOnePar(buf, os, outerFont(par, paragraphs), desc_on,
|
||||
runparams, depth + 1 + command_depth);
|
||||
par->simpleDocBookOnePar(buf, os, outerFont(par, paragraphs),
|
||||
runparams, depth + 1 + command_depth, labelid);
|
||||
|
||||
string end_tag;
|
||||
// write closing SGML tags
|
||||
switch (style->latextype) {
|
||||
case LATEX_COMMAND:
|
||||
sgml::closeTag(os, depth + command_depth, false, inner_tag);
|
||||
sgml::closeTag(os, depth + command_depth, false,
|
||||
style->innertag());
|
||||
break;
|
||||
case LATEX_ENVIRONMENT:
|
||||
if (!style->latexparam().empty()) {
|
||||
if (style->latexparam() == "CDATA")
|
||||
if (!style->innertag().empty()) {
|
||||
if (style->innertag() == "CDATA")
|
||||
os << "]]>";
|
||||
else
|
||||
sgml::closeTag(os, depth + command_depth, false, style->latexparam());
|
||||
sgml::closeTag(os, depth + command_depth, false,
|
||||
style->innertag());
|
||||
}
|
||||
break;
|
||||
case LATEX_ITEM_ENVIRONMENT:
|
||||
if (desc_on == 1) break;
|
||||
end_tag = "para";
|
||||
sgml::closeTag(os, depth + 1 + command_depth, false, end_tag);
|
||||
item_tag = style->itemtag();
|
||||
break;
|
||||
case LATEX_PARAGRAPH:
|
||||
sgml::closeTag(os, depth + command_depth, false, style->latexname());
|
||||
@ -231,7 +258,7 @@ void docbookParagraphs(Buffer const & buf,
|
||||
for (int d = depth; d >= 0; --d) {
|
||||
if (!environment_stack[depth].empty()) {
|
||||
sgml::closeEnvTags(os, false, environment_inner[depth],
|
||||
command_depth + depth);
|
||||
item_tag, command_depth + depth);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -131,20 +131,14 @@ TeXEnvironment(Buffer const & buf,
|
||||
}
|
||||
|
||||
if (style->isEnvironment()) {
|
||||
os << "\\begin{" << style->latexname() << '}';
|
||||
if (style->latextype == LATEX_LIST_ENVIRONMENT) {
|
||||
os << "\\begin{" << style->latexname() << "}{"
|
||||
<< pit->params().labelWidthString() << "}\n";
|
||||
os << "{" << pit->params().labelWidthString() << "}\n";
|
||||
} else if (style->labeltype == LABEL_BIBLIO) {
|
||||
// ale970405
|
||||
os << "\\begin{" << style->latexname() << "}{"
|
||||
<< bibitemWidest(buf)
|
||||
<< "}\n";
|
||||
} else if (style->latextype == LATEX_ITEM_ENVIRONMENT) {
|
||||
os << "\\begin{" << style->latexname() << '}'
|
||||
<< style->latexparam() << '\n';
|
||||
os << "{" << bibitemWidest(buf) << "}\n";
|
||||
} else
|
||||
os << "\\begin{" << style->latexname() << '}'
|
||||
<< style->latexparam() << '\n';
|
||||
os << style->latexparam() << '\n';
|
||||
texrow.newline();
|
||||
}
|
||||
ParagraphList::iterator par = pit;
|
||||
|
@ -22,6 +22,7 @@
|
||||
|
||||
#include "buffer.h"
|
||||
#include "bufferparams.h"
|
||||
#include "counters.h"
|
||||
#include "encoding.h"
|
||||
#include "debug.h"
|
||||
#include "gettext.h"
|
||||
@ -39,8 +40,9 @@
|
||||
#include "insets/insetoptarg.h"
|
||||
|
||||
#include "support/lstrings.h"
|
||||
#include "support/textutils.h"
|
||||
#include "support/std_sstream.h"
|
||||
#include "support/textutils.h"
|
||||
#include "support/tostr.h"
|
||||
|
||||
#include <boost/tuple/tuple.hpp>
|
||||
|
||||
@ -1329,19 +1331,43 @@ void Paragraph::simpleLinuxDocOnePar(Buffer const & buf,
|
||||
void Paragraph::simpleDocBookOnePar(Buffer const & buf,
|
||||
ostream & os,
|
||||
LyXFont const & outerfont,
|
||||
int & desc_on,
|
||||
OutputParams const & runparams,
|
||||
lyx::depth_type depth) const
|
||||
lyx::depth_type depth,
|
||||
bool labelid) const
|
||||
{
|
||||
bool emph_flag = false;
|
||||
|
||||
LyXLayout_ptr const & style = layout();
|
||||
LyXLayout_ptr const & defaultstyle
|
||||
= buf.params().getLyXTextClass().defaultLayout();
|
||||
|
||||
LyXFont font_old = (style->labeltype == LABEL_MANUAL ? style->labelfont : style->font);
|
||||
|
||||
int char_line_count = depth;
|
||||
//if (!style.free_spacing)
|
||||
// os << string(depth,' ');
|
||||
bool label_closed = true;
|
||||
bool para_closed = true;
|
||||
|
||||
if (style->latextype == LATEX_ITEM_ENVIRONMENT) {
|
||||
string ls = "";
|
||||
Counters & counters = buf.params().getLyXTextClass().counters();
|
||||
if (!style->free_spacing)
|
||||
os << string(depth,' ');
|
||||
if (!style->labeltag().empty()) {
|
||||
os << "<" << style->labeltag() << ">\n";
|
||||
label_closed = false;
|
||||
} else {
|
||||
if (!defaultstyle->latexparam().empty()) {
|
||||
counters.step("para");
|
||||
ls = tostr(counters.value("para"));
|
||||
ls = " id=\""
|
||||
+ subst(defaultstyle->latexparam(), "#", ls) + '"';
|
||||
}
|
||||
os << "<" << style->itemtag() << ">\n"
|
||||
<< string(depth, ' ') << "<"
|
||||
<< defaultstyle->latexname() << ls << ">\n";
|
||||
para_closed = false;
|
||||
}
|
||||
}
|
||||
|
||||
// parsing main loop
|
||||
for (pos_type i = 0; i < size(); ++i) {
|
||||
@ -1370,7 +1396,8 @@ void Paragraph::simpleDocBookOnePar(Buffer const & buf,
|
||||
if (isInset(i)) {
|
||||
InsetOld const * inset = getInset(i);
|
||||
// don't print the inset in position 0 if desc_on == 3 (label)
|
||||
if (i || desc_on != 3) {
|
||||
//if (i || desc_on != 3) {
|
||||
if (!labelid) {
|
||||
if (style->latexparam() == "CDATA")
|
||||
os << "]]>";
|
||||
inset->docbook(buf, os, runparams);
|
||||
@ -1387,10 +1414,13 @@ void Paragraph::simpleDocBookOnePar(Buffer const & buf,
|
||||
os << c;
|
||||
} else if (isFreeSpacing() || c != ' ') {
|
||||
os << str;
|
||||
} else if (desc_on == 1) {
|
||||
} else if (!style->labeltag().empty() && !label_closed) {
|
||||
++char_line_count;
|
||||
os << "\n</term><listitem><para>";
|
||||
desc_on = 2;
|
||||
os << "\n</" << style->labeltag() << "><"
|
||||
<< style->itemtag() << "><"
|
||||
<< defaultstyle->latexname() << ">";
|
||||
label_closed = true;
|
||||
para_closed = false;
|
||||
} else {
|
||||
os << ' ';
|
||||
}
|
||||
@ -1407,9 +1437,15 @@ void Paragraph::simpleDocBookOnePar(Buffer const & buf,
|
||||
}
|
||||
|
||||
// resets description flag correctly
|
||||
if (desc_on == 1) {
|
||||
if (!label_closed) {
|
||||
// <term> not closed...
|
||||
os << "</term>\n<listitem><para> </para>";
|
||||
os << "</" << style->labeltag() << ">\n<"
|
||||
<< style->itemtag() << "><"
|
||||
<< defaultstyle->latexname() << "> ";
|
||||
}
|
||||
if (!para_closed) {
|
||||
os << "\n" << string(depth, ' ') << "</"
|
||||
<< defaultstyle->latexname() << ">\n";
|
||||
}
|
||||
if (style->free_spacing)
|
||||
os << '\n';
|
||||
|
@ -129,9 +129,9 @@ public:
|
||||
void simpleDocBookOnePar(Buffer const & buf,
|
||||
std::ostream &,
|
||||
LyXFont const & outerfont,
|
||||
int & desc_on,
|
||||
OutputParams const & runparams,
|
||||
lyx::depth_type depth) const;
|
||||
lyx::depth_type depth,
|
||||
bool labelid) const;
|
||||
|
||||
///
|
||||
bool hasSameLayout(Paragraph const & par) const;
|
||||
|
14
src/sgml.C
14
src/sgml.C
@ -85,12 +85,16 @@ pair<bool, string> escapeChar(char c)
|
||||
|
||||
|
||||
int openTag(ostream & os, Paragraph::depth_type depth,
|
||||
bool mixcont, string const & latexname)
|
||||
bool mixcont, string const & latexname,
|
||||
string const & latexparam)
|
||||
{
|
||||
if (!latexname.empty() && latexname != "!-- --") {
|
||||
if (!mixcont)
|
||||
os << string(depth, ' ');
|
||||
os << '<' << latexname << '>';
|
||||
os << '<' << latexname;
|
||||
if (!latexparam.empty())
|
||||
os << " " << latexparam;
|
||||
os << '>';
|
||||
}
|
||||
|
||||
if (!mixcont)
|
||||
@ -118,13 +122,13 @@ int closeTag(ostream & os, Paragraph::depth_type depth,
|
||||
|
||||
unsigned int closeEnvTags(ostream & os, bool mixcont,
|
||||
string const & environment_inner_depth,
|
||||
string const & itemtag,
|
||||
lyx::depth_type total_depth)
|
||||
{
|
||||
unsigned int lines = 0;
|
||||
if (environment_inner_depth != "!-- --") {
|
||||
string item_name= "listitem";
|
||||
lines += closeTag(os, total_depth, mixcont, item_name);
|
||||
if (environment_inner_depth == "varlistentry")
|
||||
lines += closeTag(os, total_depth, mixcont, itemtag);
|
||||
if (!environment_inner_depth.empty())
|
||||
lines += closeTag(os, total_depth, mixcont,
|
||||
environment_inner_depth);
|
||||
}
|
||||
|
@ -29,7 +29,8 @@ std::pair<bool, std::string> escapeChar(char c);
|
||||
|
||||
/// FIXME
|
||||
int openTag(std::ostream & os, lyx::depth_type depth,
|
||||
bool mixcont, std::string const & latexname);
|
||||
bool mixcont, std::string const & latexname,
|
||||
std::string const & latexparam = std::string());
|
||||
|
||||
/// FIXME
|
||||
int closeTag(std::ostream & os, lyx::depth_type depth,
|
||||
@ -39,6 +40,7 @@ int closeTag(std::ostream & os, lyx::depth_type depth,
|
||||
unsigned int closeEnvTags(std::ostream & os,
|
||||
bool mixcont,
|
||||
std::string const & environment_inner_depth,
|
||||
std::string const & item_tag,
|
||||
lyx::depth_type total_depth);
|
||||
|
||||
}
|
||||
|
@ -724,8 +724,6 @@ void LyXText::setParagraph(
|
||||
}
|
||||
|
||||
|
||||
namespace {
|
||||
|
||||
string expandLabel(LyXTextClass const & textclass,
|
||||
LyXLayout_ptr const & layout, bool appendix)
|
||||
{
|
||||
@ -748,6 +746,8 @@ string expandLabel(LyXTextClass const & textclass,
|
||||
}
|
||||
|
||||
|
||||
namespace {
|
||||
|
||||
void incrementItemDepth(ParagraphList::iterator pit,
|
||||
ParagraphList::iterator first_pit)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user