]> git.lyx.org Git - features.git/commitdiff
Parse post command argument insets (bug #8473)
authorGeorg Baum <baum@lyx.org>
Sat, 3 Jan 2015 17:14:20 +0000 (18:14 +0100)
committerGeorg Baum <baum@lyx.org>
Sat, 3 Jan 2015 17:14:20 +0000 (18:14 +0100)
This is now very easy with the new InsetArgument infrastructure.

src/tex2lyx/Makefile.am
src/tex2lyx/test/CMakeLists.txt
src/tex2lyx/test/runtests.py
src/tex2lyx/test/test-memoir.lyx.lyx [new file with mode: 0644]
src/tex2lyx/test/test-memoir.tex [new file with mode: 0644]
src/tex2lyx/text.cpp
status.21x

index 0aa887ebf4da8bb643c00ffa83dfd07afc39c024..07247a6695429308858192cb3cf6d0a10aecb0e0 100644 (file)
@@ -30,6 +30,7 @@ TEST_FILES = \
        test/foo.png \
        test/test-insets.tex \
        test/test.ltx \
+       test/test-memoir.tex \
        test/test-modules.tex \
        test/test-refstyle-theorems.tex \
        test/test-structure.tex \
@@ -47,6 +48,7 @@ TEST_RESULTS = \
        test/Dummy~Document.lyx.lyx \
        test/test-insets.lyx.lyx \
        test/test.lyx.lyx \
+       test/test-memoir.lyx.lyx \
        test/test-modules.lyx.lyx \
        test/test-refstyle-theorems.lyx.lyx \
        test/test-structure.lyx.lyx \
index ea79c2c6f315fce96ccf125d740e45a531fc2634..e41639a140b506a6add643d9fc0ec72dfcb51ac7 100644 (file)
@@ -15,6 +15,7 @@ set(_tex_tests test.ltx
                CJK.tex
                CJKutf8.tex
                test-insets.tex
+               test-memoir.tex
                test-modules.tex
                test-refstyle-theorems.tex
                test-structure.tex
index 71f615e8beba9294cbac15f1b1adb4c0e99f146a..499410644b2687646291de15f2f907de8a9f7d3f 100755 (executable)
@@ -75,6 +75,7 @@ def main(argv):
                  'CJK.tex', \
                  'CJKutf8.tex', \
                  'test-insets.tex', \
+                 'test-memoir.tex', \
                  'test-modules.tex', \
                  'test-refstyle-theorems.tex', \
                  'test-structure.tex', \
diff --git a/src/tex2lyx/test/test-memoir.lyx.lyx b/src/tex2lyx/test/test-memoir.lyx.lyx
new file mode 100644 (file)
index 0000000..7dc5af7
--- /dev/null
@@ -0,0 +1,95 @@
+#LyX file created by tex2lyx 2.1
+\lyxformat 474
+\begin_document
+\begin_header
+\textclass memoir
+\begin_preamble
+
+
+\usepackage{babel}
+
+\end_preamble
+\options oldfontcommands
+\use_default_options false
+\maintain_unincluded_children false
+\language english
+\language_package default
+\inputencoding iso8859-15
+\fontencoding T1
+\font_roman default
+\font_sans default
+\font_typewriter default
+\font_math auto
+\font_default_family default
+\use_non_tex_fonts false
+\font_sc false
+\font_osf false
+\font_sf_scale 100
+\font_tt_scale 100
+\graphics default
+\default_output_format default
+\output_sync 0
+\bibtex_command default
+\index_command default
+\paperfontsize default
+\spacing single
+\use_hyperref false
+\papersize default
+\use_geometry false
+\use_package amsmath 1
+\use_package amssymb 0
+\use_package cancel 0
+\use_package esint 1
+\use_package mathdots 0
+\use_package mathtools 0
+\use_package mhchem 0
+\use_package stackrel 0
+\use_package stmaryrd 0
+\use_package undertilde 0
+\cite_engine basic
+\cite_engine_type default
+\biblio_style plain
+\use_bibtopic false
+\use_indices false
+\paperorientation portrait
+\suppress_date false
+\justification true
+\use_refstyle 0
+\index Index
+\shortcut idx
+\color #008000
+\end_index
+\secnumdepth 3
+\tocdepth 3
+\paragraph_separation indent
+\paragraph_indentation default
+\quotes_language english
+\papercolumns 1
+\papersides 1
+\paperpagestyle default
+\tracking_changes false
+\output_changes false
+\html_math_output 0
+\html_css_as_file 0
+\html_be_strict false
+\end_header
+
+\begin_body
+
+\begin_layout Epigraph
+epigraph
+\begin_inset Argument post:1
+status collapsed
+
+
+\begin_layout Standard
+source
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\end_body
+\end_document
diff --git a/src/tex2lyx/test/test-memoir.tex b/src/tex2lyx/test/test-memoir.tex
new file mode 100644 (file)
index 0000000..3d402b9
--- /dev/null
@@ -0,0 +1,10 @@
+\documentclass[oneside,english,oldfontcommands]{memoir}
+\usepackage[T1]{fontenc}
+\usepackage[latin9]{inputenc}
+
+\usepackage{babel}
+\begin{document}
+
+\epigraph{epigraph}{source}
+
+\end{document}
index 35b116ef1b09fc4f780da09077c750bffa928ddb..87af33c36a5c1f4ff339f5789204a3c3e27ce817 100644 (file)
@@ -47,7 +47,7 @@ namespace lyx {
 
 namespace {
 
-void output_arguments(ostream &, Parser &, bool, bool, Context &,
+void output_arguments(ostream &, Parser &, bool, bool, bool, Context &,
                       Layout::LaTeXArgMap const &);
 
 }
@@ -64,8 +64,12 @@ void parse_text_in_inset(Parser & p, ostream & os, unsigned flags, bool outer,
        else
                newcontext.font = context.font;
        if (layout)
-               output_arguments(os, p, outer, false, newcontext, layout->latexargs());
+               output_arguments(os, p, outer, false, false, newcontext,
+                                layout->latexargs());
        parse_text(p, os, flags, outer, newcontext);
+       if (layout)
+               output_arguments(os, p, outer, false, true, newcontext,
+                                layout->postcommandargs());
        newcontext.check_end_layout(os);
 }
 
@@ -623,7 +627,7 @@ void skip_spaces_braces(Parser & p, bool keepws = false)
 }
 
 
-void output_arguments(ostream & os, Parser & p, bool outer, bool need_layout,
+void output_arguments(ostream & os, Parser & p, bool outer, bool need_layout, bool post,
                       Context & context, Layout::LaTeXArgMap const & latexargs)
 {
        if (need_layout) {
@@ -646,6 +650,8 @@ void output_arguments(ostream & os, Parser & p, bool outer, bool need_layout,
                                need_layout = false;
                        }
                        begin_inset(os, "Argument ");
+                       if (post)
+                               os << "post:";
                        os << i << "\nstatus collapsed\n\n";
                        parse_text_in_inset(p, os, FLAG_BRACE_LAST, outer, context);
                        end_inset(os);
@@ -659,6 +665,8 @@ void output_arguments(ostream & os, Parser & p, bool outer, bool need_layout,
                                need_layout = false;
                        }
                        begin_inset(os, "Argument ");
+                       if (post)
+                               os << "post:";
                        os << i << "\nstatus collapsed\n\n";
                        parse_text_in_inset(p, os, FLAG_BRACK_LAST, outer, context);
                        end_inset(os);
@@ -691,8 +699,11 @@ void output_command_layout(ostream & os, Parser & p, bool outer,
                context.need_end_deeper = true;
        }
        context.check_deeper(os);
-       output_arguments(os, p, outer, true, context, context.layout->latexargs());
+       output_arguments(os, p, outer, true, false, context,
+                        context.layout->latexargs());
        parse_text(p, os, FLAG_ITEM, outer, context);
+       output_arguments(os, p, outer, false, true, context,
+                        context.layout->postcommandargs());
        context.check_end_layout(os);
        if (parent_context.deeper_paragraph) {
                // We must suppress the "end deeper" because we
@@ -1682,10 +1693,13 @@ void parse_environment(Parser & p, ostream & os, bool outer,
                // Unfortunately LyX can't handle arguments of list arguments (bug 7468):
                // It is impossible to place anything after the environment name,
                // but before the first \\item.
-               if (context.layout->latextype == LATEX_ENVIRONMENT) {
-                       output_arguments(os, p, outer, false, context, context.layout->latexargs());
-               }
+               if (context.layout->latextype == LATEX_ENVIRONMENT)
+                       output_arguments(os, p, outer, false, false, context,
+                                        context.layout->latexargs());
                parse_text(p, os, FLAG_END, outer, context);
+               if (context.layout->latextype == LATEX_ENVIRONMENT)
+                       output_arguments(os, p, outer, false, true, context,
+                                        context.layout->postcommandargs());
                context.check_end_layout(os);
                if (parent_context.deeper_paragraph) {
                        // We must suppress the "end deeper" because we
index fc2fc48664a2abaf65821cffdc9cd4cae6b1f674..37416ebbfafdbb6475192ae9adc7af4861103d47 100644 (file)
@@ -188,6 +188,8 @@ What's new
 
 - Fix misparsing of \textgreek without polyglossia (bug 8553).
 
+- Parse post command argument insets (bug 8473).
+
 
 
 * ADVANCED FIND AND REPLACE