X-Git-Url: https://git.projectaon.org/?a=blobdiff_plain;ds=sidebyside;f=common%2Fscripts%2Fxmlize.pl;fp=common%2Fscripts%2Fxmlize.pl;h=9b9b1745b0aa8bc2a4d8a521b4c8cd2053eb0268;hb=b7735da05ea58dcb68c60c5595e50d4105eaa628;hp=5ca73a9285e74a6df037c54a624fab202be2acac;hpb=5b3469ce11c15d79211f803879e03563ec7a0099;p=project-aon.git
diff --git a/common/scripts/xmlize.pl b/common/scripts/xmlize.pl
index 5ca73a9..9b9b174 100755
--- a/common/scripts/xmlize.pl
+++ b/common/scripts/xmlize.pl
@@ -10,6 +10,7 @@ use utf8;
use open ':encoding(UTF-8)';
my $FILE_EXTENSION = 'txt';
+my $BASE_INDENT = ' ';
#### Main Routine
@@ -98,9 +99,9 @@ for( my $sectionNumber = $minSectionNumber; $sectionNumber <= $numberOfSections;
}
}
- print "\n\n \n $sectionNumber\n\n \n";
+ print "\n\n$BASE_INDENT\n$BASE_INDENT $sectionNumber\n\n$BASE_INDENT \n";
print @newlines;
- print " \n ";
+ print "$BASE_INDENT \n$BASE_INDENT";
}
print << "(End of XML footer)";
@@ -138,15 +139,15 @@ sub xmlize {
if( $inline =~ /^\*/ ) {
# unordered lists
- $inline =~ s/^\*\s*/
\n - /;
- $inline =~ s/\s*\*\s*/<\/li>\n
- /g;
- $inline .= "
\n
";
+ $inline =~ s/^\*\s*/$BASE_INDENT \n$BASE_INDENT - /;
+ $inline =~ s/\s*\*\s*/<\/li>\n$BASE_INDENT
- /g;
+ $inline .= "
\n$BASE_INDENT
";
}
elsif( $inline =~ /^\d+\)\s/ ) {
# ordered lists
- $inline =~ s/^\d+\)\s+/ \n - /;
- $inline =~ s/\s*\d+\)\s+/<\/li>\n
- /g;
- $inline .= "
\n
";
+ $inline =~ s/^\d+\)\s+/$BASE_INDENT \n$BASE_INDENT - /;
+ $inline =~ s/\s*\d+\)\s+/<\/li>\n$BASE_INDENT
- /g;
+ $inline .= "
\n$BASE_INDENT
";
}
elsif( $inline =~ /^\<\!\-\-\spre\s\-\-\>/ ) {
# pre-formatted text
@@ -155,21 +156,21 @@ sub xmlize {
}
elsif( $inline =~ /^.+:\s+CLOSE\sCOMBAT\sSKILL/ ) {
# Freeway Warrior combat
- $inline =~ s/^(.+):\s+CLOSE\sCOMBAT\sSKILL\s+([0-9]+)\s+ENDURANCE\s+([0-9]+)/ $1<\/enemy>$2<\/enemy-attribute>$3<\/enemy-attribute><\/combat>/g;
+ $inline =~ s/^(.+):\s+CLOSE\sCOMBAT\sSKILL\s+([0-9]+)\s+ENDURANCE\s+([0-9]+)/$BASE_INDENT $1<\/enemy>$2<\/enemy-attribute>$3<\/enemy-attribute><\/combat>/g;
}
elsif( $inline =~ /^.+:\s+COMBAT\sSKILL/ ) {
# combat
- $inline =~ s/^(.+):\s+COMBAT\sSKILL\s+([0-9]+)\s+ENDURANCE\s+([0-9]+)/ $1<\/enemy>$2<\/enemy-attribute>$3<\/enemy-attribute><\/combat>/;
+ $inline =~ s/^(.+):\s+COMBAT\sSKILL\s+([0-9]+)\s+ENDURANCE\s+([0-9]+)/$BASE_INDENT $1<\/enemy>$2<\/enemy-attribute>$3<\/enemy-attribute><\/combat>/;
}
elsif( $inline =~ /^(.*)\b(return|turn|go)([a-zA-Z\s]+?to )(\d{1,3})/i ) {
# links
- $inline =~ s/^(.*)\b(return|turn|go)([a-zA-Z\s]+?to )(\d{1,3})(.*)/ $1$2$3$4<\/link-text>$5<\/choice>/i;
+ $inline =~ s/^(.*)\b(return|turn|go)([a-zA-Z\s]+?to )(\d{1,3})(.*)/$BASE_INDENT $1$2$3$4<\/link-text>$5<\/choice>/i;
$inline =~ s/\s+<\/choice>/<\/choice>/;
}
elsif( $inline =~ /^\[/ ) {
# signposts
$inline =~ s/\[(.*)\]/$1/;
- $inline = " $inline";
+ $inline = "$BASE_INDENT $inline";
$inline =~ s/\s+<\/signpost>/<\/signpost>/;
}
elsif( $inline =~ /^/ ) {
@@ -180,7 +181,7 @@ sub xmlize {
# do nothing
}
else {
- $inline = " $inline
";
+ $inline = "$BASE_INDENT $inline
";
}
# Interferes with selecting a combat paragraph if done earlier