Commit Graph

141 Commits

Author SHA1 Message Date
Juergen Spitzmueller
cbfce678d8 Add Requires to float definition. 2019-08-12 12:18:28 +02:00
Juergen Spitzmueller
006f1cbe43 update layout formats 2019-08-07 17:10:58 +02:00
Juergen Spitzmueller
0b7305024a Use generic paper size names rather than LaTeXisms such as "letterpaper"
This allows to support classes that don't use the Xpaper wording.

Add support for KOMA font (keyval) syntax on top of that.

Also support class-specific font and paper sizes in tex2lyx.

File and layout format change.
2019-08-07 16:44:11 +02:00
Juergen Spitzmueller
50abaa0e57 Add FontSizeFormat textclass option
This allows to customize the way fontsizes are passed to the class (e.g.,
"fontsize=12", as used by KOMA, rather than "12pt").
2019-08-06 19:27:49 +02:00
Juergen Spitzmueller
c6f262a5b7 Add textclass options for paper size selection and default paper size
Fixes: #4506

Implementing this to the classes requires file format changes, as the
classes' page layout will likely differ from geometry's.
2019-08-06 17:34:16 +02:00
Juergen Spitzmueller
13b6632228 Add TextClass option BibInToc
Fixes #1889
2019-07-08 15:40:17 +02:00
Günter Milde
8556cb1c66 fix layout2layout with stdin/out for Py3.
sys.stdin and sys.stdout expect a Unicode string,
with bytes we must use sys.std(in|out).buffer.
2019-07-07 20:37:12 +02:00
Juergen Spitzmueller
c7efb677f8 New InsetLayout tag ParbreakIgnored
This effectively allow paragraph breaks in insets only for cosmetic
reasons (e.g., to align contents on different lines).

This is the last change necessary for an enhanced covington gloss support
(which uses the new covington gloss ui)
2019-06-02 18:16:30 +02:00
Juergen Spitzmueller
9e6d22ea9c Add InsertOnNewline argument tag
This adds a paragraph break before auto-inserting arguments in flex
insets.

Useful for specific arguments (particularly ling glosses)
2019-06-02 18:07:10 +02:00
Juergen Spitzmueller
9f04eeae03 Support FreeSpacing in InsetArgument 2019-06-02 16:33:06 +02:00
Juergen Spitzmueller
70b3d3adcc Add NewlineCmd InsetLayout and Argument option
This allows to specific an alternative macro for newlines

Fixes: #10407
2019-04-18 11:35:03 +02:00
Juergen Spitzmueller
ed44bbddee Add MenuString to InsetLayout
Fixes: #8818
2019-04-18 10:27:19 +02:00
Juergen Spitzmueller
4b3aacd13b Add TableStyle layout tag
Fixes: #8360
2019-03-26 17:42:56 +01:00
Juergen Spitzmueller
8b92a2a689 Add NeedMBoxProtect [inset]layout option
This accesses the inulemcmd output param which protects specific commands
(\cite, \ref) in an \mbox.

This is needed in ulem and soul commands, since their complex
detokenization makes such commands (who produce multiple words via local
assignment) fail.

So now it is possible to properly support ulem and soul via
[inset]layout

Fixes a case reported in #9404
2019-03-12 14:08:05 +01:00
Richard Kimberly Heck
e5fc7327e3 Extend fix for #7404 to allow any inset collapsible to be edited
externally.
2018-10-04 13:41:41 -04:00
Juergen Spitzmueller
b124adbd38 Introduce listpreamble argument type
This uses the InsetArgument interface to provide access to a document
part hitherto inaccessible by LyX: the part between \begin and the first
\item in a list (where lengths and counters can be redefined, for
instance).

Fixes: #11098

File format change, layout format change
2018-08-17 10:22:32 +02:00
Juergen Spitzmueller
bbf287a3c6 Allow for cite engine and format definitions/modifications in layouts
Now layout files and modules can extend the cite engines or completely
overwrite them, and modify the cite formats.

Any CiteEngine definition in a layout/module will completely overwrite
those by cite engine files.

AddToCiteEngine will extend them (add if they do not exist yet).

Any CiteFormat definition in a layout will be preferred to those in cite
engines. CiteFormat definitions that are not touched by the former are
still active, though (so, as opposed to CiteEngine, a CiteFormat does
not completely overwrite those by the engine files).

Layout format change.
2018-05-21 12:46:53 +02:00
Juergen Spitzmueller
e11bda2cea Layout format update after 2ba584957c 2018-04-14 10:28:22 +02:00
Juergen Spitzmueller
f3b89e4c72 Add IsAutoNestedBy
This is complementary to AutoNests: Styles can determine which other
style should auto-nest them. This is particularly useful for modules
that add new styles which should be auto-nested in a given context.
2017-12-29 10:36:03 +01:00
Juergen Spitzmueller
d6fb2abbea Some AutoNest polishment.
* Rename Nests to AutoNests
* Do it when changing from any style
2017-12-29 10:03:00 +01:00
Juergen Spitzmueller
99ecc6e2c9 Implement auto-nesting.
Now layouts can specify other layouts that should be nested in and
after the current one (if the layout is switched from the current one
and if it follows a paragraph in the current one).

