[open-ils-commits] r14264 - trunk/Open-ILS/xul/staff_client/external (phasefx)
svn at svn.open-ils.org
svn at svn.open-ils.org
Mon Oct 5 16:42:58 EDT 2009
Author: phasefx
Date: 2009-10-05 16:42:53 -0400 (Mon, 05 Oct 2009)
New Revision: 14264
Added:
trunk/Open-ILS/xul/staff_client/external/make_entities.pl
Log:
Quick & dirty utility for making DTD entities
Usage:
make_entities.pl <prefix> <filename> > filename.new 2> entities.dtd
mv filename.new filename
sort entities.dtd | uniq >> lang.dtd
Added: trunk/Open-ILS/xul/staff_client/external/make_entities.pl
===================================================================
--- trunk/Open-ILS/xul/staff_client/external/make_entities.pl (rev 0)
+++ trunk/Open-ILS/xul/staff_client/external/make_entities.pl 2009-10-05 20:42:53 UTC (rev 14264)
@@ -0,0 +1,27 @@
+#!/usr/bin/perl -w
+
+use strict;
+
+my $entity_prefix = $ARGV[0];
+my $filename = $ARGV[1];
+
+if (! $entity_prefix && ! $filename) {
+ print STDOUT "Usage:\n\tmake_entities.pl <prefix> <filename> > filename.new 2> entities.dtd\n\n\tmv filename.new filename\n\tsort entities.dtd | uniq >> lang.dtd\n\n";
+ exit 0;
+}
+
+my %entity_hash = ();
+
+open FILE, $filename;
+while (my $line = <FILE>) {
+
+ while ($line =~ /(label|value)="(.+?)"/g) {
+ my $value = $2; if ( $value =~ /^&.+;$/ ) { next; } # Already an entity
+ my $entity = $value; $entity =~ s/\W/_/g; $entity = $entity_prefix . $entity;
+ $line =~ s/$value/&$entity;/g;
+ print STDERR qq^<!ENTITY $entity "$value">\n^;
+ }
+ print STDOUT $line;
+
+}
+close FILE;
Property changes on: trunk/Open-ILS/xul/staff_client/external/make_entities.pl
___________________________________________________________________
Name: svn:executable
+ *
More information about the open-ils-commits
mailing list