summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeter von Kaehne <refdoc@gmx.net>2015-07-13 05:37:40 +0000
committerPeter von Kaehne <refdoc@gmx.net>2015-07-13 05:37:40 +0000
commit745423ba617d89cd8ddf3cba24cf610b7d4cbb5f (patch)
treee2be0de16ba0d4d85ecb799f2669293102993f4c
parentcb55ce501a49ee73030675f880195abc0128c7c4 (diff)
downloadsword-tools-745423ba617d89cd8ddf3cba24cf610b7d4cbb5f.tar.gz
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
-rwxr-xr-xmodules/conf/confmaker.pl38
1 files 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 <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,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";
+}