summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xmodules/conf/confmaker.pl46
1 files changed, 23 insertions, 23 deletions
diff --git a/modules/conf/confmaker.pl b/modules/conf/confmaker.pl
index d4b5f94..4ae23c5 100755
--- a/modules/conf/confmaker.pl
+++ b/modules/conf/confmaker.pl
@@ -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 @@ $nextarg = 1;
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 @@ foreach my $f(@word_features) {
# 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";