From 5b3469ce11c15d79211f803879e03563ec7a0099 Mon Sep 17 00:00:00 2001 From: Jonathan Blake Date: Thu, 18 Jul 2019 21:00:33 -0700 Subject: [PATCH] Add comments to XMLize --- common/scripts/xmlize.pl | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/common/scripts/xmlize.pl b/common/scripts/xmlize.pl index ed75116..5ca73a9 100755 --- a/common/scripts/xmlize.pl +++ b/common/scripts/xmlize.pl @@ -137,45 +137,53 @@ sub xmlize { $inline =~ s/(Action\sCharts?)/$1<\/a>/gi; if( $inline =~ /^\*/ ) { + # unordered lists $inline =~ s/^\*\s*/ "; } elsif( $inline =~ /^\d+\)\s/ ) { + # ordered lists $inline =~ s/^\d+\)\s+/
    \n
  1. /; $inline =~ s/\s*\d+\)\s+/<\/li>\n
  2. /g; $inline .= "
  3. \n
"; } elsif( $inline =~ /^\<\!\-\-\spre\s\-\-\>/ ) { + # pre-formatted text $inline =~ s/^\<\!\-\-\spre\s\-\-\>//; - warn( "Warning: preformatted text in \"$infile\"\n" ); + warn( "Warning: pre-formatted text in \"$infile\"\n" ); } 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; } 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>/; } 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/\s+<\/choice>/<\/choice>/; } elsif( $inline =~ /^\[/ ) { + # signposts $inline =~ s/\[(.*)\]/$1/; $inline = " $inline"; $inline =~ s/\s+<\/signpost>/<\/signpost>/; } elsif( $inline =~ /^/ ) { + # comments warn( "Warning: unknown comment \"$1\" in \"$infile\"\n" ); } elsif( $inline eq "" ) { + # do nothing } else { $inline = "

$inline

"; - $inline =~ s/\s+<\/p>/<\/p>/; } -# Interferes with selecting a combat paragraph if done earlier + # Interferes with selecting a combat paragraph if done earlier $inline =~ s/(COMBAT\sSKILL|CLOSE\sCOMBAT\sSKILL|ENDURANCE|WILLPOWER|\bCS\b|\bEP\b)([^<])/$1<\/typ>$2/g; return $inline; -- 2.17.1