[sword-svn] r494 - trunk/modules/conf
refdoc at crosswire.org
refdoc at crosswire.org
Sun Jul 12 22:37:41 MST 2015
Author: refdoc
Date: 2015-07-12 22:37:40 -0700 (Sun, 12 Jul 2015)
New Revision: 494
Modified:
trunk/modules/conf/confmaker.pl
Log:
reads now an input file and uses its content if offered.
Modified: trunk/modules/conf/confmaker.pl
===================================================================
--- trunk/modules/conf/confmaker.pl 2015-07-11 07:17:29 UTC (rev 493)
+++ trunk/modules/conf/confmaker.pl 2015-07-13 05:37:40 UTC (rev 494)
@@ -45,7 +45,8 @@
## 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 "\nconfmaker.pl -- - provides a initial conf file for a new module by analysing given OSIS xml file.\n";
+ print "Syntax: confmaker.pl <osis XML file> [-o conf-output-file] [-i conf-input-file]\n";
print "- Arguments in braces < > are required. Arguments in brackets [ ] are optional.\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";
@@ -57,12 +58,18 @@
$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)
-}
+ $outputFileName = "@ARGV[$nextarg+1]";
+ $nextarg += 2;
+ open (OUTF, , ">:utf8", "$outputFileName") or die "Could not open file $outputFileName for writing.";
+ select(OUTF)
+ }
+if (@ARGV[$nextarg] eq "-i") {
+ $inputFileName = "@ARGV[$nextarg+1]";
+ $nextarg += 2;
+ @inputFile=`cat $inputFileName`;
+ }
+
my $parser = XML::LibXML->new();
my $doc = $parser->parse_file($file);
@@ -130,7 +137,6 @@
print "[".$doc_name."]\n";
print "DataPath=./modules/texts/ztext/".$doc_name."\n";
-print "Description=".$doc_name." Bible in ".I18N::LangTags::List::name($doc_lang)."\n";
if ($doc_type =~ m/Bible/) { print "ModDrv=zText\n"}
else {print "ModDrv=zUnknown\n"}
@@ -167,10 +173,20 @@
-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";
+
+if (@inputFile>0) {
+ foreach(@inputFile) {
+ print $_;
+ }
+ }
+else {
+ print "Version=1.0\n";
+ print "History=1.0 First release\n";
+ print "DistributionLicense=copyrighted. Do not distribute\n";
+ print "Description=".$doc_name." Bible in ".I18N::LangTags::List::name($doc_lang)."\n";
+ print "About=".$doc_name." Bible in ".I18N::LangTags::List::name($doc_lang)."\n";
+}
More information about the sword-cvs
mailing list