forked from awakecoding/FreeRDP-Manuals
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gen.pl
executable file
·70 lines (52 loc) · 1.46 KB
/
gen.pl
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
#!/usr/bin/perl
# requires pandoc 1.10+
sub pandoc_generate_pdf
{
($DIR, $DOC) = @_;
chdir($DIR);
print "Generating $DOC PDF...\n";
my $CMD = "pandoc $DOC.markdown " .
" -f markdown+pipe_tables+fenced_code_blocks+definition_lists " .
"--smart --normalize --number-sections --section-divs --toc " .
"--variable=links-as-notes:true --variable=documentclass:report --to=latex " .
"--variable=lang:english --variable=urlcolor:black --variable=linkcolor:black " .
" --variable=verbatim-in-note:true " .
"--output=$DOC.pdf";
print "$CMD\n";
system($CMD);
chdir("..");
print "Done!\n";
}
$USER_DIR = "User";
$USER_DOC = "FreeRDP-User-Manual";
$DEV_DIR = "Developer";
$DEV_DOC = "FreeRDP-Developer-Manual";
$CFG_DIR = "Configuration";
$CFG_DOC = "FreeRDP-Configuration-Manual";
$TEST_DIR = "Testing";
$TEST_DOC = "FreeRDP-Testing-Manual";
@DIRS = ();
@DOCS = ();
foreach $i (0 .. $#ARGV) {
if ($ARGV[$i] =~ m/^user$/) {
push(@DIRS, $USER_DIR);
push(@DOCS, $USER_DOC);
} elsif ($ARGV[$i] =~ m/^dev$/) {
push(@DIRS, $DEV_DIR);
push(@DOCS, $DEV_DOC);
} elsif ($ARGV[$i] =~ m/^cfg$/) {
push(@DIRS, $CFG_DIR);
push(@DOCS, $CFG_DOC);
} elsif ($ARGV[$i] =~ m/^test$/) {
push(@DIRS, $TEST_DIR);
push(@DOCS, $TEST_DOC);
}
}
if ($#ARGV eq -1) {
@DIRS = ($USER_DIR, $DEV_DIR, $CFG_DIR, $TEST_DIR);
@DOCS = ($USER_DOC, $DEV_DOC, $CFG_DOC, $TEST_DOC);
}
foreach (@DOCS) {
$DIR = shift(@DIRS);
pandoc_generate_pdf($DIR, $_,);
}