This is particularly useful for things such as the beamer frames, where
particular layouts are practically always nested.
2017-12-28 17:44:54 +01:00
Juergen Spitzmueller
c466baaa5b Collapsable -> Collapsible (part 2)
The current spelling is not strictly wrong, but flagged as unusual or
historical by some authorities. It is also found fault with many
spell checkers. Thus we decided to move to the more standard "-ible"
form once and for all.

See #10678 for discussion

This part covers the most tricky part: the internal naming.
Translations and layouts will follow.

This will all also all be backported to 2.3.x, for the sake of backwards
compatibility (cherry-picking).
2017-10-16 10:12:21 +02:00
Juergen Spitzmueller
8fecdfc473 Fix literal string in binary context
In 1a26f9b26c, all strings in the context of regexes and
comparisons have been converted to byte-like objects for python2/3
compatibility reasons. This has not been considered in the later
commit 5c54557350, which makes layout2layout break with
TypeError: can't concat str to bytes.
2017-10-13 10:04:27 +02:00
Jean-Marc Lasgouttes
5c54557350 Honor trailing spaces in LabelString and friends
Remove the trimming operation on LabelString, LabelStringAppendix,
EndLabelString and LabelCounter. This trimming meant that quotes
strings were not preserved, which is wrong.

To preserve layouts, the Layout format has been updated to 64, so that
layout2layout can remove extra spaces on existing strings, which
ensures that behavior is unchanged for old layouts (courtesy of rgheck).

It is now possible to re-add spaces in label strings where it makes
sense.

Fixes bug #10723.
2017-08-31 13:59:37 +02:00
José Matos
cc7ca138da Fix call of layout2layout as a module.
If we call parser.parse_args(), thus with no arguments, the parser uses
sys.argv (because that is the default). We should pass argv since that was
the purpose of handling argv in the main function.

We pass argv[1:] since when parsing the arguments we always ignore the name
of the program.

Use the full power of argparse to declare the default value of the end_format.
2017-05-13 15:25:44 +01:00
José Matos
99cf71f8eb Fix call os lyx2lyx as a module.
If we call parser.parse_args(), thus with no arguments, the parser uses
sys.argv (because that is the default). We should pass argv since that was
the purpose of handling argv in the main function.
2017-05-13 13:39:02 +01:00
José Matos
6138880c08 cleanup: remove unneeded whitespaces 2017-05-13 13:38:01 +01:00
Enrico Forestieri
1a26f9b26c layout2layout.py: Python 3 compatibility
The layout2layout.py script already reads and writes files in
binary format. However, all regexes and comparisons assume strings,
so that python3 chokes on them. This commit converts all involved
strings into bytes-like objects. In this way both python 2 and 3
behave the same.
2017-04-13 16:25:59 +02:00
Juergen Spitzmueller
979294d5ec New tag MaxCiteNames
This determines the number of authors before "et al.". We had it
hardcoded to 2, but actually the nuumber differs.
2017-01-07 16:44:27 +01:00
Juergen Spitzmueller
fb9a866a66 Implement PassThru option to arguments. 2016-10-21 10:39:55 +02:00
Juergen Spitzmueller
0eb651a2cf New layout tags for better counter handling
* ResumeCounter: allow to resume an (enumerate) counter
* StepMasterCounter: allow to increase a master counter
2016-10-14 20:08:12 +02:00
Guillaume Munch
77511ea1d5 Add an option to layout2layout to convert to a particular format 2016-07-31 18:34:33 +01:00
Jean-Marc Lasgouttes
fd1ee3b424 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.
2016-03-30 16:07:00 +02:00
Guillaume Munch
3c9b62a69d Layout format update: AddToToc, IsTocCaption, OutlinerName
Preliminary work for addressing #7790. Thanks to Richard for providing initial
files this is based on.

Adding to TextClass:
    OutlinerName <string> <string>
    (the second string is translated)
e.g.:
    OutlinerName thm "Definitions & Theorems"

Adding to Layout:
    AddToToc <string>     (default "", means no)
    IsTocCaption <bool>   (default 0)
e.g.:
    AddToToc thm
    IsTocCaption 1

Adding to InsetLayout:
    AddToToc <string>     (default "", means no)
    IsTocCaption <bool>   (default 0)
e.g.:
    AddToToc literate

Adding to inset arguments:
    IsTocCaption <bool>   (default 0)
2015-12-13 19:56:49 +00:00
Richard Heck
4d94460ce3 Add new ProvideStyle tag, which adds a new style only if it does not already
exist. This will allow for a proper fix for bug #8796, though that may or may
not get fixed before 2.2.0.

