#! /bin/ksh

# todo: bug for some reason, this script dies if there are single quotes in guide.db
#       It may have had more to do with the eating section exceedings 10,000 chars!

t='
	<h2 id="%ident" class="guide">%title</h2>
	<p> %text </p>
	<div class="funfact"><b> Fun Fact:</b> %fact</div>
'

toc='<li><a href="#%ident">%title</a> (updated: %update)</li>'
toc='
	<tr><td nowrap="nowrap">
		<a href="#%ident">%title</a>
		</td><td class="tocstyle">
		 %update
		 </td></tr>
'

echo "<!-- generated by genguide $1 -->"
# echo "<h2>Gary Perlman's CHI Guide to Montreal</h2>"
echo '<p><img src="images/mtls.jpg" alt="" title="Panoramic view of downtown Montreal from the Mount Royal Lookout - by David Segelstein" height='172' width='640'/></p>'

echo '<p>
	This visitor travel guide was originally written for a 
	<a target="mtl" href="http://chi2006.org/">conference</a>
	at the Palais des Congr&egrave;s, the Montreal Convention Centre,
	but people still visit,
	so it will stay online and get occasional updates.
		<!--
	such as for:
	<ul>
		<li>June 24: 
			<a target="mtl" href="http://www.fetenationale.qc.ca/"
				>La F&ecirc;te nationale du Qu&eacute;bec</a>
				(St. Jean Baptiste Day)
		</li>
		<li>July 1:
			<a target="mtl" href="http://www.canadianheritage.gc.ca/special/canada/11/canada_e.cfm"
				>Canada Day</a>
		</li>
		<li>June 28-July 6:
			<a target="mtl" href="http://www.montrealjazzfest.com/Fijm2007/accueil_en.aspx"
				><b>Festival de Jazz</b></a> (music)
		</li>
		<li>June 20-July 28:
			<a target="mtl" href="http://www.internationaldesfeuxloto-quebec.com/index_en.php"
				><b>International Fireworks</b></a>
		</li>
		<li>July 8-29 (English 12-22):
			<a target="mtl" href="http://www.hahaha.com/comedy-2007.html"
				><b>Juste pour rire / Just for Laughs</b></a> (comedy)
		</li>
	</ul>
		-->
	<p>
	<b>
	Try the
	<a target="mtl"
		href="http://maps.google.com/maps/ms?f=q&amp;layer=&amp;ie=UTF8&amp;om=1&amp;msa=0&amp;hl=en&amp;msid=109597231859675089422.0000011204fa04554f835"><img border="0" align="middle" src="images/google75x32.gif" height="32" width="75" alt="Google"/> Map for this Guide!</a>
	</b>
	</p>
	'

echo "
<table border='0' cellpadding='0' cellspacing='0' width='100%'>
<tr valign='top'><td nowrap='nowrap'>
<table border='0' cellpadding='1' cellspacing='0'>"
echo "<tr bgcolor='#CCCCCC'><th align='left'>Table of Contents, eh?</th>
	<th align='center'>Updated</th></tr>"
sssearch status=released $1 |
	ssformat -t "$toc"
echo '</table>
</td><td style="padding: 0 1cm 0 1cm; font-size: 100%">'

echo "<b>Conditions:</b>"
sssearch status=active conditions.db | ssformat -t %desc

