Author: uwestoehr
Date: Fri Oct 28 20:00:56 2011
New Revision: 40054
URL: http://www.lyx.org/trac/changeset/40054

Log:
backporting tex2lyx: the support for \date{} in the preamble

Modified:
   lyx-devel/branches/BRANCH_2_0_X/src/tex2lyx/TODO.txt
   lyx-devel/branches/BRANCH_2_0_X/src/tex2lyx/preamble.cpp
   lyx-devel/branches/BRANCH_2_0_X/status.20x

Modified: lyx-devel/branches/BRANCH_2_0_X/src/tex2lyx/TODO.txt
==============================================================================
--- lyx-devel/branches/BRANCH_2_0_X/src/tex2lyx/TODO.txt        Fri Oct 28 
16:58:27 2011        (r40053)
+++ lyx-devel/branches/BRANCH_2_0_X/src/tex2lyx/TODO.txt        Fri Oct 28 
20:00:56 2011        (r40054)
@@ -55,6 +55,7 @@
 368    glue lengths                         InsetHSpace
 369    author id                            \author
 370    \date{}                              \suppress_date
+                                            (partly supported, see bug #7844)
 371    automatic mhchem loading             \use_mhchem
 375    \includeonly                         \{begin,end}_includeonly
 376    update .aux of unincluded children   \maintain_unincluded_children

Modified: lyx-devel/branches/BRANCH_2_0_X/src/tex2lyx/preamble.cpp
==============================================================================
--- lyx-devel/branches/BRANCH_2_0_X/src/tex2lyx/preamble.cpp    Fri Oct 28 
16:58:27 2011        (r40053)
+++ lyx-devel/branches/BRANCH_2_0_X/src/tex2lyx/preamble.cpp    Fri Oct 28 
20:00:56 2011        (r40054)
@@ -914,6 +914,14 @@
                else if (t.cs() == "pagestyle")
                        h_paperpagestyle = p.verbatim_item();
 
+               else if (t.cs() == "date") {
+                       string argument = p.getArg('{', '}');
+                       if (argument.empty())
+                               h_suppress_date = "true";
+                       else
+                               h_preamble << t.asInput() << '{' << argument << 
'}';
+               }
+
                else if (t.cs() == "color") {
                        string argument = p.getArg('{', '}');
                        // check the case that a standard color is used
@@ -1254,7 +1262,10 @@
                        string const arg1 = p.verbatim_item();
                        string const arg2 = p.verbatim_item();
                        string const arg3 = p.verbatim_item();
-                       if (!in_lyx_preamble) {
+                       // test case \@ifundefined{date}{}{\date{}}
+                       if (arg1 == "date" && arg2.empty() && arg3 == 
"\\date{}")
+                               h_suppress_date = "true";
+                       else if (!in_lyx_preamble) {
                                h_preamble << t.asInput()
                                           << '{' << arg1 << '}'
                                           << '{' << arg2 << '}'

Modified: lyx-devel/branches/BRANCH_2_0_X/status.20x
==============================================================================
--- lyx-devel/branches/BRANCH_2_0_X/status.20x  Fri Oct 28 16:58:27 2011        
(r40053)
+++ lyx-devel/branches/BRANCH_2_0_X/status.20x  Fri Oct 28 20:00:56 2011        
(r40054)
@@ -61,6 +61,8 @@
 
   * Rotated floats (sidewaysfigure, sidewaystable).
 
+  * Command \date{} in the preamble to suppress the date output.
+
 
 * USER INTERFACE
 

Reply via email to