From 4ea841fe24ec0f171577b3125425b74afdd0f28a Mon Sep 17 00:00:00 2001 From: Thibaut Cuvelier Date: Sun, 1 Nov 2020 03:58:25 +0100 Subject: [PATCH] DocBook: implement other letter classes (frletter, standard letter, KOMA-Script). I gave up on G-Brief, it's too far from the other classes. --- development/autotests/invertedTests | 6 ++ lib/layouts/frletter.layout | 5 ++ lib/layouts/scrlettr.layout | 59 +++++++++++++++++ lib/layouts/scrlttr2.layout | 99 +++++++++++++++++++++++++++++ lib/layouts/stdletter.inc | 34 +++++----- 5 files changed, 185 insertions(+), 18 deletions(-) diff --git a/development/autotests/invertedTests b/development/autotests/invertedTests index ca86bc4fb6..6e341e5752 100644 --- a/development/autotests/invertedTests +++ b/development/autotests/invertedTests @@ -445,6 +445,12 @@ export/templates/Scripts/Hollywood_docbook5 export/export/docbook/Hollywood_docbook5 # - Lettre, formatting in elements DocBook does not allow to be formatted (like email). export/templates/Letters/French_Letter_%28lettre%29_docbook5 +# - Letter, elements at the end of the document that should be in . +export/templates/Letters/Letter_%28Standard_Class%29_docbook5 +# - G-Brief: too far from the other classes. +export/templates/Letters/G-Brief_%28V._2%29_docbook5 +# - KOMA-Script Letter: too hard to output phone and fax numbers at the right place (need two levels of wrapping). +export/templates/Letters/KOMA-Script_Letter_%28V._2%29_docbook5 # - Branches may cause problems (especially when mixing with parts that must go in ). export/export/latex/languages/supported-languages_docbook5 diff --git a/lib/layouts/frletter.layout b/lib/layouts/frletter.layout index 1d46531e62..f0e2965d90 100644 --- a/lib/layouts/frletter.layout +++ b/lib/layouts/frletter.layout @@ -12,10 +12,12 @@ Input letter.layout # change placement within LyX Style My_Address Margin Static + DocBookInInfo always End Style Send_To_Address Margin Right_Address_Box + DocBookInInfo always End @@ -30,6 +32,9 @@ Style Date ParSep 1 Align Left LabelType No_Label + DocBookTag date + DocBookTagType paragraph + DocBookInInfo always End diff --git a/lib/layouts/scrlettr.layout b/lib/layouts/scrlettr.layout index f49ce029e3..602d7965dc 100644 --- a/lib/layouts/scrlettr.layout +++ b/lib/layouts/scrlettr.layout @@ -5,11 +5,13 @@ # Bernd Rellermeyer <100.41728@germanynet.de>, 1999/2/17. Format 85 + Style Standard Category MainText LatexName dummy ParSep 0.4 AlignPossible Block, Left, Right, Center + DocBookTag para End Input stdlists.inc @@ -57,6 +59,7 @@ Style Letter Size Small Color Blue EndFont + # TODO: not supported by DocBook, it's related to having several letters in one document. End @@ -67,6 +70,8 @@ Style Opening Preamble \newcommand{\lyxopening}[1]{\pagebreak\startbreaks\opening{#1}} EndPreamble + DocBookTag para + DocBookAttr role='opening' End @@ -79,6 +84,8 @@ Style Closing BottomSep 1.5 ParSep 1.5 Align Left + DocBookTag para + DocBookAttr role='closing' End @@ -89,6 +96,8 @@ Style PS BottomSep 0.4 ParSep 0.4 Align Left + DocBookTag para + DocBookAttr role='post-scriptum' End @@ -103,6 +112,8 @@ Style CC Align Left LabelType Static LabelString "cc:" + DocBookTag para + DocBookAttr role='carbon-copy' End @@ -110,6 +121,8 @@ Style Encl CopyStyle CC LatexName encl LabelString "encl:" + DocBookTag para + DocBookAttr role='enclosed' End @@ -131,6 +144,11 @@ Style Name Shape Italic Color Blue EndFont + DocBookTag personname + DocBookTagType paragraph + DocBookWrapperTag author + DocBookWrapperTagType inline + DocBookInInfo always End @@ -138,6 +156,8 @@ Style Signature CopyStyle Name LatexName signature LabelString "Signature:" + DocBookTag para + DocBookAttr role='signature' End @@ -145,6 +165,11 @@ Style Address CopyStyle Name LatexName address LabelString "Address:" + DocBookTag NONE + DocBookWrapperTag address + DocBookWrapperAttr role='send-to-address' + DocBookWrapperMergeWithPrevious true + DocBookInInfo always End @@ -152,6 +177,13 @@ Style Telephone CopyStyle Name LatexName telephone LabelString "Telephone:" + # TODO: to be valid DocBook, this should be in the address. + DocBookTag phone + DocBookTagType paragraph + DocBookWrapperTag author + DocBookWrapperTagType paragraph + DocBookWrapperMergeWithPrevious true + DocBookInInfo always End @@ -159,6 +191,12 @@ Style Place CopyStyle Name LatexName place LabelString "Place:" + DocBookTag country + DocBookTagType paragraph + DocBookWrapperTag address + DocBookWrapperTagType paragraph + DocBookWrapperMergeWithPrevious true + DocBookInInfo always End @@ -166,6 +204,10 @@ Style Date CopyStyle Name LatexName date LabelString "Date:" + DocBookTag date + DocBookTagType paragraph + DocBookWrapperTag NONE + DocBookInInfo always End @@ -173,6 +215,11 @@ Style Backaddress CopyStyle Name LatexName backaddress LabelString "Backaddress:" + DocBookTag NONE + DocBookWrapperTag address + DocBookWrapperTagType paragraph + DocBookWrapperMergeWithPrevious true + DocBookInInfo always End @@ -180,6 +227,7 @@ Style Specialmail CopyStyle Name LatexName specialmail LabelString "Specialmail:" + # TODO: not implemented for DocBook, what is the meaning of this? End @@ -187,6 +235,7 @@ Style Location CopyStyle Name LatexName location LabelString "Location:" + # TODO: not implemented for DocBook, what is the meaning of this? End @@ -195,6 +244,11 @@ Style Title LatexName title LabelString "Title:" HTMLTitle true + DocBookTag title + DocBookAttr role='title' # As opposed to subject. + DocBookTagType paragraph + DocBookWrapperTag NONE + DocBookInInfo maybe End @@ -202,6 +256,11 @@ Style Subject CopyStyle Name LatexName subject LabelString "Subject:" + DocBookTag title + DocBookAttr role='title' + DocBookTagType paragraph + DocBookWrapperTag NONE + DocBookInInfo maybe End diff --git a/lib/layouts/scrlttr2.layout b/lib/layouts/scrlttr2.layout index c84c1b4ef4..fac016c090 100644 --- a/lib/layouts/scrlttr2.layout +++ b/lib/layouts/scrlttr2.layout @@ -5,6 +5,14 @@ # Juergen Spitzmueller , 2003/2/17. # Uwe Stöhr , 2008/2/03. +# TODO: DocBook doesn't support several letters in the same file. +# DocBook design note: there are several ways to implement sender data, this class does it in +# another way that the other letters. Usually, there is a large
tag with author +# information in , but there is no possibility to include a URL in this case. +# Therefore, here, we use a in , having an
. allows a URL +# () and an address. However, phone and fax numbers should be put in
, they +# are not allowed directly in ... The generated DocBook will not be valid due to this! + Format 85 Provides subscript 1 @@ -14,6 +22,7 @@ Style Standard ParSep 0.4 AlignPossible Block, Left, Right, Center ParIndent MM + DocBookTag para End Input stdlists.inc @@ -69,10 +78,15 @@ Style Address Size Small Color Blue EndFont + DocBookTag NONE + DocBookWrapperTag address + DocBookWrapperMergeWithPrevious true + DocBookInInfo always End # Start new letter +# Not supported by DocBook. Style NextAddress LatexType Command LatexName end{letter}\begin{letter} @@ -112,6 +126,8 @@ Style Opening Shape Italic Color Magenta EndFont + DocBookTag para + DocBookAttr role='opening' End @@ -120,6 +136,8 @@ Style Closing LatexType Command LatexName closing LabelString "Closing:" + DocBookTag para + DocBookAttr role='closing' End @@ -128,6 +146,8 @@ Style PS LatexType Command LatexName ps LabelString "Post Scriptum:" + DocBookTag para + DocBookAttr role='post-scriptum' End @@ -136,6 +156,8 @@ Style CC LatexType Command LatexName cc LabelString "cc:" + DocBookTag para + DocBookAttr role='carbon-copy' End @@ -143,6 +165,8 @@ Style Encl CopyStyle Opening LatexName encl LabelString "encl:" + DocBookTag para + DocBookAttr role='enclosed' End @@ -166,6 +190,12 @@ Style Name Shape Italic Color Blue EndFont + DocBookTag personname + DocBookTagType paragraph + DocBookWrapperTag author + DocBookWrapperTagType paragraph + DocBookWrapperMergeWithPrevious true + DocBookInInfo always End @@ -174,6 +204,9 @@ Style Signature LatexName setkomavar LatexParam {signature} LabelString "Signature:" + DocBookTag para + DocBookWrapperTag abstract + DocBookWrapperAttr role='signature' End @@ -182,6 +215,12 @@ Style SenderAddress LatexName setkomavar LatexParam {fromaddress} LabelString "Sender Address:" + DocBookTag address + DocBookTagType paragraph + DocBookWrapperTag author + DocBookWrapperTagType paragraph + DocBookWrapperMergeWithPrevious true + DocBookInInfo always End @@ -190,6 +229,13 @@ Style Telephone LatexName setkomavar LatexParam {fromphone} LabelString "Sender Phone:" + # TODO: to be valid DocBook, this should be in the address. + DocBookTag phone + DocBookTagType paragraph + DocBookWrapperTag author + DocBookWrapperTagType paragraph + DocBookWrapperMergeWithPrevious true + DocBookInInfo always End @@ -198,6 +244,13 @@ Style Fax LatexName setkomavar LatexParam {fromfax} LabelString "Sender Fax:" + # TODO: to be valid DocBook, this should be in the address. + DocBookTag fax + DocBookTagType paragraph + DocBookWrapperTag author + DocBookWrapperTagType paragraph + DocBookWrapperMergeWithPrevious true + DocBookInInfo always End @@ -206,6 +259,12 @@ Style E-Mail LatexName setkomavar LatexParam {fromemail} LabelString "Sender E-Mail:" + DocBookTag email + DocBookTagType paragraph + DocBookWrapperTag author + DocBookWrapperTagType paragraph + DocBookWrapperMergeWithPrevious true + DocBookInInfo always End @@ -214,6 +273,12 @@ Style URL LatexName setkomavar LatexParam {fromurl} LabelString "Sender URL:" + DocBookTag uri + DocBookTagType paragraph + DocBookWrapperTag author + DocBookWrapperTagType paragraph + DocBookWrapperMergeWithPrevious true + DocBookInInfo always End @@ -222,6 +287,13 @@ Style Bank LatexName setkomavar LatexParam {frombank} LabelString "Bank:" + DocBookTag personblurb + DocBookAttr role='bank' + DocBookTagType paragraph + DocBookWrapperTag author + DocBookWrapperTagType paragraph + DocBookWrapperMergeWithPrevious true + DocBookInInfo always End @@ -238,6 +310,12 @@ Style Place LatexName setkomavar LatexParam {place} LabelString "Place:" + DocBookTag country + DocBookTagType paragraph + DocBookWrapperTag address + DocBookWrapperTagType paragraph + DocBookWrapperMergeWithPrevious true + DocBookInInfo always End @@ -246,6 +324,10 @@ Style Date LatexName setkomavar LatexParam {date} LabelString "Date:" + DocBookTag date + DocBookTagType paragraph + DocBookWrapperTag NONE + DocBookInInfo always End @@ -254,6 +336,11 @@ Style Backaddress LatexName setkomavar LatexParam {backaddress} LabelString "Backaddress:" + DocBookTag NONE + DocBookWrapperTag address + DocBookWrapperTagType paragraph + DocBookWrapperMergeWithPrevious true + DocBookInInfo always End @@ -262,6 +349,7 @@ Style Specialmail LatexName setkomavar LatexParam {specialmail} LabelString "Specialmail:" + # TODO: not implemented for DocBook, what is the meaning of this? End @@ -270,6 +358,7 @@ Style Location LatexName setkomavar LatexParam {location} LabelString "Location:" + # TODO: not implemented for DocBook, what is the meaning of this? End @@ -279,6 +368,11 @@ Style Title LatexParam {title} LabelString "Title:" HTMLTitle true + DocBookTag title + DocBookAttr role='title' # As opposed to subject. + DocBookTagType paragraph + DocBookWrapperTag NONE + DocBookInInfo maybe End @@ -287,6 +381,11 @@ Style Subject LatexName setkomavar LatexParam {subject} LabelString "Subject:" + DocBookTag title + DocBookAttr role='title' + DocBookTagType paragraph + DocBookWrapperTag NONE + DocBookInInfo maybe End diff --git a/lib/layouts/stdletter.inc b/lib/layouts/stdletter.inc index 23ddbf5b35..7db3e5d9da 100644 --- a/lib/layouts/stdletter.inc +++ b/lib/layouts/stdletter.inc @@ -73,8 +73,8 @@ Style Opening Shape Italic Color red EndFont - DocBookTag para - DocBookAttr role='opening' + DocBookTag para + DocBookAttr role='opening' End @@ -97,8 +97,8 @@ Style Signature Shape Italic Color red EndFont - DocBookTag para - DocBookAttr role='signature' + DocBookTag para + DocBookAttr role='signature' End @@ -106,8 +106,8 @@ Style Closing CopyStyle Signature LatexName closing LabelString "Closing:" - DocBookTag para - DocBookAttr role='opening' + DocBookTag para + DocBookAttr role='opening' End @@ -120,8 +120,8 @@ Style cc Shape Italic Color green EndFont - DocBookTag para - DocBookAttr role='carbon-copy' + DocBookTag para + DocBookAttr role='carbon-copy' End @@ -130,8 +130,8 @@ Style encl LatexName encl LabelString "encl:" Spacing Other 1.5 - DocBookTag para - DocBookAttr role='enclosed' + DocBookTag para + DocBookAttr role='enclosed' End @@ -139,12 +139,9 @@ Style Location CopyStyle cc LatexName thispagestyle{firstpage}\location LabelString "Location:" - DocBookTag otheraddr - DocBookTag otheraddr - DocBookAttr role='place' - DocBookAttr role='place' - DocBookTagType paragraph - DocBookTagType paragraph + DocBookTag otheraddr + DocBookAttr role='place' + DocBookTagType paragraph End @@ -152,6 +149,7 @@ Style Telephone CopyStyle cc LatexName thispagestyle{firstpage}\telephone LabelString "Telephone:" - DocBookTag phone - DocBookTagType paragraph + DocBookTag phone + DocBookAttr "" + DocBookTagType paragraph End -- 2.39.2