#!/usr/bin/ruby
html = <<EOF
Content-type: text/html; charset=ISO-8859-1\n\n
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta name="generator" content="HTML Tidy for Mac OS X (vers 1st December 2004), see www.w3.org">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="expires" content="Mon, 3 Jan 2000 08:00:00 GMT">
<meta http-equiv="cache-control" content="no-cache, must-revalidate">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Cobb County Government</title>
<style type="text/css">
/*<![CDATA[*/

body,td,th {
font-family: Geneva, Arial, Helvetica, sans-serif;
color: #000000;
}

body {
margin-top: 0px;
}
.caselist {font-size: 12pt;
margin-left: 10px;
line-height: 14px;
font-family: Arial, Helvetica, sans-serif;
font-style: bold; 
}
.left-margin {
padding-top:4px;
padding-left:6px;
}

.dept {
padding: 10px 10px 10px 10px;
}

.content-margin {
padding-top:10px;
padding-left:4px;
}

.right-margin {
padding-top:6px;
padding-right :0px;
}

.style001 {
font-size: 8pt;
color: #000000;
font-family: Geneva, Arial, Helvetica, sans-serif;
}

.style01 {
font-size: 9pt;
color: #000000;
font-family: Geneva, Arial, Helvetica, sans-serif;
}

.style1 {
font-size: 9pt;
font-weight:bold;
color: #999999;
font-family: Geneva, Arial, Helvetica, sans-serif;
}

.style2 {font-size: 10pt;
color: #000000;
font-family: Geneva, Arial, Helvetica, sans-serif;
}

.style3b {font-size: 12pt;
font-weight: bold;
color: #000099;
font-family: Geneva, Arial, Helvetica, sans-serif;
}

.cutline {font-size: 8pt;
margin-left: 10px;
color: #333333;
line-height: 11px;
font-family: Geneva, Arial, Helvetica, sans-serif;
}
.title {font-size: 14pt;
font-weight: bold;
color: #000099;
font-family: Geneva, Arial, Helvetica, sans-serif;
}

a{ 
color: #000099;
font-size: 12px;
text-decoration: none;
font-family: Geneva, Arial, Helvetica, sans-serif;
padding: 0px;
}
a:hover {
color: #0033FF;
font-size: 12px;
text-decoration: underline;
font-family: Geneva, Arial, Helvetica, sans-serif;
padding: 0px;
}
a:active {
color: #000099;
font-size: 12px;
text-decoration: none;
font-family: Geneva, Arial, Helvetica, sans-serif;
padding: 0px;
}
a:visited {
font-size: 12px;
font-family: Geneva, Arial, Helvetica, sans-serif;
padding: 0px;
}


a.left-menu {
line-height: 20px;
font-size: 11px;
color: #000099;
text-decoration: none;
}
a.left-menu:visited {
line-height: 20px;
font-size: 11px;
text-decoration: none;
color: #000099;
}
a.left-menu:hover {
line-height: 20px;
font-size: 11px;
text-decoration: underline;
color: #000099;
}
a.left-menu:active {
line-height: 20px;
font-size: 11px;
text-decoration: none;
color: #000099;
}

a.adv {
font-size: 10px;
color: #000099;
text-decoration: none;
}
a.adv:visited {
font-size: 10px;
color: #000099;
text-decoration: none;
}
a.adv:hover {
font-size: 10px;
color: #000099;
text-decoration: none;
text-decoration: underline;
}
a.adv:active {
font-size: 10px;
color: #000099;
text-decoration: none;
}

a.footer-link { 
color: #FFFFFF;
font-size: 10px;
text-decoration: none;
font-family: Geneva, Arial, Helvetica, sans-serif;
}
a.footer-link:hover {
color: #FFFFFF;
font-size: 10px;
text-decoration: none;
font-family: Geneva, Arial, Helvetica, sans-serif;
}
a.footer-link:active {
color: #FFFFFF;
font-size: 10px;
text-decoration: none;
font-family: Geneva, Arial, Helvetica, sans-serif;
}
a.footer-link:visited {
color: #FFFFFF;
font-size: 10px;
text-decoration: none;
font-family: Geneva, Arial, Helvetica, sans-serif;
}
.footer-text {
font-size: 10px;
color: #FFFFFF;
font-family: Geneva, Arial, Helvetica, sans-serif;
}
/*]]>*/
</style>
</head>
<body>
<!-- start deptcontent -->
      <br>
      <span class="title">Online Zoning Analysis</span>
      <hr align="left" width="96%">
      <span class="style01"><strong>Zoning analysis information is provided in PDF format. Depending on your Internet connection speed, these files may take several minutes to download and display.</strong> <br>
      <br>
      This information is preliminary and subject to change. Any questions regarding these applications should be directed to the Zoning Division at (770) 528-2004.<br>
      <br>
      <br>
      ******* ALL VARIANCE DOCUMENTS FOR <!--DATE--> *******<br>
      <br>
      <!--CONTENT-->
      </span>
      <br>
      <br>
      <span class="style01">******* END OF DOCUMENT LIST *******</span><br>
      <br>
      <!-- end deptcontent -->
</body>
</html>

EOF

date = "NOVEMBER 2017"
#                Name                      Directory
directories = [{'Preliminary Variance Documents' => 'preliminary'},
               {'Final Variance Documents' => 'final'}]

content = String.new 
directories.each do |hash|
  catagory = hash.keys[0]
  directory_name = hash.values[0]
  content << "<b>#{catagory}</b><br>"
  directory = Dir.new(directory_name)
  content << "No files in this section at this time<br>" if directory.max == '..'
  directory.each do |filename|
    unless (filename == '.') or (filename == '..')
      content << "<a href='#{directory_name}/#{filename}'>#{filename}</a><br>"
    end
  end
  directory.close
  content << '<br><br>'
end

print html.gsub('<!--CONTENT-->',content).gsub('<!--DATE-->',date)
