From: José Matox Date: Sun, 28 Jan 2001 21:54:15 +0000 (+0000) Subject: The support for docbooc layouts is now modular. X-Git-Tag: 1.6.10~21679 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=8e47dbd26c2d0a5c7f354526c92776dd81f2e986;p=lyx.git The support for docbooc layouts is now modular. New support for CDATA sections. Two more layouts for document inclusion. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@1414 a592a061-630c-0410-9148-cb99ea01b6c8 --- diff --git a/lib/ChangeLog b/lib/ChangeLog index a2a6b49dc9..b144e57aa7 100644 --- a/lib/ChangeLog +++ b/lib/ChangeLog @@ -1,3 +1,22 @@ +2001-01-28 José Matos + + * layouts/db_lyxmacros.inc + * layouts/db_stdclass.inc + * layouts/db_stdlayouts.inc + * layouts/db_stdlists.inc + * layouts/db_stdsections.inc + * layouts/db_stdstarsections.inc + * layouts/db_stdstruct.inc + * layouts/db_stdtitle.inc: new files with modular support + for docbook. + + * layouts/docbook-chapter.layout + * layouts/docbook-section.layout: new files, useful for + document inclusion. + + * layouts/docbook.layout + * layouts/docbook-book.layout: updated to use the modular support. + 2001-01-28 Dekel Tsur * ui/default.ui: Move the Bookmarks submenu to the Navigate menu. diff --git a/lib/layouts/db_lyxmacros.inc b/lib/layouts/db_lyxmacros.inc new file mode 100644 index 0000000000..8793ed9bf7 --- /dev/null +++ b/lib/layouts/db_lyxmacros.inc @@ -0,0 +1,37 @@ +# Textclass definition file for docbook. +# Author : José Abílio Oliveira Matos + +# This is the counterpart of lyxmacros.inc +# It is desireable, as far as possible, to have the same look and feeling for +# related layouts in latex and docbook. + +Input lyxmacros.inc + +# Code style definition +Style Code + CopyStyle LyX-Code + LatexType Environment + LatexName programlisting + LatexParam CDATA + Preamble + EndPreamble + Font + Latex Latex + EndFont +End + +# Comment style definition +Style Comment + LatexType Paragraph + LatexName comment +End + +Style LyX-Code + ObsoletedBy Code +End + +NoStyle LyX-Code + +NoStyle Address + +NoStyle Right_Address \ No newline at end of file diff --git a/lib/layouts/db_stdclass.inc b/lib/layouts/db_stdclass.inc new file mode 100644 index 0000000000..dc310a2713 --- /dev/null +++ b/lib/layouts/db_stdclass.inc @@ -0,0 +1,44 @@ +# Textclass definition file for docbook. +# Author : José Abílio Oliveira Matos + +# This file is the counterpart of stdclass.inc +# It is desireable, as far as possible, to have the same look and feeling for +# related layouts in latex and docbook. + +OutputType docbook + +# General textclass parameters +Columns 1 +Sides 1 +SecNumDepth 3 +TocDepth 3 + +# This is just to show how to declare the default font. +# The defaults are exactly those shown here. +DefaultFont + Family Roman + Series Medium + Shape Up + Size Normal + Color None +EndFont + +# Standard style definition +Style Standard + Margin Static + LatexType Paragraph + LatexName para + ParIndent MM + ParSkip 0.4 + Align Block + AlignPossible Block + LabelType No_Label +End + +Input db_stdlists.inc +Input db_stdsections.inc +Input db_stdstarsections.inc +Input db_stdtitle.inc +Input db_stdstruct.inc +Input db_lyxmacros.inc +Input db_stdlayouts.inc diff --git a/lib/layouts/db_stdlayouts.inc b/lib/layouts/db_stdlayouts.inc new file mode 100644 index 0000000000..e6526a9c85 --- /dev/null +++ b/lib/layouts/db_stdlayouts.inc @@ -0,0 +1,42 @@ +# Textclass definition file for docbook. +# Author : José Abílio Oliveira Matos + +# This is the counterpart of stdlayouts.inc +# It is desireable, as far as possible, to have the same look and feeling for +# related layouts in latex and docbook. + +Input stdlayouts.inc + +# SGML style definition +Style SGML + CopyStyle LaTeX + LatexName "!-- --" +End + +NoStyle LaTeX + +# Verbatim style definition +Style Literal + LatexType Environment + LatexName literallayout + Font + Latex Latex + EndFont +End + +# Quote style definition +Style Quotation + LatexType Environment + LatexName blockquote + LatexParam para +End + +# Quote should be an inline element +NoStyle Quote + +NoStyle Verse + +Style Caption + LatexType Paragraph + LatexName caption +End \ No newline at end of file diff --git a/lib/layouts/db_stdlists.inc b/lib/layouts/db_stdlists.inc new file mode 100644 index 0000000000..7c486e64cb --- /dev/null +++ b/lib/layouts/db_stdlists.inc @@ -0,0 +1,30 @@ +# Textclass definition file for docbook. +# Author : José Abílio Oliveira Matos + +# This is the counterpart of stdlists.inc +# It is desireable, as far as possible, to have the same look and feeling for +# related layouts in latex and docbook. + +Input stdlists.inc + +# Itemize style definition +Style Itemize + LatexType Item_Environment + LatexName itemizedlist +End + +# Enumerate style definition +Style Enumerate + LatexType Item_Environment + LatexName orderedlist +End + +# Description style definition +Style Description + LatexType Item_environment + LatexName variablelist +End + +# maybe List is the same as simplelist (I need to check it). +NoStyle List + diff --git a/lib/layouts/db_stdsections.inc b/lib/layouts/db_stdsections.inc new file mode 100644 index 0000000000..773cd40d6e --- /dev/null +++ b/lib/layouts/db_stdsections.inc @@ -0,0 +1,58 @@ +# Textclass definition file for docbook. +# Author : José Abílio Oliveira Matos + +# This file is the counterpart of stdsections.inc +# It is desireable, as far as possible, to have the same look and feeling for +# related layouts in latex and docbook. + +Input stdsections.inc + +# Part style definition +Style Part + LatexType Command + LatexName part + LatexParam "0|" +End + +# Chapter style definition +Style Chapter + LatexType Command + LatexName chapter + LatexParam "1|" +End + +# Section style definition +Style Section + LatexType Command + LatexName sect1 + LatexParam "2|" +End + +# Subsection style definition +Style Subsection + LatexType Command + LatexName sect2 + LatexParam "3|" +End + +# Subsubsection style definition +Style Subsubsection + LatexType Command + LatexName sect3 + LatexParam "4|" +End + +# Paragraph style definition +Style Paragraph + LatexType Command + LatexName sect4 + LatexParam "5|" +End + +# Subparagraph style definition +Style Subparagraph + LatexType Command + LatexName sect5 + LatexParam "6|" +End + diff --git a/lib/layouts/db_stdstarsections.inc b/lib/layouts/db_stdstarsections.inc new file mode 100644 index 0000000000..87d2c0b94b --- /dev/null +++ b/lib/layouts/db_stdstarsections.inc @@ -0,0 +1,9 @@ +# Textclass definition file for docbook. +# Author : José Abílio Oliveira Matos + +# This file is the counterpart of stdstarsections.inc +# It is desireable, as far as possible, to have the same look and feeling for +# related layouts in latex and docbook. + +# empty for now, it is possible to do it using bridgehead with attribute +# renderas="part|chapter|sect1|sect2|sect3|sect4|sect5" \ No newline at end of file diff --git a/lib/layouts/db_stdstruct.inc b/lib/layouts/db_stdstruct.inc new file mode 100644 index 0000000000..ff7350f1cd --- /dev/null +++ b/lib/layouts/db_stdstruct.inc @@ -0,0 +1,17 @@ +# Textclass definition file for docbook. +# Author : José Abílio Oliveira Matos + +# This file is the counterpart of stdstruct.inc +# It is desireable, as far as possible, to have the same look and feeling for +# related layouts in latex and docbook. + +Input stdstruct.inc + +# Abstract style definition +Style Abstract + LatexType Environment + LatexName abstract + LatexParam para +End + +NoStyle Bibliography \ No newline at end of file diff --git a/lib/layouts/db_stdtitle.inc b/lib/layouts/db_stdtitle.inc new file mode 100644 index 0000000000..365da4177f --- /dev/null +++ b/lib/layouts/db_stdtitle.inc @@ -0,0 +1,52 @@ +# Textclass definition file for docbook. +# Author : José Abílio Oliveira Matos + +# This file is the counterpart of stdstile.inc +# It is desireable, as far as possible, to have the same look and feeling for +# related layouts in latex and docbook. + +Input stdtitle.inc + +# Title style definition +Style Title + LatexType Command + LatexName artheader + LatexParam "2|" +End + +# Author style definition +Style Author + LatexType Environment + LatexName author + KeepEmpty 1 +End + +# first name style definition +Style FirstName + Margin Static + LatexType Paragraph + LatexName firstname + ParIndent MM + ParSkip 0.4 + Align Center + AlignPossible Center + LabelType No_Label +End + +# surname style definition +Style Surname + Margin Static + LatexType Paragraph + LatexName surname + ParIndent MM + ParSkip 0.4 + Align Center + AlignPossible Center + LabelType No_Label +End + +# Date style definition +Style Date + LatexType Paragraph + LatexName date +End diff --git a/lib/layouts/docbook-book.layout b/lib/layouts/docbook-book.layout index 26839ca00a..9176b8a2f5 100644 --- a/lib/layouts/docbook-book.layout +++ b/lib/layouts/docbook-book.layout @@ -1,32 +1,13 @@ #% Do not delete the line below; configure depends on this -# \DeclareDocBookClass[book]{SGML (DocBook book)} +# \DeclareDocBookClass[book]{DocBook book (SGML)} # DocBook textclass definition file. # Author : Jose' Matos # hacked for books: Luc Abom # Input general definitions -Input stdclass.inc - -OutputType docbook - -MaxCounter Counter_Section -SecNumDepth 3 -TocDepth 3 - -#docbook specific definitions -Style Standard - LatexType Paragraph - LatexName para -End - -# Quote style definition -Style Quotation - LatexType Environment - LatexName blockquote - LatexParam para -End - +Input db_stdclass.inc +MaxCounter Counter_Chapter # Title style definition Style Title @@ -34,155 +15,3 @@ Style Title LatexName bookinfo LatexParam "1|" End - - - -# Title style definition -Style Chapter - LatexType Command - LatexName chapter - LatexParam "1|" -End - -# Section style definition -Style Section - LatexType Command - LatexName sect1 - LatexParam "2|" -End - -# Subsection style definition -Style Subsection - LatexType Command - LatexName sect2 - LatexParam "3|" -End - -# Subsubsection style definition -Style Subsubsection - LatexType Command - LatexName sect3 - LatexParam "4|" -End - -# Paragraph style definition -Style Paragraph - LatexType Command - LatexName sect4 - LatexParam "5|" -End - -# Subparagraph style definition -Style Subparagraph - LatexType Command - LatexName sect5 - LatexParam "6|" -End - -# Enumerate style definition -Style Enumerate - LatexType Item_Environment - LatexName orderedlist -End - -# Itemize style definition -Style Itemize - LatexType Item_Environment - LatexName itemizedlist -End - -# Description style definition -Style Description - LatexType Item_environment - LatexName variablelist -End - -# Verbatim style definition -Style Literal - LatexType Environment - LatexName literallayout - Font - Latex Latex - EndFont -End - -# Code style definition -Style Code - CopyStyle LyX-Code - LatexType Environment - LatexName programlisting - Font - Latex Latex - EndFont -End - -# Author style definition -Style Author - LatexType Environment - LatexName author - KeepEmpty 1 -End - -# first name style definition -Style FirstName - Margin Static - LatexType Paragraph - LatexName firstname - ParIndent MM - ParSkip 0.4 - Align Center - AlignPossible Center - LabelType No_Label -End - -# surname style definition -Style Surname - Margin Static - LatexType Paragraph - LatexName surname - ParIndent MM - ParSkip 0.4 - Align Center - AlignPossible Center - LabelType No_Label -End - -# Date style definition -Style Date - LatexType Paragraph - LatexName date -End - -# Abstract style definition -Style Abstract - LatexType Environment - LatexName abstract - LatexParam para -End - -# SGML style definition -Style SGML - CopyStyle LaTeX - LatexName "!-- --" -End - -# There are no chapters or parts in an docbook article. -#NoStyle Chapter -NoStyle Chapter* -NoStyle Part -NoStyle Part* -NoStyle LaTeX -NoStyle LyX-Code -NoStyle Address -NoStyle Right_Address -NoStyle LaTeX_Title -NoStyle Verse -NoStyle Section* -NoStyle Subsection* -NoStyle Subsubsection* -NoStyle Paragraph* -NoStyle Subparagraph* - -Style LyX-Code - ObsoletedBy Code -End diff --git a/lib/layouts/docbook-chapter.layout b/lib/layouts/docbook-chapter.layout new file mode 100644 index 0000000000..5396f710c6 --- /dev/null +++ b/lib/layouts/docbook-chapter.layout @@ -0,0 +1,20 @@ +#% Do not delete the line below; configure depends on this +# \DeclareDocBookClass[chapter]{DocBook chapter (SGML)} +# DocBook textclass definition file. +# Author : Jose' Matos + +# Input general definitions +Input db_stdclass.inc + +MaxCounter Counter_Section + +# Title style definition +Style Title + LatexType Command + LatexName "!-- --" + LatexParam "2|" +End + +# Exclude higher, or equal, sections: +NoStyle Part +NoStyle Chapter diff --git a/lib/layouts/docbook-section.layout b/lib/layouts/docbook-section.layout new file mode 100644 index 0000000000..0479a0d53e --- /dev/null +++ b/lib/layouts/docbook-section.layout @@ -0,0 +1,21 @@ +#% Do not delete the line below; configure depends on this +# \DeclareDocBookClass[section]{DocBook section (SGML)} +# DocBook textclass definition file. +# Author : Jose' Matos + +# Input general definitions +Input db_stdclass.inc + +MaxCounter Counter_Subsection + +# Title style definition +Style Title + LatexType Command + LatexName "!-- --" + LatexParam "3|" +End + +# Exclude higher, or equal, sections: +NoStyle Part +NoStyle Chapter +NoStyle Section diff --git a/lib/layouts/docbook.layout b/lib/layouts/docbook.layout index 8110d6eeba..32c2f673a8 100644 --- a/lib/layouts/docbook.layout +++ b/lib/layouts/docbook.layout @@ -1,178 +1,9 @@ #% Do not delete the line below; configure depends on this -# \DeclareDocBookClass[article]{SGML (DocBook article)} +# \DeclareDocBookClass[article]{DocBook article (SGML)} # DocBook textclass definition file. # Author : Jose' Matos # Input general definitions -Input stdclass.inc - -OutputType docbook +Input db_stdclass.inc MaxCounter Counter_Section -SecNumDepth 3 -TocDepth 3 - -#docbook specific definitions -Style Standard - LatexType Paragraph - LatexName para -End - -# Quote style definition -Style Quotation - LatexType Environment - LatexName blockquote - LatexParam para -End - -# Title style definition -Style Title - LatexType Command - LatexName artheader - LatexParam "1|" -End - -# Section style definition -Style Section - LatexType Command - LatexName sect1 - LatexParam "1|" -End - -# Subsection style definition -Style Subsection - LatexType Command - LatexName sect2 - LatexParam "2|" -End - -# Subsubsection style definition -Style Subsubsection - LatexType Command - LatexName sect3 - LatexParam "3|" -End - -# Paragraph style definition -Style Paragraph - LatexType Command - LatexName sect4 - LatexParam "4|" -End - -# Subparagraph style definition -Style Subparagraph - LatexType Command - LatexName sect5 - LatexParam "5|" -End - -# Enumerate style definition -Style Enumerate - LatexType Item_Environment - LatexName orderedlist -End - -# Itemize style definition -Style Itemize - LatexType Item_Environment - LatexName itemizedlist -End - -# Description style definition -Style Description - LatexType Item_environment - LatexName variablelist -End - -# Verbatim style definition -Style Literal - LatexType Environment - LatexName literallayout - Font - Latex Latex - EndFont -End - -# Code style definition -Style Code - CopyStyle LyX-Code - LatexType Environment - LatexName programlisting - Preamble - EndPreamble - Font - Latex Latex - EndFont -End - -# Author style definition -Style Author - LatexType Environment - LatexName author - KeepEmpty 1 -End - -# first name style definition -Style FirstName - Margin Static - LatexType Paragraph - LatexName firstname - ParIndent MM - ParSkip 0.4 - Align Center - AlignPossible Center - LabelType No_Label -End - -# surname style definition -Style Surname - Margin Static - LatexType Paragraph - LatexName surname - ParIndent MM - ParSkip 0.4 - Align Center - AlignPossible Center - LabelType No_Label -End - -# Date style definition -Style Date - LatexType Paragraph - LatexName date -End - -# Abstract style definition -Style Abstract - LatexType Environment - LatexName abstract - LatexParam para -End - -# SGML style definition -Style SGML - CopyStyle LaTeX - LatexName "!-- --" -End - -# There are no chapters or parts in an docbook article. -NoStyle Chapter -NoStyle Chapter* -NoStyle Part -NoStyle Part* -NoStyle LaTeX -NoStyle LyX-Code -NoStyle Address -NoStyle Right_Address -NoStyle LaTeX_Title -NoStyle Verse -NoStyle Section* -NoStyle Subsection* -NoStyle Subsubsection* -NoStyle Paragraph* -NoStyle Subparagraph* - -Style LyX-Code - ObsoletedBy Code -End diff --git a/src/ChangeLog b/src/ChangeLog index 952f7e7004..6ff00325d1 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,10 @@ +2001-01-28 José Matos + + * buffer.C (makeDocBookFile): adds support for document language. + A silly restriction on the name of LatexCommand types where removed. + Added support for CDATA sections, allows to chars unsecaped, used + among others in code, to avoid escape < and >. + 2001-01-27 Dekel Tsur * BufferView_pimpl.C (savePosition, restorePosition): Use a vector of diff --git a/src/buffer.C b/src/buffer.C index 7e9bb93a71..6c70ca69f1 100644 --- a/src/buffer.C +++ b/src/buffer.C @@ -2897,14 +2897,16 @@ void Buffer::makeDocBookFile(string const & fname, bool nice, bool only_body) << sgml_includedfiles << " \n]>\n\n"; } - if (params.options.empty()) - sgmlOpenTag(ofs, 0, top_element); - else { - string top = top_element; + string top = top_element; + top += " lang=\""; + top += params.language->code(); + top += "\""; + + if (!params.options.empty()) { top += " "; top += params.options; - sgmlOpenTag(ofs, 0, top); } + sgmlOpenTag(ofs, 0, top); ofs << "\n"; @@ -3007,8 +3009,7 @@ void Buffer::makeDocBookFile(string const & fname, bool nice, bool only_body) sgmlOpenTag(ofs, depth + command_depth, command_name); item_name = "title"; - if (command_name != "!-- --") - sgmlOpenTag(ofs, depth + 1 + command_depth, item_name); + sgmlOpenTag(ofs, depth + 1 + command_depth, item_name); break; case LATEX_ENVIRONMENT: @@ -3037,9 +3038,13 @@ void Buffer::makeDocBookFile(string const & fname, bool nice, bool only_body) } if (style.latextype == LATEX_ENVIRONMENT) { - if (!style.latexparam().empty()) - sgmlOpenTag(ofs, depth + command_depth, - style.latexparam()); + if (!style.latexparam().empty()) { + if(style.latexparam() == "CDATA") + ofs << ""; + else + sgmlCloseTag(ofs, depth + command_depth, + style.latexparam()); + } break; case LATEX_ITEM_ENVIRONMENT: if (desc_on == 1) break;