Rename Caption:LongTableNoNumber to Caption:Unnumbered

The term LongTable has been deprecated and moreover the renaming makes the interface easier to the eye.

File format updated to 507. (conversion based on jamatos patch)
Layout format updated to 60.
tex2ylx tests updated.
Document EmbeddedObjects.lyx has been updated.
This commit is contained in:
Jean-Marc Lasgouttes 2016-03-25 19:22:57 +01:00
parent e5e21da467
commit fd1ee3b424
28 changed files with 88 additions and 34 deletions

View File

@ -11,6 +11,10 @@ adjustments are made to tex2lyx and bugs are fixed in lyx2lyx.
-----------------------
2016-03-25 Jean-Marc Lasgouttes <lasgouttes@lyx.org>
* Format incremented to 507
Convert caption subtype LongTableNoNumber to Unnumbered
2016-01-26 Guillaume Munch <gm@lyx.org>
* Format incremented to 506
No new parameters.

View File

@ -1,5 +1,5 @@
#LyX 2.2 created this file. For more info see http://www.lyx.org/
\lyxformat 506
\lyxformat 507
\begin_document
\begin_header
\save_transient_properties true
@ -7689,7 +7689,7 @@ Caption
\begin_inset space ~
\end_inset
(LongTableNoNumber)
(Unnumbered)
\family default
.
Table
@ -7842,7 +7842,7 @@ TEL.
\begin_inset Text
\begin_layout Plain Layout
\begin_inset Caption LongTableNoNumber
\begin_inset Caption Unnumbered
\begin_layout Plain Layout
Continued Example Phone List
@ -10017,7 +10017,7 @@ TEL.
\begin_inset Text
\begin_layout Plain Layout
\begin_inset Caption LongTableNoNumber
\begin_inset Caption Unnumbered
\begin_layout Plain Layout
Continued Example Phone List

View File

