File: import-paper-notebook.pl

package info (click to toggle)
eln 1.5.6-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 9,876 kB
  • sloc: cpp: 26,606; perl: 796; python: 437; sh: 73; makefile: 32; xml: 8
file content (28 lines) | stat: -rw-r--r-- 620 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#!/usr/bin/perl -w

use strict;

my $lastline = undef;
while (<>) {
  my $line = $_;
  if ($line =~ /textblock/) {
    while (<>) {
      $line = $_;
      /^    }/ and last;
    }
    $lastline = $line;
  } else {
    print $lastline if defined $lastline;
    if ($line =~ /y0/) {
      $line = "      \"y0\": 72.0,\n";
    } elsif ($line =~ /"x"/) {
      $line = "          \"x\": -50.0,\n";
    } elsif ($line =~ /"y"/) {
      $line = "          \"y\": 0.0\n";
    } elsif ($line =~ /"scale"/) {
      $line = "          \"scale\": 0.33,\n";
    }
    $lastline = $line;
  }
}
print $lastline if defined $lastline;