summaryrefslogtreecommitdiffstats
path: root/mantools/postconffix
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 12:06:34 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 12:06:34 +0000
commit5e61585d76ae77fd5e9e96ebabb57afa4d74880d (patch)
tree2b467823aaeebc7ef8bc9e3cabe8074eaef1666d /mantools/postconffix
parentInitial commit. (diff)
downloadpostfix-5e61585d76ae77fd5e9e96ebabb57afa4d74880d.tar.xz
postfix-5e61585d76ae77fd5e9e96ebabb57afa4d74880d.zip
Adding upstream version 3.5.24.upstream/3.5.24
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rwxr-xr-xmantools/postconffix72
1 files changed, 72 insertions, 0 deletions
diff --git a/mantools/postconffix b/mantools/postconffix
new file mode 100755
index 0000000..1c70f36
--- /dev/null
+++ b/mantools/postconffix
@@ -0,0 +1,72 @@
+#!/usr/bin/perl
+
+# postconffix - add HTML paragraphs
+
+# Basic operation:
+#
+# - Process input as text blocks separated by one or more empty
+# (or all whitespace) lines.
+#
+# - Don't touch blocks that start with `<' in column zero.
+#
+# The only changes made are:
+#
+# - Put <p>..</p> around text blocks that start in column zero.
+#
+# - Put <pre>..</pre> around text blocks that start elsewhere.
+
+#use Getopt::Std;
+
+#$opt_h = undef;
+#$opt_v = undef;
+#getopts("hv");
+
+#die "Usage: $0 [-hv]\n" if ($opt_h);
+
+#push @ARGV, "/dev/null"; # XXX
+
+while(<>) {
+
+ # Pass through comments and blank linkes before a text block.
+ if (/^(#|\s*$)/) {
+ print;
+ next;
+ }
+
+ # Gobble up the next text block.
+ $block = "";
+ do {
+ $_ =~ s/\s+\n$/\n/;
+ $block .= $_;
+ } while(($_ = <>) && /\S/);
+
+ # Don't touch a text block starting with < in column zero.
+ if ($block =~ /^</) {
+ print "$block\n";
+ }
+
+ # Meta block.
+ elsif ($block =~ /^%/) {
+ print "$block\n";
+ }
+
+ # Example block.
+ elsif ($block =~ /^\S+\s=/) {
+ print "<pre>\n$block</pre>\n\n";
+ }
+
+ # Pre-formatted block.
+ elsif ($block =~ /^\s/) {
+ print "<pre>\n$block</pre>\n\n";
+ }
+
+ # Paragraph block.
+ elsif ($block =~ /^\S/) {
+ print "<p>\n$block</p>\n\n";
+ }
+
+ # Can't happen.
+ else {
+ die "Unrecognized text block:\n$block";
+ }
+}