new scripts
This commit is contained in:
parent
c66de17ece
commit
ae36e5cd43
2 changed files with 55 additions and 0 deletions
37
bin/remove-eol.pl
Executable file
37
bin/remove-eol.pl
Executable file
|
|
@ -0,0 +1,37 @@
|
||||||
|
#!/usr/bin/perl
|
||||||
|
|
||||||
|
use v5.10;
|
||||||
|
|
||||||
|
my @list_multiline_cmd = (
|
||||||
|
qr/^\.SUBSECTION$/
|
||||||
|
, qr/^\.SECTION_NO_NUMBER$/
|
||||||
|
, qr/^\.SUBSUBSECTION$/
|
||||||
|
, qr/^\.SUBSUBSUBSECTION$/
|
||||||
|
, qr/^\.SECTION$/
|
||||||
|
, qr/^\.BULLET$/
|
||||||
|
);
|
||||||
|
|
||||||
|
my $STACK = "";
|
||||||
|
my $found_pattern = 0;
|
||||||
|
|
||||||
|
while (<>) {
|
||||||
|
chomp;
|
||||||
|
my $line = $_;
|
||||||
|
|
||||||
|
$found_pattern = 0;
|
||||||
|
|
||||||
|
for (@list_multiline_cmd) {
|
||||||
|
if ($line =~ $_) {
|
||||||
|
#say "line '$line' matched " . $_;
|
||||||
|
$found_pattern = 1;
|
||||||
|
$STACK = $line . ' ';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($found_pattern == 1) {
|
||||||
|
next;
|
||||||
|
}
|
||||||
|
|
||||||
|
say $STACK . $line;
|
||||||
|
$STACK = "";
|
||||||
|
}
|
||||||
18
bin/roff2custom.sh
Executable file
18
bin/roff2custom.sh
Executable file
|
|
@ -0,0 +1,18 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
# HOW TO USE
|
||||||
|
|
||||||
|
# . ./$0
|
||||||
|
# cat file | modernize_roff | remove-eol.pl > file.new
|
||||||
|
|
||||||
|
modernize_roff() {
|
||||||
|
sed \
|
||||||
|
-e "s/^\.PP/.PARAGRAPH_INDENTED/" \
|
||||||
|
-e "s/^\.NH 1/.SECTION/" \
|
||||||
|
-e "s/^\.NH 2/.SUBSECTION/" \
|
||||||
|
-e "s/^\.NH 3/.SUBSUBSECTION/" \
|
||||||
|
-e "s/^\.NH 4/.SUBSUBSUBSECTION/" \
|
||||||
|
-e "s/^\.SH [1-4]/.SECTION_NO_NUMBER/" \
|
||||||
|
-e "s/^\.SH$/.SECTION_NO_NUMBER/" \
|
||||||
|
-e "s/^\.LP/.PARAGRAPH_UNINDENTED/"
|
||||||
|
}
|
||||||
Loading…
Add table
Reference in a new issue