@ -16,3 +16,6 @@ second step:
entries)of longtable accordingly
occurrences: sec. 2.2, 2.6, 2.7, 4.2
- sec. 7.1: new template "vector graphics"
second step (cont'd by lasgouttes)
- sec. 2.6.3.3: caption type LongTableNoNumber has been renamed to Unumbered.

View File

@ -86,7 +86,7 @@ format_relation = [("0_06", [200], minor_versions("0.6" , 4)),
("1_6", list(range(277,346)), minor_versions("1.6" , 10)),
("2_0", list(range(346,414)), minor_versions("2.0" , 8)),
("2_1", list(range(414,475)), minor_versions("2.1" , 0)),
("2_2", list(range(475,507)), minor_versions("2.2" , 0))
("2_2", list(range(475,508)), minor_versions("2.2" , 0))
]
####################################################################

View File

@ -104,6 +104,36 @@ def revert_Argument_to_TeX_brace(document, line, endline, n, nmax, environment,
###
###############################################################################
def convert_longtable_label_internal(document, forward):
"""
Convert reference to "LongTableNoNumber" into "Unnumbered" if forward is True
else revert it.
"""
old_reference = "\\begin_inset Caption LongTableNoNumber"
new_reference = "\\begin_inset Caption Unnumbered"
# if the purpose is to revert swap the strings roles
if not forward:
old_reference, new_reference = new_reference, old_reference
i = 0
while True:
i = find_token(document.body, old_reference, i)
if i == -1:
return
document.body[i] = new_reference
def convert_longtable_label(document):
convert_longtable_label_internal(document, True)
def revert_longtable_label(document):
convert_longtable_label_internal(document, False)
def convert_separator(document):
"""
Convert layout separators to separator insets and add (LaTeX) paragraph
@ -2253,10 +2283,12 @@ convert = [
[503, []],
[504, [convert_save_props]],
[505, []],
[506, [convert_info_tabular_feature]]
[506, [convert_info_tabular_feature]],
[507, [convert_longtable_label]]
]
revert = [
[506, [revert_longtable_label]],
[505, [revert_info_tabular_feature]],
[504, []],
[503, [revert_save_props]],

View File

@ -198,6 +198,9 @@ import os, re, string, sys
# New Layout tags "AddToToc", "IsTocCaption"
# New Layout argument tag "IsTocCaption"
# Incremented to format 60, 25 March 2016 by lasgouttes
# Rename caption subtype LongTableNoNumber to Unnumbered
# Do not forget to document format change in Customization
# Manual (section "Declaring a new text class").
@ -205,7 +208,7 @@ import os, re, string, sys
# development/tools/updatelayouts.py script to update all
# layout files to the new format.
currentFormat = 59
currentFormat = 60
def usage(prog_name):
@ -319,6 +322,7 @@ def convert(lines):
re_TopEnvironment = re.compile(r'^(\s*)LabelType(\s+)Top_Environment\s*$', re.IGNORECASE)
re_CenteredEnvironment = re.compile(r'^(\s*)LabelType(\s+)Centered_Top_Environment\s*$', re.IGNORECASE)
re_ChapterStyle = re.compile(r'^\s*Style\s+Chapter\s*$', re.IGNORECASE)
re_InsetLayout_CaptionLTNN = re.compile(r'^(\s*InsetLayout\s+)(Caption:LongTableNonumber)', re.IGNORECASE)
# counters for sectioning styles (hardcoded in 1.3)
@ -430,6 +434,17 @@ def convert(lines):
i += 1
continue
if format == 59:
match = re_InsetLayout_CaptionLTNN.match(lines[i])
if not match:
i += 1
continue
# '^(\s*InsetLayout\s+)(Caption:LongTableNonumber)'
lead = match.group(1)
lines[i] = lead + "Caption:Unnumbered"
i += 1
continue
if format == 58:
# nothing to do.
i += 1

View File

@ -2718,7 +2718,7 @@ bool Text::getStatus(Cursor & cur, FuncRequest const & cmd,
case LFUN_CAPTION_INSERT: {
code = CAPTION_CODE;
string arg = cmd.getArg(0);
bool varia = arg != "LongTableNoNumber"
bool varia = arg != "Unnumbered"
&& cur.inset().allowsCaptionVariation(arg);
// not allowed in description items,
// and in specific insets

View File

@ -61,7 +61,7 @@ namespace lyx {
// You should also run the development/tools/updatelayouts.py script,
// to update the format of all of our layout files.
//
int const LAYOUT_FORMAT = 59; //gm: OutlinerName, AddToToc, IsTocCaption
int const LAYOUT_FORMAT = 60; //lasgouttes LongTableNoNumber => Unnumbered
namespace {

View File

@ -224,7 +224,7 @@ bool InsetCaption::getStatus(Cursor & cur, FuncRequest const & cmd,
if (first_arg == "changetype") {
string const type = cmd.getArg(1);
status.setOnOff(type == type_);
bool varia = type != "LongTableNoNumber";
bool varia = type != "Unnumbered";
// check if the immediate parent inset allows caption variation
if (cur.depth() > 1) {
varia = cur[cur.depth() - 2].inset().allowsCaptionVariation(type);

View File

@ -487,7 +487,7 @@ void InsetFloat::setNewLabel()
bool InsetFloat::allowsCaptionVariation(std::string const & newtype) const
{
return !params_.subfloat && newtype != "LongTableNoNumber";
return !params_.subfloat && newtype != "Unnumbered";
}

View File

@ -3521,7 +3521,7 @@ bool InsetTabular::insetAllowed(InsetCode code) const
bool InsetTabular::allowsCaptionVariation(std::string const & newtype) const
{
return tabular.is_long_tabular &&
(newtype == "Standard" || newtype == "LongTableNoNumber");
(newtype == "Standard" || newtype == "Unnumbered");
}

View File

@ -1,5 +1,5 @@
#LyX file created by tex2lyx 2.2
\lyxformat 506
\lyxformat 507
\begin_document
\begin_header
\save_transient_properties true

View File

@ -1,5 +1,5 @@
#LyX file created by tex2lyx 2.2
\lyxformat 506
\lyxformat 507
\begin_document
\begin_header
\save_transient_properties true

View File

@ -1,5 +1,5 @@
#LyX file created by tex2lyx 2.2
\lyxformat 506
\lyxformat 507
\begin_document
\begin_header
\save_transient_properties true

View File

@ -1,5 +1,5 @@
#LyX file created by tex2lyx 2.2
\lyxformat 506
\lyxformat 507
\begin_document
\begin_header
\save_transient_properties true

View File

@ -1,5 +1,5 @@
#LyX file created by tex2lyx 2.2
\lyxformat 506
\lyxformat 507
\begin_document
\begin_header
\save_transient_properties true

View File

@ -1,5 +1,5 @@
#LyX file created by tex2lyx 2.2
\lyxformat 506
\lyxformat 507
\begin_document
\begin_header
\save_transient_properties true

View File

@ -1,5 +1,5 @@
#LyX file created by tex2lyx 2.2
\lyxformat 506
\lyxformat 507
\begin_document
\begin_header
\save_transient_properties true

View File

@ -1,5 +1,5 @@
#LyX file created by tex2lyx 2.2
\lyxformat 506
\lyxformat 507
\begin_document
\begin_header
\save_transient_properties true
@ -1539,7 +1539,7 @@ Second
\begin_layout Standard
\begin_inset Caption LongTableNoNumber
\begin_inset Caption Unnumbered
\begin_layout Plain Layout
standard foot
@ -1584,7 +1584,7 @@ bottom.
\begin_layout Standard
\begin_inset Caption LongTableNoNumber
\begin_inset Caption Unnumbered
\begin_layout Plain Layout
(last foot)

View File

@ -1,5 +1,5 @@
#LyX file created by tex2lyx 2.2
\lyxformat 506
\lyxformat 507
\begin_document
\begin_header
\save_transient_properties true
@ -1596,7 +1596,7 @@ Second
\begin_layout Standard
\begin_inset Caption LongTableNoNumber
\begin_inset Caption Unnumbered
\begin_layout Plain Layout
standard foot
@ -1641,7 +1641,7 @@ bottom.
\begin_layout Standard
\begin_inset Caption LongTableNoNumber
\begin_inset Caption Unnumbered
\begin_layout Plain Layout
(last foot)

View File

@ -1,5 +1,5 @@
#LyX file created by tex2lyx 2.2
\lyxformat 506
\lyxformat 507
\begin_document
\begin_header
\save_transient_properties true

View File

@ -1,5 +1,5 @@
#LyX file created by tex2lyx 2.2
\lyxformat 506
\lyxformat 507
\begin_document
\begin_header
\save_transient_properties true

View File

@ -1,5 +1,5 @@
#LyX file created by tex2lyx 2.2
\lyxformat 506
\lyxformat 507
\begin_document
\begin_header
\save_transient_properties true

View File

@ -1,5 +1,5 @@
#LyX file created by tex2lyx 2.2
\lyxformat 506
\lyxformat 507
\begin_document
\begin_header
\save_transient_properties true

View File

@ -1,5 +1,5 @@
#LyX file created by tex2lyx 2.2
\lyxformat 506
\lyxformat 507
\begin_document
\begin_header
\save_transient_properties true

View File

@ -1,5 +1,5 @@
#LyX file created by tex2lyx 2.2
\lyxformat 506
\lyxformat 507
\begin_document
\begin_header
\save_transient_properties true

View File

@ -1,5 +1,5 @@
#LyX file created by tex2lyx 2.2
\lyxformat 506
\lyxformat 507
\begin_document
\begin_header
\save_transient_properties true

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 506 // guillaume munch: convert "inset-modify tabular"
#define LYX_FORMAT_TEX2LYX 506
#define LYX_FORMAT_LYX 507 // lasgouttes: rename LongTableNoNumber to Unnumbered
#define LYX_FORMAT_TEX2LYX 507
#if LYX_FORMAT_TEX2LYX != LYX_FORMAT_LYX
#ifndef _MSC_VER