Extend endnotes support

Support native solution for Endnotes list rather than having to use
\\theendnotes via ERT

File format change
This commit is contained in:
Juergen Spitzmueller 2019-08-12 13:00:54 +02:00
parent cbfce678d8
commit 229052b29a
6 changed files with 63 additions and 8 deletions

View File

@ -7,6 +7,10 @@ changes happened in particular if possible. A good example would be
-----------------------
2019-08-12 Jürgen Spitzmüller <spitz@lyx.org>
* Format incremented to 588: Support \theendnotes of endnotes package via a faked
float list.
2019-08-07 Jürgen Spitzmüller <spitz@lyx.org>
* Format incremented to 587: Use more generic paper names as LyX names
(rather than LaTeXisms; e.g., "a4" rather than "a4paper").

View File

@ -1,8 +1,9 @@
#\DeclareLyXModule[endnotes.sty]{Endnotes}
#\DeclareCategory{Foot- and Endnotes}
#DescriptionBegin
#Adds an endnote inset, in addition to footnotes. You will need to add
#\theendnotes in TeX-code where you want the endnotes to appear.
#Adds an endnote inset, in addition to footnotes. You will need to add an
#endnotes list (Insert > List/Contents/References > Endnotes) where you
#want the endnotes to appear.
#DescriptionEnd
Format 79
@ -24,3 +25,13 @@ InsetLayout Flex:Endnote
LabelString endnote
Requires endnotes
End
# We are only interested in the list
Float
Type endnote
ListName "Endnotes"
IsPredefined true
UsesFloatPkg false
ListCommand theendnotes
Requires endnotes
End

View File

@ -1,8 +1,9 @@
#\DeclareLyXModule[endnotes.sty]{Footnotes as Endnotes}
#\DeclareCategory{Foot- and Endnotes}
#DescriptionBegin
#Sets all footnotes as endnotes. You will need to add \theendnotes
#in TeX-code where you want the endnotes to appear.
#Sets all footnotes as endnotes. You will need to add an
#endnotes list (Insert > List/Contents/References > Endnotes) where you
#want the endnotes to appear.
#DescriptionEnd
Format 79
@ -12,3 +13,13 @@ Requires endnotes
AddToPreamble
\let\footnote=\endnote
EndPreamble
# We are only interested in the list
Float
Type endnote
ListName "Endnotes"
IsPredefined true
UsesFloatPkg false
ListCommand theendnotes
Requires endnotes
End

View File

@ -3389,6 +3389,25 @@ def revert_pagesizenames(document):
if val in newnames:
newval = val + "paper"
document.header[i] = "\\papersize " + newval
def revert_theendnotes(document):
" Reverts native support of \\theendnotes to TeX-code "
if not "endnotes" in document.get_module_list() and not "foottoend" in document.get_module_list():
return
i = 0
while True:
i = find_token(document.body, "\\begin_inset FloatList endnote", i + 1)
if i == -1:
return
j = find_end_of_inset(document.body, i)
if j == -1:
document.warning("Malformed LyX document: Can't find end of FloatList inset")
continue
document.body[i : j + 1] = put_cmd_in_ert("\\theendnotes")
##
@ -3439,10 +3458,12 @@ convert = [
[584, []],
[585, [convert_pagesizes]],
[586, []],
[587, [convert_pagesizenames]]
[587, [convert_pagesizenames]],
[588, []]
]
revert = [[586, [revert_pagesizenames]],
revert = [[587, [revert_theendnotes]],
[586, [revert_pagesizenames]],
[585, [revert_dupqualicites]],
[584, [revert_pagesizes,revert_komafontsizes]],
[583, [revert_vcsinfo_rev_abbrev]],

View File

@ -3931,6 +3931,14 @@ void parse_text(Parser & p, ostream & os, unsigned flags, bool outer,
continue;
}
if (t.cs() == "theendnotes") {
context.check_layout(os);
begin_inset(os, "FloatList endnote\n");
end_inset(os);
skip_spaces_braces(p);
continue;
}
if ((where = is_known(t.cs(), known_text_font_families))) {
parse_text_attributes(p, os, FLAG_ITEM, outer,
context, "\\family", context.font.family,

View File

@ -32,8 +32,8 @@ extern char const * const lyx_version_info;
// Do not remove the comment below, so we get merge conflict in
// independent branches. Instead add your own.
#define LYX_FORMAT_LYX 587 // spitz: generic paper size names
#define LYX_FORMAT_TEX2LYX 587
#define LYX_FORMAT_LYX 588 // spitz: support \theendnotes
#define LYX_FORMAT_TEX2LYX 588
#if LYX_FORMAT_TEX2LYX != LYX_FORMAT_LYX
#ifndef _MSC_VER