summaryrefslogtreecommitdiffstats
path: root/misc/spmpp.pl
diff options
context:
space:
mode:
authorlink <link@localhost>2004-05-09 15:56:55 +0000
committerlink <link@localhost>2004-05-09 15:56:55 +0000
commit017b559b9d1db8a18f9ff4493bb5eae06639433e (patch)
tree8168bdfc9f1063af585cb03cc104ac31791b3ed9 /misc/spmpp.pl
parent8121159457b0bce7d55a77faf6e84619cf678c37 (diff)
downloadmarkup-validator-017b559b9d1db8a18f9ff4493bb5eae06639433e.zip
markup-validator-017b559b9d1db8a18f9ff4493bb5eae06639433e.tar.gz
markup-validator-017b559b9d1db8a18f9ff4493bb5eae06639433e.tar.bz2
Merging from branch validator-0_6_0-branch, at tag validator-0_6_5-release.
Diffstat (limited to 'misc/spmpp.pl')
-rwxr-xr-xmisc/spmpp.pl75
1 files changed, 75 insertions, 0 deletions
diff --git a/misc/spmpp.pl b/misc/spmpp.pl
new file mode 100755
index 0000000..c6a153c
--- /dev/null
+++ b/misc/spmpp.pl
@@ -0,0 +1,75 @@
+#!/usr/bin/perl
+#
+# spmpp - Util scrip to generate a Config::General message catalog
+# for use in the Validator, from an OpenSP ParserMessages.rc.
+# (spmpp = "SP Message Pre-Processor")
+#
+# $Id: spmpp.pl,v 1.2 2004-05-09 15:56:55 link Exp $
+#
+
+#
+# Require Perl 5.6.1
+require 5.006_1;
+
+#
+# Keep myself from making stupid mistakes.
+use strict;
+use warnings;
+
+#
+# Array to keep messages in.
+my @msg;
+
+#
+# Snarf OpenSP's ParserMessages.rc and populate @msg.
+my $msgfile = $ARGV[0] || "/usr/local/validator/htdocs/config/verbosemsg.rc";
+open FH, $msgfile
+ or die "Can't open OpenSP ParserMessages file '$msgfile': $!";
+while (<FH>) {
+ next if /^\s*$/;
+ my($id, $s) = split /, /, $_, 2;
+ $id += 0; # Force numerical (kill leading space)...
+ chomp $s; # Strip newline from end of message...
+ push @msg, [$id, $s];
+}
+close FH;
+
+print <<".EOF.";
+#
+# Automatically Generated by $0
+#
+
+.EOF.
+
+#
+# For each message, spit out a Config::General config file snippet.
+#
+# The stuff in "verbose" needs to be a complete XHTML 1.0 Strict
+# block level element (e.g. a single DIV, or a DIV containing
+# multiple Ps; not multiple Ps without a container). The @class
+# and @id are used to play tricks with JavaScript in the final
+# output. "mid-n" identifies the class of message, "muid-n-n"
+# identifies the specific instance of that message (which is why
+# the last digit of the "muid" is replaced at runtime).
+#
+for (@msg) {
+ print <<"_.EOF._";
+<msg $_->[0]>
+ original = $_->[1]
+ verbose <<.EOF.
+ <div class="ve mid-$_->[0]">
+ <p class="helpwanted">
+ <em>Help Wanted!</em> This message (#$_->[0]) has no explanation yet.
+ If you can think of a succinct way to explain the possible situations
+ that will trigger this error and how to fix it, please consider writing
+ it down and sending it to the <a
+ href="mailto:www-validator\@w3.org?Subject=[VE][$_->[0]]%20New%20Error%20Message%20Suggestion"
+ >www-validator\@w3.org</a> list.
+ </p>
+ </div>
+.EOF.
+</msg>
+_.EOF._
+}
+
+exit;