#charset "UTF-8"
/*
 *   ad hoc tests / bug diagnostics
 */

#include <tads.h>
#include <file.h>
#include <date.h>
#include <charset.h>


/*showAbout()   
  		{ 
local version = '0. Serial number 150101.';
local authorEmail = 'runeberg76@gmail.com' ;
local desc = 'A text adventure game.';
  		"<b>WIP</b><br>
  		<<desc>><br>
  		Copyright (c) 2015 by Rune Berg (<<authorEmail>>).<br>
  		Release <<version>>
  		<.p>";
  		} 
  		
sentences() 
{
"Sentence one. Here's no 2. And another one. Plus a very very VERY long one to boot.
More text here. And more. Blah. And so on. Will this terp ever ever ever be done?! Meh. ";
}*/

main()
{


//"before<p>between</p>after";
// OK

//"before<p><p>after";
// !!! FAILS

//"before<p>after";
// OK

//"<br></font><img src='.system/CoverArt.jpg?id=KVrxlXNOJ9mueATWDBFug8DMlDgxkPeR'><br>Welcome to <i>Return to Ditch Day</i>!&#8194;";

/*
"Starting...<br>";
"Wait for VM more prompt...<br>";
morePrompt();
"After VM more prompt<br>";
"After VM more prompt line 2<br>";
"Wait for another VM more prompt...<br>";
morePrompt();
"Done<br>";
*/

/*
"Starting...<br>";
for (local ii = 0; ii < 2; ii++) {
	for (local i = 0; i < 100; i++) {
		"line <<i>><br>";
	}
	"Enter a line: ";
	inputLine();
}
"Done<br>";
*/

// drool indentation bugs:

// gameverbs
//"<TAB MULTIPLE=4><li><b>realtime</b>:  time in the game is ";
//"<li><b>realtime</b>:  time in the game is ";
//"<TAB MULTIPLE=4><b>realtime</b>:  time in the game is ";


// homeopen > in attribute value bug:

/*
"raw lt gt in attr value - first line<br>";
"<a href='http://pr-if.org/doc/play-if-card/play-if-card.html' target='_blank'><img src='resources/play-if-card.png'";
"width='1000' alt=\"You <b>just</b> started ...\"></a><BR HEIGHT=0>next line";
*/
/* reproduces the bug:
"first line<br>";
"<a href='http://pr-if.org/doc/play-if-card/play-if-card.html' target='_blank'><img src='resources/play-if-card.png' ";
"width='1000' alt=\"You just started ...";
"<BR HEIGHT=0>\"></a>next line";
*/
/*
"first line<br>";
"<a href='http://pr-if.org/doc/play-if-card/play-if-card.html' target='_blank'><img src='resources/play-if-card.png' ";
"width='1000' alt=\"You just started ...";
"\"></a>next line";
*/


// macrocosm loc name italics bug -- NOT A BUG: ARIAL BLACK DOESN'T SUPPORT ITALICS

/* recreates the bug:
"<body bgcolor=statusbg text=statustext><font face='Impact'> <b></b><font size='4'> M a c r o c o s m <font face='Arial'>";
"<font size='2' color='#607080'> <i> <TAB ALIGN=RIGHT> Compiled 2007 by Shaun W.&#8194;Donaldson </i> <font face='Arial Black'>";
"<font size='2'color='black'><div align=center><font size='2' color='black'><i><b>Aboard the <i>Hesphaesteon</i> ~ Room 3H</b>";
"<BR HEIGHT=0>";
*/

/* recreates the bug:
"<font face='Impact'> <b></b><font size='4'> M a c r o c o s m <font face='Arial'>";
"<font size='2' color='#607080'> <i> <TAB ALIGN=RIGHT> Compiled 2007 by Shaun W.&#8194;Donaldson </i> <font face='Arial Black'>";
"<font size='2'color='black'><div align=center><font size='2' color='black'><i><b>Aboard the <i>Hesphaesteon</i> ~ Room 3H</b>";
*/

/*
"<font size='2' color='#607080'> <i> <TAB ALIGN=RIGHT> Compiled 2007 by Shaun W.&#8194;Donaldson </i> <font face='Arial Black'>";
"<font size='2'color='black'><div align=center><font size='2' color='black'><i><b>Aboard the <i>Hesphaesteon</i> ~ Room 3H</b>";
*/

/* recreates the bug:
"<font face='Arial Black'>";
"<font size='2'color='black'><div align=center><font size='2' color='black'><i><b>Aboard the <i>Hesphaesteon</i> ~ Room 3H</b>";
*/

/* does NOT recreate the bug:
"<font size='2'color='black'><div align=center><font size='2' color='black'><i><b>Aboard the <i>Hesphaesteon</i> ~ Room 3H</b>";
*/

/*
"<font face='Arial Black'>";
"<font size='2'color='black'><div align=center><font size='2' color='black'><i><b>Aboard the <i>Hesphaesteon</i> ~ Room 3H</b>";
*/

//"<i><b>Aboard the <i>Hesphaesteon</i> ~ Room 3H</b>";

/*
"before
<ol>
<li>0nd</li>
<li>1st<br>1st l2</li>
<li>2nd</li>
<li>3rd</li>
</ol>
done";
*/

/*
"before
<ul>
<li>1st</li>
<li>2nd<br>2nd l2</li>
<li>3rd</li>
</ul>
after
<ol>
<li>1st<br>1st l2</li>
<li>2nd</li>
<li>3rd</li>
</ol>
done";
*/

/*
"0<tab>1<tab>2<tab>3<tab align=right>Right?<br>
0...";
*/

//	 "<P>Outside cave<BR HEIGHT=0><TAB MULTIPLE=4><BR>Desc";

/*
	 "<P>Outside cave";
	 "<BR HEIGHT=0>";
	 "<TAB MULTIPLE=4><BR>Desc";
*/

/*
	 "<P>Outside cave";
	 "<BR HEIGHT=0>";
	 "<BR HEIGHT=0>";
	 "<TAB MULTIPLE=4><BR>Desc";
*/

/*
	 "<P>Outside cave";
	 "<BR HEIGHT=0>";
	 "<TAB MULTIPLE=4>";
	 "<BR HEIGHT=0>";
	 "<TAB MULTIPLE=4><BR>Desc";
*/

/*
"sdesc";
"
";
"<BR HEIGHT=0>";
"<TAB MULTIPLE=4><p>Text</p>";
"
";
"<BR HEIGHT=0>";
"<TAB MULTIPLE=4>";
"
";
"<BR HEIGHT=0>";
"<BR HEIGHT=0>";
"<BR HEIGHT=0>";
"<BR HEIGHT=0>";
"
";
"<BR>>";
*/

/*
	 "<TAB MULTIPLE=4><li>wallow</li>";
	 "<BR HEIGHT=0>";
	 "</ul> Also";
*/

//	 "preferences:<BR HEIGHT=0><TAB MULTIPLE=4><li>realtime</li>";

// proper tab handling 
/*
".<tab multiple=4>.<tab multiple=4>.<tab multiple=4>. (4)<br>
.<tab multiple=3>.<tab multiple=3>.<tab multiple=3>. (3)<br>
<tab multiple=3>.<tab multiple=3>.<tab multiple=3>. (3)<br>
.<tab multiple=4>.<tab multiple=4>.<tab multiple=4>. (4)<br>
.<tab multiple=3>.<tab multiple=3>.<tab multiple=3>. (3)<br>
..<tab multiple=3>.<tab multiple=3>.<tab multiple=3>. (3)<br>";
"<br>";
"<br>";
"n<tab multiple=4>n<tab multiple=4>n<tab multiple=4>n (4)<br>
n<tab multiple=3>n<tab multiple=3>n<tab multiple=3>n (3)<br>
<tab multiple=3>n<tab multiple=3>n<tab multiple=3>n (3)<br>
n<tab multiple=4>n<tab multiple=4>n<tab multiple=4>n (4)<br>
n<tab multiple=3>n<tab multiple=3>n<tab multiple=3>n (3)<br>
nn<tab multiple=3>n<tab multiple=3>n<tab multiple=3>n (3)<br>";
"<br>";
"<br>";
"M<tab multiple=4>M<tab multiple=4>M<tab multiple=4>M (4)<br>
M<tab multiple=3>M<tab multiple=3>M<tab multiple=3>M (3)<br>
<tab multiple=3>M<tab multiple=3>M<tab multiple=3>M (3)<br>
M<tab multiple=4>M<tab multiple=4>M<tab multiple=4>M (4)<br>
M<tab multiple=3>M<tab multiple=3>M<tab multiple=3>M (3)<br>
MM<tab multiple=3>M<tab multiple=3>M<tab multiple=3>M (3)<br>";
*/

/*
"0<tab multiple=4>4<tab multiple=4>8<tab multiple=4>12<br>
0<tab multiple=3>3<tab multiple=3>6<tab multiple=3>9<br>
<tab multiple=3>3<tab multiple=3>6<tab multiple=3>9<br>
0<tab multiple=4>4<tab multiple=4>8<tab multiple=4>12<br>
01<tab multiple=3>3<tab multiple=3>6<tab multiple=3>9<br>
..<tab multiple=3>3<tab multiple=3>6<tab multiple=3>9<br>";
*/

/*
"some text <tab id=t1>some more text <tab id=t2><br>
<tab to=t1>t1<tab to=t2>t2<br>
<p>
<tab to=t1>t1<tab to=t2>t2<br>";
*/

/*
"text<tab>text<tab>text<tab>text<br>";
"a\tab\tabc\tabcd\tabcde<br>";
"text<tab align=left>left<tab align=center>center<tab align=right>right<br>";
"<tab align=left>left<tab align=center>center<tab align=right>right";
*/

// banner2 cmd-r bug -- REPRODUCES BUG!
/*
    local win1;
    local win2;

	// *
    win1 = bannerCreate(nil, BannerLast, nil, BannerTypeText, BannerAlignLeft,
                       20, BannerSizePercent,
                       BannerStyleVScroll | BannerStyleAutoVScroll | BannerStyleBorder);
    bannerSay(win1, 'banner1');
    // * /
    
    "Press a key to continue...\n";
    inputKey();
    
    win2 = bannerCreate(nil, BannerLast, nil, BannerTypeText, BannerAlignLeft,
                       20, BannerSizePercent,
                       BannerStyleVScroll | BannerStyleAutoVScroll | BannerStyleBorder);
    bannerSay(win2, 'banner2');
    
    "Press a key to continue...\n";
    inputKey();
*/

// <hr> handling

//"hello<hr>there";

/*
// HTML parser "forgiveness":

"a<br HEIGHT='>'>b";
*/

// Finding Martin unwanted indent bug REVISITED:
/*
"na na na<BR>It was something of a shock when you got a phone call from Martin's sister";
" ";
"Rachel, whom you're fairly certain that you've never met.  &nbsp;But Rachel";
*/

/*
"Before space nbsp After x 3:<br>";
for (local i = 0; i < 3; i++) {
	"Before &nbsp;After &nbsp;Before &nbsp;After &nbsp;Before &nbsp;After &nbsp;Before &nbsp;After &nbsp;Before &nbsp;After &nbsp;Before &nbsp;After &nbsp;Before &nbsp;After &nbsp;Before &nbsp;After &nbsp;Before &nbsp;After. &nbsp;";
	}
"<br>
<br>Before nbsp space After x 3:<br>";
for (local i = 0; i < 3; i++) {
	"Before&nbsp; After&nbsp; Before&nbsp; After&nbsp; Before&nbsp; After&nbsp; Before&nbsp; After&nbsp; Before&nbsp; After&nbsp; Before&nbsp; After&nbsp; Before&nbsp; After&nbsp; Before&nbsp; After&nbsp; Before&nbsp; After.&nbsp; ";
	}
*/

//------ Default tab width

//"E<br><tab MULTIPLE=4>a<br><tab MULTIPLE=4><tab MULTIPLE=4>a";

//------ Escape bad html bug (T2):

//"<i>ab <b>Writers:<\b <TAB MULTIPLE=4>Karen M.  Sandler</i>";

//------ erudite missing space before cmd prompt bug:

/*TODO rm - the bug was in a t2 game
"<br>";
"</font></B>Time passes..." ;
"
" ;
"<BR HEIGHT=0>" ;
"<BR HEIGHT=0>" ;
"<BR HEIGHT=0>" ;
"<BR HEIGHT=0>" ;
"
" ;
"<BR>&gt;<font face=#000000><B>" ;
"<TITLE>The Erudition Chamber</TITLE>" ;
" " ;
"<ABOUTBOX><body bgcolor=#FFCC99 text=#000000><CENTER><B>The Erudition" ;
" " ;
"Chamber</B>" ;
"
" ;
"<BR HEIGHT=0>" ;
"Copyright (c) 2003 Daniel T.  Freas" ;
"
" ;
"<BR HEIGHT=0>" ;
"(Type info if this is your first time playing.)" ;
"
" ;
"<BR HEIGHT=0>" ;
"
" ;
"<BR></CENTER></ABOUTBOX><banner id=StatusLine height=previous border> <body" ;
" " ;
"bgcolor=#000000 text=#FFFFFF><b>Basement</b><tab align=right><i>Apprehensive" ;
" " ;
"</i></banner>" ;
"
";

inputLine();
*/

/*TODO rm
2016-12-20 19:30:33.035 XTads[51711:4349056] [T] [XTOutputTextParserHtml] parse: "</font></B>Time passes..." 
2016-12-20 19:30:33.036 XTads[51711:4349056] [T] [XTOutputTextParserHtml] parse: "
" 
2016-12-20 19:30:33.036 XTads[51711:4349056] [T] [XTOutputTextParserHtml] parse: "<BR HEIGHT=0>" 
2016-12-20 19:30:33.036 XTads[51711:4349056] [T] [XTOutputTextParserHtml] parse: "<BR HEIGHT=0>" 
2016-12-20 19:30:33.037 XTads[51711:4349056] [T] [XTOutputTextParserHtml] parse: "<BR HEIGHT=0>" 
2016-12-20 19:30:33.037 XTads[51711:4349056] [T] [XTOutputTextParserHtml] parse: "<BR HEIGHT=0>" 
2016-12-20 19:30:33.037 XTads[51711:4349056] [T] [XTOutputTextParserHtml] parse: "
" 
2016-12-20 19:30:33.037 XTads[51711:4349056] [T] [XTOutputTextParserHtml] parse: "<BR>&gt;<font face=#000000><B>" 
2016-12-20 19:30:33.038 XTads[51711:4348143] [W] [XTFontManager] getFontWithName:pointSize:htmlSize:bold:italics:small:big: 0.000000ailed for familyName="#000000" pointSize=0.000000 htmlSize=3.000000 bold=1 italics=1 
2016-12-20 19:30:33.048 XTads[51711:4349056] [T] [XTOutputTextParserHtml] parse: "<TITLE>The Erudition Chamber</TITLE>" 
2016-12-20 19:30:33.048 XTads[51711:4349056] [T] [XTOutputTextParserHtml] parse: " " 
2016-12-20 19:30:33.048 XTads[51711:4349056] [T] [XTOutputTextParserHtml] parse: "<ABOUTBOX><body bgcolor=#FFCC99 text=#000000><CENTER><B>The Erudition" 
2016-12-20 19:30:33.048 XTads[51711:4349056] [T] [XTOutputTextParserHtml] makeTag ignoring known tag "body" 
2016-12-20 19:30:33.048 XTads[51711:4349056] [T] [XTOutputTextParserHtml] parse: " " 
2016-12-20 19:30:33.048 XTads[51711:4349056] [T] [XTOutputTextParserHtml] parse: "Chamber</B>" 
2016-12-20 19:30:33.049 XTads[51711:4349056] [T] [XTOutputTextParserHtml] parse: "
" 
2016-12-20 19:30:33.049 XTads[51711:4349056] [T] [XTOutputTextParserHtml] parse: "<BR HEIGHT=0>" 
2016-12-20 19:30:33.049 XTads[51711:4349056] [T] [XTOutputTextParserHtml] parse: "Copyright (c) 2003 Daniel T.  Freas" 
2016-12-20 19:30:33.049 XTads[51711:4349056] [T] [XTOutputTextParserHtml] parse: "
" 
2016-12-20 19:30:33.049 XTads[51711:4349056] [T] [XTOutputTextParserHtml] parse: "<BR HEIGHT=0>" 
2016-12-20 19:30:33.049 XTads[51711:4349056] [T] [XTOutputTextParserHtml] parse: "(Type info if this is your first time playing.)" 
2016-12-20 19:30:33.050 XTads[51711:4349056] [T] [XTOutputTextParserHtml] parse: "
" 
2016-12-20 19:30:33.050 XTads[51711:4349056] [T] [XTOutputTextParserHtml] parse: "<BR HEIGHT=0>" 
2016-12-20 19:30:33.050 XTads[51711:4349056] [T] [XTOutputTextParserHtml] parse: "
" 
2016-12-20 19:30:33.050 XTads[51711:4349056] [T] [XTOutputTextParserHtml] parse: "<BR></CENTER></ABOUTBOX><banner id=StatusLine height=previous border> <body" 
2016-12-20 19:30:33.050 XTads[51711:4349056] [T] [XTOutputTextParserHtml] parse: " " 
2016-12-20 19:30:33.050 XTads[51711:4349056] [T] [XTOutputTextParserHtml] parse: "bgcolor=#000000 text=#FFFFFF><b>Basement</b><tab align=right><i>Apprehensive" 
2016-12-20 19:30:33.051 XTads[51711:4349056] [T] [XTOutputTextParserHtml] makeTag ignoring known tag "body" 
2016-12-20 19:30:33.051 XTads[51711:4349056] [T] [XTOutputTextParserHtml] parse: " " 
2016-12-20 19:30:33.051 XTads[51711:4349056] [T] [XTOutputTextParserHtml] parse: "</i></banner>" 
2016-12-20 19:30:33.051 XTads[51711:4349056] [T] [XTOutputTextParserHtml] parse: "
*/


//------ drool missing <ul> tag bug:
/*
"<BR HEIGHT=0>";
"<TAB MULTIPLE=4><li><b>check out</b> something</li>";
*/

//------ drool intro indented <hr> bug

/* This reproduces the problem
"Boston" ;
"<BR HEIGHT=0>" ;
"<TAB MULTIPLE=4><TITLE>Drool</TITLE><hr> These" ;
*/

/*
"Boston" ;
"<BR HEIGHT=0>" ;
"<TAB MULTIPLE=4><TITLE>Drool</TITLE> <i><hr> These" ;
" " ;
"puppyhood." ;
*/

/*
"<BR HEIGHT=0>" ;
"Boston Commons, 1994" ;
"<BR HEIGHT=0>" ;
"<TAB MULTIPLE=4><TITLE>Drool</TITLE> <i><hr> These are the halcyon days of" ;
" " ;
"puppyhood.  The sun is shining in Boston for a change, and everyone seems" ;
*/

//------ homeopen centered text bug

//"<center>center?<p>p</p>center?</center>after";

// REPRODUCES ERROR:
/*
"<center>";
"<h1>Home Open</h1>" ;
"</center>";
*/

// REPRODUCES ERROR:
/*
"<center>";
"<BR HEIGHT=0>" ;
"<BR>" ;
"<BR HEIGHT=0>" ;
"<BR>" ;
"<BR HEIGHT=0>" ;
"<BR>" ;
"<BR HEIGHT=0>" ;
"<h1>Home Open</h1>" ;
"<BR HEIGHT=0>" ;
"<BR>" ;
"<BR HEIGHT=0>" ;
"<h2>by Emily Boegheim</h2></center>after" ;
*/

//----------
/*
"Before table<table>
	<tr><td>cell0.1</td><td>cell0.2</td><td>cell0.3</td></tr>
	<tr><td>  cell1.1 </td><td>cell1.2  </td><td>cell1.3</td></tr>
	<tr><td>cell2.1</td><td>cell0002.2</td><td>cell2.3</td></tr>
</table>After table"; 
*/

//----- dark_angel "Harry" indented bug

// REPRODUCES ERROR
/*
"<table><tr><td>"; 
"<p>Ford</p>" ;
"</td></tr></table>Harry" ;
//"<BR HEIGHT=0>";
*/

/*REPRODUCES ERROR
"<table><tr><td>"; 
"<center>by Jerry Ford (c) 2013</center>" ;
"</td></tr></table>Harry" ;
"<BR HEIGHT=0>";
*/

//----- parrots quote bug

//"a <Q>b</Q> c";
//"a&#8194;<Q>b</Q> c";

/*
"What, and engage him yourself?&#8194;<Q>Henchmen first, captains second</Q> is the most important rule of villainy.&#819";
"4;";
*/

//----- negotis alignment bugs:

//"<H1 align=center> Negotis </H1>";
//"<H2 align=center> Negotis </H2>";
//"<H3 align=center> Negotis </H3>";
//"<H4 align=center> Negotis </H4>";
//"<p align=right>right?<H1 align=center> Negotis </H1>right?</p>";
//"<p align=right>right?<div align=center> Negotis </div>right?</p>";
//"<center>center?<h1>h1</h1>center?</center>after";
//"<center>center?<h2>h2</h2>center?</center>after";
//"<center>center?<h3>h3</h3>center?</center>after";
//"<center>center?<h4>h4</h4>center?</center>after";
	//TODO make h* behave like on qtads
//"<center>center?<p>p</p>center?</center>after";
	//TODO make behave like on qtads
//"<center>center?<div>div</div>center?</center>after";
	//TODO make behave like on qtads
//"<center>center?<h1 align=right>h1</h1>center?</center>after";
//"<center>center?<p align=right>p</p>center?</center>after";
//"<p align=right>right?</p>after";

//----- mrspepper unwanted spaces between commands in "instructions" bug:

//"and yours.&#8194;For example: <BR HEIGHT=0> <BR> <BR HEIGHT=0> <TAB MULTIPLE=4> &gt;TIE UP THE THIEF <BR HEIGHT=0> <TAB MULTIPLE=4> (with the rope)";

//"example:<BR HEIGHT=0>\n<BR><BR HEIGHT=0>\n<TAB MULTIPLE=4> &gt;TIE UP THE THIEF";

/*
"example:
<BR HEIGHT=0>\n
<BR>
<BR HEIGHT=0>\n
<TAB MULTIPLE=4> &gt;TIE UP THE THIEF";
*/

/*
"and yours.&#8194;For example:
<BR HEIGHT=0>\n
<BR>
<BR HEIGHT=0>\n
<TAB MULTIPLE=4> &gt;TIE UP THE THIEF
<BR HEIGHT=0>\n
<TAB MULTIPLE=4> (with the rope)";
*/
/*
"and yours.&#8194;For example:
<BR HEIGHT=0>
<BR>
<BR HEIGHT=0>
<TAB MULTIPLE=4> &gt;TIE UP THE THIEF
<BR HEIGHT=0>
<TAB MULTIPLE=4> (with the rope)";
*/
/*
"For example:";
"<BR HEIGHT=0>
";
"<BR>";
"<BR HEIGHT=0>
";
"<TAB MULTIPLE=4> &gt;TIE UP THE THIEF";
"<BR HEIGHT=0>
";
"<TAB MULTIPLE=4> (with the rope)";
*/

//----- "magic" plain link bug

/*
"<a href=foo>Normal link</a><br><a href=foo plain>Plain link</a>";

local b0 = nil;
local b1 = bannerCreate(b0, BannerFirst, nil, BannerTypeText, BannerAlignTop,
                       50, BannerSizePercent,
                       BannerStyleVScroll | BannerStyleAutoVScroll | BannerStyleBorder);
bannerSay(b1, 'In banner: <a href=foo>Normal link</a><br><a href=foo plain>Plain link</a>');
inputKey();
*/

//----- failing img formatting tests

/*
"<img src=unknown7.gif alt='7 Alt Text'>
<p>Text</p>
<img src=unknown8.gif alt='8 Alt Text'>";
*/

/*
"Meh
<p>Text before</p>
<img src=unknown.gif alt='Alt Text'>
<p>after</p>";
*/

//---- Basic <tab> handling:

//"Outside cave?_?<br HEIGHT=0><tab MULTIPLE=4><br>Desc"; // OK

//"Outside cave?!?!!!<br HEIGHT=0> <tab MULTIPLE=4><br>Desc"; // OK

//"Outside cave!?!<br HEIGHT=0> <tab><br>Desc"; // OK

//"Outside cave!!<br HEIGHT=0><tab><br>Desc";  // OK

//"Outside cave???<br HEIGHT=0> <br>Desc"; // OK

//"Outside cave!<br HEIGHT=0><br>Desc"; // OK

//"Outside cave?<br HEIGHT=0><tab MULTIPLE=4>Desc"; // OK

//"Outside cave?!<tab MULTIPLE=4><br>Desc"; // OK

//"<tab>a"; // OK

//"<tab><tab>a"; // OK

//"abc <tab> b"; // OK

//"ab <tab> b"; // OK

//"a <tab> b"; // OK

//"a<tab><tab>b"; // OK

//"abc<tab>b"; // OK

//"<tab multiple=4><tab multiple=4>a"; // OK
		
//"\t\ta"; // OK

//"Outside cave<br height=\"0\">a<br>Desc"; // OK

//"Outside cave<br height=\"0\">\ <br>Desc"; // OK

//"Outside cave<br height=\"0\"><tab multiple=4><br>Desc"; // OK

//"Outside cave<br height=\"0\"><tab><br>Desc"; // OK

//"Outside cave<br height=\"0\">\t<br>Desc"; // OK

//"Outside cave<br height=\"0\"><br>Desc"; // OK

//"Outside cave<br height=\"0\"> <br>Desc"; // OK

//"Outside cave<br height=\"0\"><b><br>Desc"; // OK

//"Outside cave<br height=\"0\">\ <br>Desc"; // OK

// Bug with initial zwsp / tabs "used up" a paragraph's alignment:

//"<TAB MULTIPLE=4>af tab-m-4";

//"<TAB MULTIPLE=4><center>center 1</center>";

/*
"<div align=center>Centered 1</div>";
"<div align=center>Centered 2</div>";
"<div align=center>Centered 3</div>";
*/

/* Looks same on xtads as on qtads:
"<p align=center>Centered 1</p>";
"<p align=center>Centered 2</p>";
"<p align=center>Centered 3</p>";
*/

//"<center>center 1</center>";
//"<center>center 2</center>";
//"<center>center 3<center>";

// Support for all typographical spaces, incl. special handling for monosized fonts:

//"Michael Ja. Roberts<br>";
//"Michael Ja.\ Roberts<br>";
//"Go back. Then back again.<br>";

//"<pre>a&hairsp;b\nabcd</pre>";
//"a&hairsp;b";

//"<pre>a&thinsp;b\nabc</pre>";
//"a&thinsp;b";

//"<pre>a&puncsp;b\na.b<pre>";
//"a&puncsp;b<br>a.b";

//"<pre>a&figsp;b\na0b</pre>";
//"a&figsp;b<br>a0b";

//"<pre>a&spmsp;b\nabcd<pre>";
//"a&spmsp;b";

//"<pre>a&fpmsp;b\nabcd</pre>";
//"a&fpmsp;b";

//"<pre>a&tpmsp;b\nabcd</pre>";
//"a&tpmsp;b";

//"<pre>a&emsp;b\nabcd</pre>";
//"a&emsp;b";

//"<pre>a&ensp;b\nabcd</pre>"; 
//"a&ensp;b";

// pending ws change:

//"mud.&#8194; Rain";
//"cd\ <u> e</u>f";
/*
"ab<b>cd </b>\ e<br>
fg <b>\ hi";
*/
//"cd\ <b> \ e"; // -> "cd  e"
//"cd <u>\ e</u>";	// -> "cd  e"
//"cd \ e";  // -> "cd e"
//"cd <u> e</u>";  // -> "cd e" w/ "e" underlined
//"cd<u> e</u>";  // -> "cd e" w/ " e" underlined
//"cd<u>e </u>f";  // -> "cde f" w/ "e " underlined"
//"cd<u> e </u>f";	// -> "cd e f" w/ " e " underlined
//TODO test interactively!:
//"cd <u> \ e</u>";  // -> "cd  e" w/ " e" underlined

//"cd <b> </b>\ e</b>"; // -> "cd  e"
//"cd <b></b>\ e</b>"; // -> "cd  e"
//"cd <b>\ e</b>"; // -> "cd  e"
//"cd\ <b> </b> e"; // ->
//"cd\ <b></b> e"; // -> "cd e"
//"cd\ <b> e</b>"; // -> "cd e"
//"cd <b> </b> e";
//"cd <b> e</b>";
//"<b>cd </b>\ e";
//"m &nbsp; &nbsp; r";
//"\ \ a";
//"<p>para</p> after";
/*
"ab<b>cd </b>\ e<br>
fg <b>\ hi";
*/
//"a \  b";
//"<b>cd </b>\ e";
//"<b>cd </b> e";
//"cd <foo>\ e";
//"<b>cd </b>\ e";
//"cd <b>\ e</b>";
//"cd\ <u> e</u>f";
//"cd <font>\ e</font>";
//"cd <u> e</u>";
//"cd <u>\ e</u>";
//"cd&nbsp;&nbsp;";
	//TODO -> "cd  " even when no text after
//"cd &nbsp;&nbsp;";
	//TODO -> "cd   "

//TODO unit test "cd <u>\ e</u>";
//	"  <b>b</b>";
//"a &nbsp;b";
//" <p> a <p> b";

// "magic" spaces Around Link Bug
//"<BR HEIGHT=0> ";
//"(<A HREF=\"http://g42.org/xwiki/bin/view/Main/IFComp2008\">website</A>)";
//"<BR HEIGHT=0> ";

//"<BR HEIGHT=0> (<A HREF=\"http://g42.org/xwiki/bin/view/Main/IFComp2008\">website</A>)<BR HEIGHT=0> ";

//" (<b>b</b>)n<i>i</i>n";

// magic extra space bug:
//"mud.&#8194;Rain";
//"mud.&#8194; Rain";
//"mud.&#8194;  Rain";
//"mud. &#8194;Rain";
//"mud.  &#8194;Rain";
//"mud. &#8194; Rain";
//"mud.  &#8194;  Rain";
//"mud.&#8194;&#8194;Rain";
//"mud. &#8194;&#8194; Rain";
//"mud. &#8194; &#8194; Rain";
//"mud. \  \  Rain";
//"mud. &nbsp; &nbsp; Rain";
//"mud.&#8195; Rain";
//"mud. &#8195; &#8195; Rain";
//"a \ b";

// Lighthouse "help" missing newline bug:
/*
"<table cellspacing=0 cellpadding=5> <tr><td>'Help' ... the story:</td></tr> <tr><td><b>Useful Commands</b>";
"<BR HEIGHT=0>";
"LOOK (l), ... WITH something</td></tr>";
"<BR HEIGHT=0>";
//"<BR>";
//"<BR HEIGHT=0>";
"<tr><td><b>Sense related Commands</b>";
"<BR HEIGHT=0>";
"FEEL/TOUCH it, SMELL ...</td></tr>";
"</table>";
*/
/*
"<table cellspacing=0 cellpadding=5> <tr><td><small>'Help' will toggle this";
" banner on and off.&#8194;You may try some of these commands (also, there will be others) to advance the story:</small></td></t";
"r> <tr><td><b>Useful Commands</b>";
"<BR HEIGHT=0>";
"<small>LOOK (l), INVENTORY (i), THINK ABOUT <i>it</i>, EXAMINE (x) <i>it</i>, SEARCH <i>it</i>, OPEN <i>it</i>, CLOSE <i>it</i>";
", GET/TAKE <i>it</i>, DROP <i>it, </i> UNLOCK <i>it</i> WITH <i>something</i></small></td></tr>";
"<BR HEIGHT=0>";
"<BR>";
"<BR HEIGHT=0>";
"<tr><td><b>Sense related Commands</b>";
"<BR HEIGHT=0>";
"<small>FEEL/TOUCH <i>it</i>, SMELL <i>it</i>, LISTEN TO <i>it</i>, TASTE <i>it,</i></small></td></tr>";
"</table>";
*/

// Investigate parser state after flush when incomplete char entity:
/*
"ab&a";
inputKey();
"<b>bold?</b>";
inputKey();
*/
/*
"ab&a";
inputKey();
" c ";
inputKey();
*/

/*
"ab&a";
inputKey();
"mp;c ";
inputKey();
*/

// Slow cmd-r bug:
/*
"inputEvent";
inputEvent();
"\nDone";
*/
/*
"morePrompt";
morePrompt();
"\nDone";
*/
/*
"inputLine";
inputLine();
"\nDone";
*/
/*
"inputKey";
inputKey();
"\nDone";
*/

// Named entities that arere missing in qtads (but supported in xtads) bug:
/*
"apos&apos;.\n";
"euro&euro;.\n"; 
"lrm&lrm;.\n";
"rlm&rlm;.\n";
"vellip&vellip;.\n";
"zwj&zwj;.\n";
"zwnj&zwnj;.\n";
*/

// Named entities that were missing in xtads (but supported in qtads) bug:
/*
"fpmsp:&fpmsp;.\n";    //@"\u2005",
"figsp:&figsp;.\n";    //@"\u2007",
"hairsp:&hairsp;.\n";  //@"\u200a",
"puncsp:&puncsp;.\n";  //@"\u2008",
"spmsp:&spmsp;.\n";    //@"\u2006",
"tpmsp:&tpmsp;.\n";    //@"\u2004",
"zwnbsp:&zwnbsp;.\n";  //@"\ufeff",
"zwsp:&zwsp;.\n";      //@"\u200b",
//"fooey:&fooey;.\n";    //@"\u200b",
*/

// rogue hint space before link bug
//"[1/4]&emsp;<a href=\"next\"><font size=-1>Next</font></a>";
//"[1/4] x\n[1/4]&emsp;x\n[1/4]&#8195;x\n[1/4]Mx\n[1/4]mx";

// rogue hint menu 1st item indent bug:
//"<table><tr><td></td><td>&gt;<a plain>General</a><br>&gt;<a plain>The Prison</a><br></td></tr></table>";

/*
 "&l";
 //inputKey();
 inputLine();
	// behaves diff'ly than iK(): prints &l\nt
	// looks like we need a "hard" flush before awaiting next command
		// !! check that it's not more markup fooling us
		// looks like we're being fooled...
		//	so we don't need flush?... but we need state?
  //flushOutput();
 "t;";
 */

/* Incomplete char entities:
"ab & de<br>";

"ab &a de<br>";

"ab &am de<br>";

"ab &amp de<br>";

"ab &ampp de<br>";

"ab &amp; de<br>";

"ab &ampp; de<br>";

"&";
inputKey();
inputKey();
"l";
inputKey();
inputKey();
"t";
inputKey();
inputKey();

"<a href=\"ab&amp;cd&amp.de&am.f&a.g&.h\">...</a>";

"<a href=\"&ab&amp; cd&amp de&am f&a & h\">...</a>";

"<a href=\"&amp \">amp</a>";

"<a href=\"&amp\">amp</a>";

"&amp;&amp&am&a&";

"&&";

// &&
"&";
flushOutput();
"&";

// &l&
"&l";
flushOutput();
"&";

"&";
flushOutput();
"lt";

"&lt";
flushOutput();
"X";

// <&
"&lt";
flushOutput();
"&";

"& ";

"&";

"<a>&</a>";

"<a href=\"&\">&</a>";

"<a href=\"&am\">am</a>"; 

"<a href=\"&amp\">amp</a>"; 

"&#x8+";
inputKey();
"a";
inputKey();

"&#6+";
inputKey();

"&#60+";
inputKey();

"&#8+";
inputKey();

"&foobar;";
inputKey();

"&#x.";
inputKey();
"a";

// <
"&#6";
inputKey();
"0;";

"a&gtcast;";
inputKey();

*/

//multiverse flush big 2016-10-0x:
/*
"reg";
flushOutput();
"ular. ";
flushOutput();
"regular. <";
flushOutput();
"b>bold.</";
flushOutput();
"b> regular. &g";
flushOutput();
"t;=&gt;. after";
*/

// adhoc extra nl bug(s) 2016-09-2x:
//"<p>Bedroom</p><BR HEIGHT=0>The bedroom...";

/*
	 "breed:";
	 "<BR HEIGHT=0>";
	 "</p>";
	 "<BR HEIGHT=0>";
	 "<ol>";
	 "Mutt";
	 "</ol>";
*/
/*
"<img src=unknown7.gif alt='7 Alt Text'>
<p>Text</p>
<img src=unknown8.gif alt='8 Alt Text'>";
*/
/*
"Meh
<p>Text before</p>
<img src=unknown.gif alt='Alt Text'>
<p>after</p>";
*/
//"Before<p>pg1</p><br height=0>After";
//"Before<p>pg1</p><br height=0>After";
//"Before<p>pg1</p><p>pg2</p>After";
//"before<table></table>between<table></table>after";
//"before<table><tr></tr></table>between<table><tr></tr></table>after";
//"before<table><tr><td>td</td></tr></table>between<table><tr><td>td</td></tr></table>after";
//"before<table></table>between<table></table>after<br><br>after2<br><br>after3";
//"before<ul><li>li11</li></ul>between<ul><li>li11</li></ul>after<br><br>after2<br><br>after3";
//"before<ol><li>li11</li></ol>between<ol><li>li11</li></ol>after<br><br>after2<br><br>after3";
//"before<h4>h41</h4>between<h4>h42</h4>after<br><br>after2<br><br>after3";
//"Before<p>pg1</p><p>pg2</p>After";
//"Before<p>pg1</p><p>og2</p>After";
//"<p>text1</p><br>text2";
//"before<h1>h11</h1>between<h1>h12</h1>after<br><br>after2<br><br>after3";
//"before<h1>h11</h1><h1>h12</h1>after<br><br>after2<br><br>after3";
//"before<bq>bq1</bq>nn<bq>bq2</bq>after<br><br>after2<br><br>after3";
//"before<bq>bq1</bq><bq>bq2</bq>after<br><br>after2<br><br>after3";
//"before<pre>pre1</pre><pre>pre2</pre>after<br><br>after2<br><br>after3";
//"before<div>div1</div><div>div2</div>after<br><br>after2<br><br>after3";
//"before<p>p1</p> <p>p2</p>after<br><br>after2<br><br>after3";
//"before<p>p1</p><p>p2</p>after<br><br>after2<br><br>after3";
//"text<p>text</p><p>text</p>text";
//"text<p>text</p>text";
//"<p>text</p><br height=0><br height=0>text";
//"<p>text</p>text";
//"<p>text</p><br height=0>text";
//"<p>text</p><br>text";
//"<p>text</p><br height=0><br>text";
//"<p>text</p><br height=0><br height=0><br height=0>\n<br>text";
//"<p>Text</p>";

/*
"<p>Para</p><big>big?</big><br>
Done.";
*/

/*
"<p>Para</p><small>small?</small><br>
<foo>foo?</foo><br>
Done.";
*/

//"<tab>1<tab align=right>2";

/*
	for (local i = 1; i <= 100; i++) {
		"Line <<i>>\n";
	}*/

//"line\b  \n  \b  other\nxxx\byyy";

//"line\n\b\n\bother\nxxx\byyy";

//"line\b\bother\nxxx\byyy";

/*
"line \n \b other line\n
xxx\byyy";
*/

/*
"\nline after slash n\n \n  \n
after 2x slash n";
*/

/*
"0\t1\t2\t3\t4\t5\t6<tab align=right>Right?<br>
0...";
//"0<tab>1<tab>2<tab>3<tab align=right>Right?<br>
//0...";
//"xxx<br>u <tab align=right> Right?<br>Text2<br>Text3<br>";
//"<p align=right>Right??</p>Text4";
*/

//"Text1<tab align=right> Right? <br>Text2<br>Text3";
//"Text1<tab align=right>Right??<tab align=left>Left??<br>
//Text2";

/*
"pre?
<pre>is      this
    pre?</pre>
after pre";
*/
/*
"before
<pre>pre-text\n
2nd p-t
</pre>
after";
	//TODO unit test variations: ws before/after 1st nl, ...
*/
/*
"before
<pre>
text";
*/

//"Foo<hr><BR HEIGHT=0>Bar";

/*
"Foo<hr>
<BR HEIGHT=0>
Bar";
	*/
	 
/*
"text
<hr>
text<br>
<br>
text<br>
text<br>
text<br>
<hr>
<hr>
<hr>
<br>

<p>text</p>
<hr>
<p>text</p>
";
*/

/*
"<p>para1</p>
<p>para2</p>
<p>para3</p>
text between
<p>para4</p>
text after...";
*/

//"<div>div1</div> <div>div2</div>";
//"<p>para1</p> <p>para2</p>";

/*
"<div>div1</div><div>div2</div>";

"<hr>";
"<p>para</p> zzz";
"<hr>";
"<p>para1</p><p>para2</p>";
"<hr>";
"line1<br>
line2<br><br>
line3";
*/

/*
"before
<pre>
text<p>own pg? <b>bold?</b>   after 3 spcs</p><p>other pg?</p>more text
</pre>
after";
*/

/*
"text<tt>tt text</tt>more text
<hr>

text<tt>
tt text
</tt>more text
<hr>

text
<tt>tt text</tt>
more text
<hr>

text
<tt>
tt text
</tt>
more text";
*/

//"<p>regular<b>bold</b> <i>italics</i></p>";

/*
"Text<h1>h1</h1><h2>h2</h2><h3>h3</h3><h4>h4</h4>text";
"<br>";
"Text<h1>h1</h1>text<h2>h2</h2>text<h3>h3</h3>text<h4>h4</h4>text";

//"Text<h1>h1</h1>text<h2>h2</h2>text<h3>h3</h3>text<h4>h4</h4>text";
//"Text<h1>H1</h1>Text<h1>H1</h1><p>p</p><h1>H1</h1>Text";
//"<p>p</p><h1>H1</h1><p>p</p>";
*/

/* div align attr bug:
"before div center<div align=center>hello</div>after div center<br>";
"before div right<div align=right>hello</div>after div right<br>";
"before div left<div align=left>hello</div>after div left<br>";
"before div<div>hello</div>after div<br>";
"<hr/>";
"before p center<p align=center>hello</p>after p center<br>";
"before p right<p align=right>hello</p>after p right<br>";
"before p left<p align=left>hello</p>after p left<br>";
"before p<p>hello</p>after p<br>";
*/

//"<p>hello</p>";
//"hey<p>hello</p>after";

//"<center>WARNING</center>";
//"<center>WARNING</center>Dedicated<br>";

//"a<div align=center>hello</div>after";

//"<ol><li>item1</li></ol>";


/*
<b>bold b.</b> after<br>
<b>bold b.</b>after<br>
<center>WARNING b</center> Dedicated<br>";
*/

/* mmm... behaves like qtads
"abc<br>
&nbsp; &nbsp;def<br>
 &nbsp; efg<br>
xyz";
*/
/*
for (local i = 0; i < 3; i++) {
	for (local j = 0; j < 10; j++) {
		"Before&#8194;&nbsp;After. ";
	}
}
*/

/*
for (local i = 0; i < 3; i++) {
	for (local j = 0; j < 5; j++) {
		"Before &nbsp;&nbsp;After. ";
	}
	//" ";
}
*/
/* Finding Martin unwanted indent bug:
"Before space nbsp After x 3:<br>";
for (local i = 0; i < 3; i++) {
	"Before &nbsp;After &nbsp;Before &nbsp;After &nbsp;Before &nbsp;After &nbsp;Before &nbsp;After &nbsp;Before &nbsp;After &nbsp;Before &nbsp;After &nbsp;Before &nbsp;After &nbsp;Before &nbsp;After &nbsp;Before &nbsp;After. &nbsp;";
	}
"<br>
<br>Before nbsp space After x 3:<br>";
for (local i = 0; i < 3; i++) {
	"Before&nbsp; After&nbsp; Before&nbsp; After&nbsp; Before&nbsp; After&nbsp; Before&nbsp; After&nbsp; Before&nbsp; After&nbsp; Before&nbsp; After&nbsp; Before&nbsp; After&nbsp; Before&nbsp; After&nbsp; Before&nbsp; After.&nbsp; ";
	}
*/
/*
"abNcd<br>
ab&#8194;cd<br>
abNcd<br>
ab cd";

"<br>
<br>Before (8194) After x 5:<br>";
for (local i = 0; i < 5; i++) {	
"Before&#8194;After. Before&#8194;After. Before&#8194;After. Before&#8194;After. Before&#8194;After. Before&#8194;After. Before&#8194;After. Before&#8194;After. Before&#8194;After. Before&#8194;After. Before&#8194;After. Before&#8194;After. ";
	}
*/

/* SH unwanted space at start of line bug:
showAbout();
"<br>";
sentences();
*/

/*
//local	name = 'WIP';
//byline = 'by Rune Berg'
//	htmlByline = 'by <a href="mailto:runeberg76@gmail.com">Rune Berg</a>'
local version = '0. Serial number 150101.';
local authorEmail = 'runeberg76@gmail.com' ;
local desc = 'A text adventure game.';
"<b>WIP</b><br>
<<desc>><br>
Copyright (c) 2015 by Rune Berg (<<authorEmail>>).<br>
Release <<version>>
<p>";
*/

/*
"Internet link with href and text: <a href=\"http://www.tads.org\">TADS site</a><br>";
"Internet link with href only: <a href=\"http://www.tads.org\"></a><br>";
"Link with text only: <a>Link text</a><br>";
"Link with empty href and text: <a href=\"\">Link text</a><br>";
"Command link with href and text: <a href=\"south\">South</a><br>";
"Command link with href only: <a href=\"south\"></a><br>";
*/
/*
	"Norwegian chars: æøå.\n";

  / * get the local display character set * /
  local cs = new CharacterSet(getLocalCharSet(CharsetDisplay));

  / *
   *  Check a few representative Cyrillic alphabetic characters
   *  (see http://www.unicode.org/charts/)
   * /
	local chars = '\u0410\u0411\u041a\u042f\0430\0431\u044f';
	"CharsetDisplay mappable with Cyrillic? ";
  if (cs.isMappable(chars)) {
  		"Yes: <<chars>>";
  	} else {
  		"No. ";
	}
	"\n";
	
	// trigger loading of bundled "charmap/cmaplib.t3r" resource file:
	local charSetNameList = ['MacRoman', 'CP1253', 'OldeNorseRunes', 'MacGreek', 'CP860', 'Latin-5'];
	for (local csn in charSetNameList) {
		local cs = new CharacterSet(csn);
		local supported = cs.isMappingKnown() ? 'yes' : 'no';		
		"<<csn>>: <<supported>>\n";
	}
*/

/*
for (local i = 0; i < 10000; i++) {
	//"<<i>>: Blah blah blach asada ad ad ad  dfd r trr t lk k æøå lkklkl.\n";
	//TODO 5 reg, 5 bold, 5 italics...
	local openTag;
	local closeTag;
	local m = i % 15;
	if (m <= 4) {
		openTag = '';
		closeTag = '';
	} else if (m <= 9) {
		openTag = '<b>';
		closeTag = '</b>';
	} else {
		openTag = '<i>';
		closeTag = '</i>';
	}
	"<<openTag>><<i>>: 1234567890. 1234567890. 1234567890. 1234567890. 1234567890. 1234567890.<<closeTag>>\n";
}*/

/*
for (local i = 1; i <= 100; i++) {
	"Short. Longer one. Much, much, much longer one. ";
}
*/

/*
for (local i = 1; i <= 100; i++) {
	local jBit = (i % 2 == 0 ? '' : ''); 
	"Line<<jBit>> <<i>><br>";  // j to attempt to "stretch" line
}*/

//"<p>regular<b>bold</b> <i>italics</i></p>";

//"This should be good grammar. This are bad the grammar. ";

//"<fnt>fnt? </";

// Font min/max prefs:
/*
"
<font face='TADS-Sans'>TADS-Sans</font><br>
<font size='7'>Size 7</font><br>
<font size='-2'>Size -2</font><br>
<font face='TADS-Sans' size='7'>TADS-Sans Size 7</font><br>
";
*/

// <img> handling
/*
	 "<img src=unknown3.gif alt='Other Alt Text'>
	 <img src=unknown4.gif alt='4 Alt Text'>
	 <img src=unknown5.gif alt='5 Alt Text'>
	 after";
*/

/*
"Text before
<img src=unknown.gif alt='Img Alt Text'>
after
<img src=unknown2.gif alt='Other Alt Text'>
<img src=unknown3.gif alt='Yet another Alt Text'>
";
*/

// "Closed Circles" h3/h4 bug
/*
"<h4>CLOSED CIRCLES<BR HEIGHT=0></h4> <h3>Part I</h3>";
*/

/*
"Before
<img src='../../image.gif' ></img>
after";
//"Before
//<img src=image.gif></img>
//after";
//<table cellspacing=0 cellpadding=5 width=400 height=400 background=.system/CoverArt.jpg>
*/

// basic table formatting:
/*
"
Text before table
<table cellspacing=0 cellpadding=5 >
<tr align=center> 
	<th colspan=2>th-1</th><th colspan=2>th-2</th><th colspan=2>th-3</th>
</tr> 
<tr> 
	<td>td-1-1</td><td>td-1-2</td><td>td-1-3</td> 
</tr> 
<tr> 
	<td>td-2-1</td>
	<td>td-2-2</td>
	<td>td-2-3</td> 
</tr> 
</table>
Text after table";
*/

// pseudo-tags:
/*
"para1<.p>para2<.p>para3";
*/

//"ab<.roomdesc>desc<./roomdesc>";

/*
"
regular size<p>
<font size=+3/>+3</font><p/>
regular size<p/>
<font size=+3 />+3</font><p>
regular size<p>
<font size=+3/ >+3</font><p>
regular size<p>
<font size=+3 / >+3</font><p>
regular size<p>
<font size=/>still regular?</font><p>
regular size<p>

<hr>

regular size<p>
<font size=+3\\>+3</font><p>
regular size<p>
<font size=+3 \\>+3</font><p>
regular size<p>
<font size=+3\\ >+3</font><p>
regular size<p>
<font size=+3 \\ >+3</font><p>
regular size<p>
<font size=\\>still regular?</font><p>
regular size<p>";


//"a<CENTER> <IMG SRC=\"title.jpg\"> </CENTER> <P> <BLOCKQUOTE> b<FONT";

//"Please type <uu href=Help> for instructions";
//"Please type <uu href=Help>HELP</uu> for instructions";
*/

/* ws around / in closing tag:

"text
<br>
new line
<br >
new line";

"<hr>";

"text
<br/>
new line
<br />
new line
<br/ >
new line
<br / >
new line";

"<hr>";

"text<br/>new line<br />new line<br/ >new line<br / >new line";

"<hr>";

"text<br>new line<br>new line<br>new line<br>new line";

"<hr>";

"text<br >new line<br >new line<br >new line<br >new line";

"<hr>

text</br>new line";
*/

// char entities in tag attributes:

/*
"regular size<p>
<font size=+&#51;>+3</font><p>
regular size<p>
<font size='+&#51;'>+3</font><p>
regular size<p>
<font size=\"+&#51;\">+3</font><p>
<hr>

"regular size<p>
<font size =+3>+3 bef</font><p>
regular size<p>
<font size= +3>+3 aft</font><p>
regular size<p>
<font size = +3>+3 around</font><p>
regular size<p>
<font color= size=+2>+2?</font><p>
regular size<p>

<hr>

regular size<p>
<font size=+3>+3</font><p>

<hr>
&#51; = 3
<hr>
hel <unknown z=3> lo";
*/

//"ab<x=";

//"<\<x";

//"regular<font size=+3>plus 3</font> more regular";

// Broken html tag cases:
//		find if HTML removes everything between < and > for broken tag:

/* YES:
"mm<h( s=2>rest";
*/
/* YES:
"io< more asas asas <b>bold?<br>
Resuming normal <b>bold</b> text...";
*/
/* YES:
"io< more asas asas <b>bold?";
*/
/* YES:
"io<more asas asas <b>bold?";
*/
/* YES:
"io<more";
"yes?";
*/
/* YES:
"jui<  a <b>bold?</b>";
*/
/* YES:
"hep <a<b>bold?</b>";
*/
/* YES:
"100: Some extended characters: < (tm) (c) (R) >";
"<br>";
"< b>text</b>";
*/
/* YES:
[W] [XTOutputTextParserHtml] parse: (state 3) unexpected character ' ' at index 32
*/
//.............

/*
"<center>WARNING b.</center> Dedicated<br>
<b>bold b.</b> after<br>
<b>bold b.</b>after<br>";
*/

/*
// bug? redeye.gam font sizes:

"
<font size=4 face='lucida console, courier new, Tads-fixedwidth'><tt>This is size 4<br>
<font size=1>This is size 1</font><br>
<font size=3>This is size 3</font><br>
<font size=3>THIS IS size 3</font><br>
<font size=3>*** WARNING:  CONTAINS SOME BAD LANGUAGE AND VIOLENCE ***</font><br>
Is this size 4?
";
*/

/*
"
<font size=4 face='lucida console, courier new, Tads-fixedwidth'><tt>This is size 4<br>
<font size=1>This is size 1</font><br>
<font size=3>This is size 3</font><br>
Is this size 4?
";
*/

/*
"<font face='lucida console, courier new, Tads-fixedwidth' size='4'><tt>";
"***BBBBBRRRRRRRROOOOOOOOOOOOOOOOOOOOAAAWWWWRRRRrrrrrrrrr*** You're awakened";
"<font>";
"<BR HEIGHT=0>";
"<font size=1><b>";
"<BR HEIGHT=0>";
"<BR>RRRRRRRRRR&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;EEEEEEEEEEEE";
"<BR HEIGHT=0>";
"</b></font><font size=3>";
"<BR>*** WARNING:  CONTAINS SOME BAD LANGUAGE AND VIOLENCE ***";
"<BR> </font><font>REDEYE (c) John Pitchers 2004.";
"<br><font>Before starting please";
"</font></b>";
"<BR><br></font><b><font>Car park of the Royal Hotel</font></b>";
*/

/* for testing os_sleep_ms:
"Line 1\n";
"Waiting 1s ...\n";
timeDelay(1000);
"Waiting 2s ...\n";
timeDelay(2000);
"Waiting 5s ...\n";
timeDelay(5000);
"Waiting 10s ...\n";
timeDelay(10000);
"Done\n";
 */
 
/* (solved?) bug: more prompt in middle of line:

"There are a couple of important distinctions we need to draw here.
First, note that we're not interested in what the player character thinks; we're interested in what the player thinks. Whatever theory anyone has about the relationship between player and player character, there's no question that it's the player typing those commands, so our job parsing the input is to understand the meaning the player meant to convey.
<p>
Second, we're especially not interested in what the author thinks, or what the \"narrator\" thinks, or what the parser thinks, or what an omiscient observer who can look at all of the object properties thinks. This is a key point to understand and to keep in mind while writing your game, because it's sometimes easy to forget about the player and think instead in terms of the objective reality (so to speak) of the game world.
For example, if a particular key opens a particular door, it's easy to fall into the trap of thinking that that particular key ought to be a more logical match for UNLOCK DOOR WITH KEY than any other key. That's the \"objective reality\" trap: the key is in fact the correct one for the action, but that doesn't matter - the only thing that matters is whether or not the player knows this. If the player doesn't know it, then there's no reason to assume that the player means that key over any other.
<p>
(The library has a Key class that operates on exactly this principle. Initially, one key is pretty much like any other. Once the player has successfully used a particular key to open a particular door, though, the library remembers that successful combination, on the assumption that the player will also duly note and remember the combination. On future attempts, the key that the player used successfully will be considered the most likely one in cases of ambiguity.)
<p>
Another example, roughly the opposite of the previous one: there's a door. It looks perfectly ordinary, but unbeknownst to the player, it's actually a fake door, cleverly constructed to look exactly like a real door, but not openable. Should OPEN DOOR be ruled out as illogical? No, because the player has no way of knowing that the door's a fake. If the fake is so convincing that even attempting to open it would not reveal its falsity (maybe it just looks like a real door that's stuck, for example), then it would still not be illogical to try opening it again and again. Only when the player finds out that the door isn't actually a door - maybe by inspecting it more closely, or by being told by a character in the game - will OPEN DOOR stop making sense to the player.
<p>
You don't actually need to know much HTML to use multimedia TADS, since the normal TADS formatting sequences (\b, \n, \t, and so on) work the same way in multimedia TADS as they do in the standard TADS. In fact, you may want to continue to use the standard TADS formatting sequences wherever you can, since this will make it easier to move your game to the standard TADS system if you decide to do so at some point.
<p>
However, you will need to learn HTML to the extent that you want to use HTML features with TADS. An HTML tutorial and reference is, as they say, beyond the scope of this document. Fortunately, one of the benefits of HTML's popularity is a copious supply of documentation. You should have no problem finding a book on HTML for almost any level of expertise at your local bookstore, and a great deal of introductory and reference information is available free on the web.
<p>
For the most part, you should be able to apply your knowledge of standard HTML to writing games with multimedia TADS; most of the tags related to formatting work the same as they would in any other HTML renderer.
<p>
However, there are a number of areas where multimedia TADS differs from standard HTML, particularly with tags that define the document structure, and you'll eventually want to familiarize yourself with these differences as you start to use the more advanced features; refer to appendix H, Multimedia TADS Deviations from Standard HTML for complete details.
";
*/

/*
// solved bug: spec2text extra spaces
"
sq: \ stop.<br>
1234567890123456789012345678901234567890123456789012345678901234567890.<br>
qs:\  stop.<br>
1234567890123456789012345678901234567890123456789012345678901234567890.<br>
sqq: \ \ stop.<br>
1234567890123456789012345678901234567890123456789012345678901234567890.<br>
sqsq: \  \ stop.<br>
1234567890123456789012345678901234567890123456789012345678901234567890.<br>
sqs: \  stop<br>
1234567890123456789012345678901234567890123456789012345678901234567890.<br>
qsq:\  \ stop<br>
1234567890123456789012345678901234567890123456789012345678901234567890.<br>
qssq:\   \ stop<br>
1234567890123456789012345678901234567890123456789012345678901234567890.<br>
qsssq:\    \ stop<br>
1234567890123456789012345678901234567890123456789012345678901234567890.<br>
sqqqs: \ \ \  stop<br>
1234567890123456789012345678901234567890123456789012345678901234567890.<br>
sqqsqs: \ \  \  stop<br>
1234567890123456789012345678901234567890123456789012345678901234567890.<br>
";
return;

    local strs = [
        'We have some   unquoted spaces   in this one.',
        'We have some \ \ quoted spaces \ \ in this one.'
        //'Mixing \  \  quoted and \ \   \   unquoted spaces.',
    ];

    local st = new TadsObject();
    foreach (local str in strs)
    {
        "Src:\ \ <<quoteAll(str)>><br>
        Disp: <<str.htmlify()>><br>
        s2t:\ \ <<quoteAll(str.specialsToText(st))>><br><br>";
    }
*/
/*
// Caps/no-caps flags:
"\^<a href='testing'><i>hello</i></a>\n";
"\v<a href='testing'><i>HELLO</i></a>\n";
return;
*/
}

quoteAll(str)
{
    return str.htmlify().findReplace(
        ['\n',  '\b',  '\t',  ' ',  '\ ',   '\v',  '\^'],
        ['\\n', '\\b', '\\t', '\ ', '\\\ ', '\\v', '\\^']);
}
