On Sun, Nov 11, 2001 at 01:19:27AM +0100, Egbert J.W. Boers wrote:
> Op zaterdag 10 november 2001 22:53, schreef John Levon:
> > a hacky thing :
> >
> > cat myfile.lyx | sed 's+Note+Marginal+' >myfileprint.lyx
> 
> No this won't work: notes look like 
> 
>       \begin_inset Info
>       The text of the note.
>       \end_inset
> 
> while text in the margin looks like 
> 
>       \begin_float margin
>       \layout Standard
> 
>       The text in the margin.
>       \end_float
> 

Try this (untested):

#!/usr/bin/perl -w

use strict;

my $in_info = 0;

line: while (<>)
{
  if ($in_info) {
    if (/\\end_inset/) {
      print "\\end_float\n"; $in_info = 0; next line;
    }
    print;
  } else {
    if (/\\begin_inset\s*Info) {
      print "\\begin_float margin\n\\layout Standard\n";
      $in_info = 1;
      next line;
    }
    print;
  }
}

-- 
Kayvan A. Sylvan          | Proud husband of       | Father to my kids:
Sylvan Associates, Inc.   | Laura Isabella Sylvan  | Katherine Yelena (8/8/89)
http://sylvan.com/~kayvan | "crown of her husband" | Robin Gregory (2/28/92)

Reply via email to