Also, change the InStyle tag to ModifyStyle, per a suggestion of Jurgen's.
2015-12-05 18:11:46 -05:00
Juergen Spitzmueller
eb748d6330 Make layout membership to ParagraphGroup settable (see #6854) 2015-06-01 16:11:05 +02:00
Juergen Spitzmueller
47dd9189eb Add more Float tags to allow to disable wide and sideways feature
Fixes: #9557, #9558

This is amended to yesterday's layout format change.
2015-05-22 18:59:17 +02:00
Juergen Spitzmueller
7dc123b790 Add Float tag to determine allowed positioning options (#7752) 2015-05-22 10:37:14 +02:00
Juergen Spitzmueller
897b2e73a1 New (Inset)Layout tag PassThruChars 2015-04-20 18:13:49 +02:00
Georg Baum
eb121f9993 Replace hardcoded hack with InsetLayout tag 2015-01-11 20:01:19 +01:00
Juergen Spitzmueller
cfeddb9293 Add ObsoletedBy tag to InsetLayout
Fixes: #9000.
2014-12-08 09:08:45 +01:00
Juergen Spitzmueller
a25569ebb3 Add a layout tag ForceOwnlines that assures an inset is started and terminated by a line break in the LaTeX output.
Fixes: #8875.
2014-12-01 14:56:47 +01:00
Georg Baum
f110ef2f41 Convert updatelayouts.sh to python
This makes the script usable on windows and speeds it up by an order of
magnitude, since no new process needs to be forked for each layout file.
It also does not conevrt .old files again.
2014-11-16 12:43:52 +01:00
Georg Baum
953a4d13d9 Add missing bits of layout file format update
This is needed so that the new format number is actually used. Since the
conversion is a noop I did not update the layout files (more updates will
come).
2014-05-29 21:25:08 +02:00
Juergen Spitzmueller
20bcaec061 Add layout tag that determines if/when a paragraph can be indented.
Fixes: #7327, #7458, #8670
2014-05-29 14:10:32 +02:00
Enrico Forestieri
c668ebf611 Fix bugs #8546 and #9055, and introduce new separator inset.
The algorithm used for breaking a paragraph in LaTeX export is changed
for avoiding spurious blank lines causing too much vertical space.
This change is tied to the introduction of a new inset (with two
different specializations) helping in either outputing LaTeX paragraph
breaks or separating environments in LyX. Both of the above goals were
previously achieved by the ---Separator--- layout and can now be
accomplished by the new inset in a more natural way. As an example,
after leaving an environment by hitting the Return key for two times,
a third return automatically inserts a parbreak inset, which is
equivalent to the old separator layout, i.e., it also introduces a
blank line in the output. If this blank line is not wanted, the
parbreak separator can be changed to a plain separator by a right
click of the mouse. Of course, an environment can still be separated
by the following one by using the Alt+P+Return shortcut (or the
corresponding menu key), but now the plain separator inset is used
instead of the old separator layout, such that no blank line occurs in
the LaTeX output.

Old documents are converted such that the LaTeX output remains unchanged.
As a result of this conversion, the old separator layout is replaced by
the new parbreak inset, which may also appear in places where the old
algorithm was introducing blank lines while the new one is not.
Note that not all blank lines were actually affecting the LaTeX output,
because a blank line is simply ignored by the TeX engine when it occurs
in the so called "vertical mode" (e.g., after an alignment environment).
The old ---Separator--- layout is now gone and old layout files using it
are also automatically converted.

Round trip conversions between old and new format should leave a document
unchanged. This means that the new behavior about paragraph breaking is
not "carried back" to the old format. Indeed, this would need introducing
special LaTeX commands in ERT that would accumulate in roundtrip
conversions, horribly cluttering the document. So, when converting a
modified document to old formats, the LaTeX output may slightly differ in
vertical spacing if the document is processed by an old version of LyX.
In other words, forward compatibility is guaranteed, but not backwards.
2014-05-10 23:25:11 +02:00
Richard Heck
7e1541dd49 Fix failure to detect quoted flex insets in conversion to layout
48. Also, simplify this code.
2014-04-25 17:18:29 -04:00
Georg Baum
6b49b6b129 Fix conflicting inset font defaults (bug #8874)
This makes the defaults of Inset::inheritFont() and Inset::resetFontEdit()
compatible. There is no user visible change except for the Chunk inset which
does not produce invalid LaTeX after editing operations anymore.
This is the safe version for 2.1.0, for later there are still open questions:
- All insets with ResetsFont true should be audited: Is this really needed,
  or do they show similar editing problems as the Chunk inset?
- Does inheritFont() need to be customizable in the layout file as well?
- Is resetFontEdit() != !inheritFont() needed at all?
I did not use change tracking for the docs, since I updated all existing
translations.
2014-02-10 22:06:32 +01:00
Richard Heck
f9de88c53c Remove the shebang line from our python scripts, per Jose's suggestion.
Fedora ships these chmod 644 and has never seen a problem. The advantage
to doing this is that it better controls what version of python we are
using to launch the script, and it will reveal if we're somehow somewhere
not controlling that properly.
2014-01-28 12:52:16 -05:00
Richard Heck
2374229cc6 Introduce InitialValue tag for counters. Fixes bug #8707. 2013-06-01 17:42:08 -04:00