From 745423ba617d89cd8ddf3cba24cf610b7d4cbb5f Mon Sep 17 00:00:00 2001 From: Peter von Kaehne Date: Mon, 13 Jul 2015 05:37:40 +0000 Subject: reads now an input file and uses its content if offered. git-svn-id: https://www.crosswire.org/svn/sword-tools/trunk@494 07627401-56e2-0310-80f4-f8cd0041bdcd --- modules/conf/confmaker.pl | 38 +++++++++++++++++++++++++++----------- 1 file changed, 27 insertions(+), 11 deletions(-) diff --git a/modules/conf/confmaker.pl b/modules/conf/confmaker.pl index e73315a..b1e2873 100755 --- a/modules/conf/confmaker.pl +++ b/modules/conf/confmaker.pl @@ -45,7 +45,8 @@ 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 [-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 [-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 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,11 +58,17 @@ $file = @ARGV[0]; $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 @@ if (@paragraphs==0) {$doc_has_feature{'p'}=true}; 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 @@ if ($doc_has_feature{'p'}) { -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"; +} -- cgit