File: makePdfDoc

package info (click to toggle)
king 2.24%2Bdfsg2-2
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 78,588 kB
  • sloc: java: 111,577; xml: 1,868; cpp: 209; perl: 127; sh: 102; python: 99; makefile: 60; ansic: 7
file content (102 lines) | stat: -rwxr-xr-x 3,270 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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
#!/usr/bin/perl

use strict;
use warnings;

# Getting the changelog date at format mm/dd/yyyy.

chomp(my $dateChangelog = `date --utc --date="@\$(dpkg-parsechangelog -Stimestamp)" +%m/%d/%Y`);

# Temporary directory to host the .lyx directory.
chomp(my $tempDirLyx = `mktemp -d`);

# Inserting date in tools-manual.tex right after the title, copying at root.

open CHIRO, "<", "chiropraxis/doc/work/tools-manual.tex"
  or die "Cannot open chiropraxis/doc/work/tools-manual.lyx for reading: $!";

open OUTCHIRO, ">", "chiropraxis/doc/tools-manual.tex"
  or die "Cannot open chiropraxis/doc/tools-manual.tex for writing: $!";

my $lignes = join '', <CHIRO>;
$lignes =~ s/(\\title.*?$)/$1\n\\date\{$dateChangelog\}\n/m;

print OUTCHIRO $lignes;

close CHIRO;
close OUTCHIRO;

# Inserting date in king-manual.lyx right after the title, copying at root.

open KING, "<", "king/doc/work/king-manual.lyx"
  or die "Cannot open king/doc/work/king-manual.lyx for reading: $!";

open OUTKING, ">", "king-manual.lyx"
  or die "Cannot open king-manual.lyx for writing: $!";

$lignes = join '', <KING>;
$lignes =~ s/(manual\n\\end_layout$)/$1\n\n\\begin_layout Date\n $dateChangelog\n\\end_layout/m;

print OUTKING $lignes;

close KING;
close OUTKING;

# Inserting date in format-kinemage.lyx right after the title, copying at root.

open FORMAT, "<", "king/doc/work/format-kinemage.lyx"
  or die "Cannot open king/doc/work/format-kinemage.lyx for reading: $!";

open OUTFORMAT, ">", "format-kinemage.lyx"
  or die "Cannot open format-kinemage.lyx for writing: $!";

$lignes = join '', <FORMAT>;
$lignes =~ s/(Kinemage File.*?\n\\end_layout$)/$1\n\n\\begin_layout Date\n $dateChangelog\n\\end_layout/m;

print OUTFORMAT $lignes;

close FORMAT;
close OUTFORMAT;

# Inserting date in new-color-palette.lyx right before the title, copying at root.

open PALETTE, "<", "king/doc/work/new-color-palette.lyx"
  or die "Cannot open king/doc/work/new-color-palette.lyx for reading: $!";

open OUTPALETTE, ">", "new-color-palette.lyx"
  or die "Cannot open new-color-palette.lyx for writing: $!";

$lignes = join '', <PALETTE>;
$lignes =~ s/(\\layout Title$)/\\begin_layout Date\n $dateChangelog\n\\end_layout\n\n$1/m;

print OUTPALETTE $lignes;

close PALETTE;
close OUTPALETTE;


# Inserting date in rdcvis-manual.lyx right before the title, copying at root.

open RDCVIS, "<", "rdcvis/doc/work/rdcvis-manual.lyx"
  or die "Cannot open rdcvis/doc/work/rdcvis-manual.lyx for reading: $!";

open OUTRDCVIS, ">", "rdcvis-manual.lyx"
  or die "Cannot open rdcvis-manual.lyx for writing: $!";

$lignes = join '', <RDCVIS>;
$lignes =~ s/(\\begin_layout Title.*?$)/\\begin_layout Date\n $dateChangelog\n\\end_layout\n\n$1/m;

print OUTRDCVIS $lignes;

close RDCVIS;
close OUTRDCVIS;

# Compile with pdflatex (twice, for the labels) and export with lyx.
chdir "chiropraxis/doc/";
system "pdflatex", "tools-manual.tex";
system "pdflatex", "tools-manual.tex";
chdir "../../";
system "lyx", "-userdir", $tempDirLyx, "--export", "pdf2", "king-manual.lyx";
system "lyx", "-userdir", $tempDirLyx, "--export", "pdf2", "format-kinemage.lyx";
system "lyx", "-userdir", $tempDirLyx, "--export", "pdf2", "new-color-palette.lyx";
system "lyx", "-userdir", $tempDirLyx, "--export", "pdf2", "rdcvis-manual.lyx";