[sword-svn] r333 - trunk/modules/conf
refdoc at crosswire.org
refdoc at crosswire.org
Thu Jul 7 15:46:11 MST 2011
Author: refdoc
Date: 2011-07-07 15:46:11 -0700 (Thu, 07 Jul 2011)
New Revision: 333
Modified:
trunk/modules/conf/confmaker.pl
Log:
use STDOUt as default
Modified: trunk/modules/conf/confmaker.pl
===================================================================
--- trunk/modules/conf/confmaker.pl 2011-07-07 20:58:00 UTC (rev 332)
+++ trunk/modules/conf/confmaker.pl 2011-07-07 22:46:11 UTC (rev 333)
@@ -40,13 +40,14 @@
#########################################################################
use XML::LibXML;
use I18N::LangTags::List;
+use Unicode::UCD 'charinfo';
+binmode (STDOUT,":utf8");
-
## Obtain arguments
if (scalar(@ARGV) < 1) {
print "\nconfmaker.pl -- - provides a initial conf file for a new module by analysing given OSIS xml file. \n Syntax: confmaker.pl <osis XML file> [-o conf output file] \n";
print "- Arguments in braces < > are required. Arguments in brackets [ ] are optional.\n";
- print "- If no -o option is specified for the output filename, the default output file is: \n\t<osisWork>.conf\n";
+ print "- If no -o option is specified <STDOUT> is used.\n"
print "- The script can currently produce a valid conf file for OSIS bibles, but not for any other import formats.\n";
exit (-1);
}
@@ -58,11 +59,9 @@
if (@ARGV[$nextarg] eq "-o") {
$outputFilename = "@ARGV[$nextarg+1]";
$nextarg += 2;
+ open (OUTF, , ">:utf8", "$outputFilename") or die "Could not open file @ARGV[2] for writing.";
+ select(OUTF)
}
-else {
- $outputFilename = "$file.conf";
-}
-open (OUTF, , ">:utf8", "$outputFilename") or die "Could not open file @ARGV[2] for writing.";
my $parser = XML::LibXML->new();
my $doc = $parser->parse_file($file);
@@ -126,43 +125,44 @@
# Assemble and print out
-print OUTF "[".$doc_name."]\n";
-print OUTF "DataPath=./modules/texts/rawtext/".$doc_name."\n";
-print OUTF "Description=This is the ".$doc_name." Bible in ".I18N::LangTags::List::name($doc_lang)." language\n";
+print "[".$doc_name."]\n";
+print "DataPath=./modules/texts/rawtext/".$doc_name."\n";
+print "Description=This is the ".$doc_name." Bible in ".I18N::LangTags::List::name($doc_lang)." language\n";
-if ($doc_type =~ m/Bible/) { print OUTF "ModDrv=rawText\n"}
-else {print OUTF "ModDrv=rawUnknown\n"}
+if ($doc_type =~ m/Bible/) { print "ModDrv=rawText\n"}
+else {print "ModDrv=rawUnknown\n"}
-print OUTF "Lang=".$doc_lang."\n";
+print "Lang=".$doc_lang."\n";
foreach (@doc_features) {
if ($doc_has_feature{$_}) {
- print OUTF "GlobalOptionFilter=".$doc_filters{$_}."\n"
+ print "GlobalOptionFilter=".$doc_filters{$_}."\n"
}
}
foreach (@word_features) {
if ($doc_has_feature{$_}) {
- print OUTF "GlobalOptionFilter=".$doc_filters{$_}."\n"
+ print "GlobalOptionFilter=".$doc_filters{$_}."\n"
}
}
foreach (@doc_features) {
if ($doc_has_feature{$_} && exists $doc_feature{$_}) {
- print OUTF "Feature=".$doc_feature{$_}."\n"
+ print "Feature=".$doc_feature{$_}."\n"
}
}
foreach (@word_features) {
if ($doc_has_feature{$_} && exists $doc_feature{$_}) {
- print OUTF "Feature=".$doc_feature{$_}."\n"
+ print "Feature=".$doc_feature{$_}."\n"
}
}
-print OUTF "DistributionLicense=copyrighted. Do not distribute\n";
-print OUTF "About=This is the ".$doc_name." Bible in ".I18N::LangTags::List::name($doc_lang)." language\n";
-print OUTF "Encoding=UTF-8\n";
-print OUTF "SourceType=OSIS\n";
-print OUTF "Version=1.0\n";
-print OUTF "History=1.0 First release\n";
-print OUTF "LCSH=".$doc_type.".".I18N::LangTags::List::name($doc_lang)."\n";
+
+print "DistributionLicense=copyrighted. Do not distribute\n";
+print "About=This is the ".$doc_name." Bible in ".I18N::LangTags::List::name($doc_lang)." language\n";
+print "Encoding=UTF-8\n";
+print "SourceType=OSIS\n";
+print "Version=1.0\n";
+print "History=1.0 First release\n";
+print "LCSH=".$doc_type.".".I18N::LangTags::List::name($doc_lang)."\n";
More information about the sword-cvs
mailing list