echo '
	| <a href="http://www.wunderground.com/cgi-bin/findweather/getForecast?query=montreal+quebec" target="mtl"
		class="nobr">Weather Underground</a>
	- <a href="http://www.weather.com/outlook/travel/businesstraveler/local/CAXX0301" target="mtl"
		class="nobr">Weather.com</a>
	- <a target="mtl" href="http://wwwa.accuweather.com/radar-large.asp?partner=accuweather&amp;myadc=0&amp;traveler=0&amp;zipcode=&amp;level=regional&amp;site=NE&amp;anim=loop&amp;type=SIR"
		title="a good map for weather COMING INTO Montreal."
		class="nobr">NE AccuWeather map</a>
	- <a target="mtl" href="http://wwwa.accuweather.com/canada-radar-large.asp?partner=accuweather&amp;myadc=0&amp;traveler=0&amp;postalcode=H4B%201W8&amp;site=qb_&amp;anim=LOOP&amp;type=SIR"
		title="Montreal is in southeastern Quebec, so the Quebec weather map shows WHAT WAS in Montreal, not WHAT WILL BE."
		class="nobr">QC AccuWeather map</a>
	| 
	<a target="mtl" href="http://www.inforoutiere.qc.ca/en/cameras/montreal/index.asp"
		title="Traffic Cams">Traffic</a>
	- <a target="mtl" href="http://www.canada.com/cityguides/montreal/traffic/"
		title="Traffic Cams from canada.com">Alternate site</a>
	<p>
	<b>Money Tip:</b>
	Some credit cards charge a lot to convert from Canadian,
	but you can come to Canada with US dollars and you will tend
	to get a favourable
	<a href="http://finance.yahoo.com/q/bc?s=CADUSD=X&amp;t=5d&amp;l=off&amp;z=m&amp;q=l&amp;c=" target="mtl"
		>exchange rate</a> everywhere.
	In any case, Canadian banks are much better at handling US funds than
	US banks are at handling Canadian.
</td></tr>
</table>
'

sssearch status=released $1 | 
	ssformat -t "$t"

exit
%todo Canadian Tire Money.
%notes TODO: UniversitY
A Voyage East : A Wilderness Guide to East-End Montreal
	- Mike Boone
Les Dialogues
	- Josh Freed
Le Instant French : It's Just English 
---
A VOYAGE EAST : A Wilderness Guide to East-End Montreal
	- Mike Boone
LES DIALOGUES
	- Josh Freed
LE INSTANT FRENCH : It's Just English in Disguise
	- Stephen Phizicky
PRAYER OR PROFANITY? A Guide to Cursing in Quebecois
	- Gerry Bergeron
JOINING THE GENTRY
	- Elaine Shatenstein
BRINGING UP BEBE : Why Does My Child Sound Like a French Garage Mechanic?
	- Victor Dabby
	- David Sherman
FUNCTIONING AS A FONCTIONNAIRE : On Becoming One of the Six English-Language Civil Servants in Quebec
	- Josh Freed
SPECIAL REFUGEE SECTION
	ADOPT AN ANGLO FOSTER PARENT PLAN
		- Jon Kalina
	LETTERS HOME
		- Karl Nerenberg
		- Ron Blumer
		- Les Nirenberg
		- Eleanor Wachtel
	CAR WARS How to Cross a Montreal Street ... and Live
	THE DIARY OF IAN FRANK A Ghost Story for Refugee Children
		- Jon Kalina
THE GUARDIAN ANGLOS
	LA PETITE HISTOIRE DU QUEBEC (Version Anglaise)
		- Nick Auf der Maur
	AN ENGLISH-SPEAKING STREET GUIDE TO FRENCH MONTREAL
	PARADISE LOST
	WALKING BACKWARD A Unilingual Tour of Downtown Montreal 	
		- Kathryn O'Hara
	SIGNING OFF
	TREASON IN THE TOWNSHIPS A Tale of Two Toponymies
		- Charles Bury
	TEST YOUR A.Q. (ANGLO QUOTIENT) Are You Licensed to Speak English?
	 	- Graeme Decarie
STEPPING H'OUT
	- Wayne Grigsby
	- Katie Malloch
LE JACQUES STRAP : How to Become a French Athletic Supporter
	- Michael Farber
	- Mike Boone
LE JOUAL : The True Story ... Finally Told in English
	- Gerry Bergeron
aE MOT FINAL : From One Minority to Another
	- Serge Grenier
THE ANGO INTEGRATION QUIZ
