Author: Apollon Oikonomopoulos <apoikos@debian.org>
Date:   Sun Apr 27 11:56:44 2014 +0300

    dconv: debianize
    
     - Use Debian bootstrap and jquery packages
     - Add Debian-related resources to the template
     - Use the package's version instead of HAProxy's git version
     - Move all assets under static/

diff --git a/debian/dconv/haproxy-dconv.py b/debian/dconv/haproxy-dconv.py
index a43907c..3185b94 100755
--- a/debian/dconv/haproxy-dconv.py
+++ b/debian/dconv/haproxy-dconv.py
@@ -44,16 +44,11 @@ VERSION = ""
 HAPROXY_GIT_VERSION = False
 
 def main():
-    global VERSION, HAPROXY_GIT_VERSION
-
-    VERSION = get_git_version()
-    if not VERSION:
-        sys.exit(1)
+    global HAPROXY_GIT_VERSION
 
     usage="Usage: %prog --infile <infile> --outfile <outfile>"
 
     optparser = OptionParser(description='Generate HTML Document from HAProxy configuation.txt',
-                          version=VERSION,
                           usage=usage)
     optparser.add_option('--infile', '-i', help='Input file mostly the configuration.txt')
     optparser.add_option('--outfile','-o', help='Output file')
@@ -63,7 +58,7 @@ def main():
         optparser.print_help()
         exit(1)
 
-    HAPROXY_GIT_VERSION = get_haproxy_git_version(os.path.dirname(option.infile))
+    HAPROXY_GIT_VERSION = get_haproxy_debian_version(os.path.dirname(option.infile))
 
     convert(option.infile, option.outfile)
 
@@ -108,6 +103,15 @@ def get_haproxy_git_version(path):
     version = re.sub(r'-g.*', '', version)
     return version
 
+def get_haproxy_debian_version(path):
+    try:
+        version = subprocess.check_output(["dpkg-parsechangelog", "-Sversion"],
+                                          cwd=os.path.join(path, ".."))
+    except subprocess.CalledProcessError:
+        return False
+
+    return version.strip()
+
 def getTitleDetails(string):
     array = string.split(".")
 
@@ -447,7 +451,6 @@ def convert(infile, outfile):
             keywords = keywords,
             keywordsCount = keywordsCount,
             keyword_conflicts = keyword_conflicts,
-            version = VERSION,
             date = datetime.datetime.now().strftime("%Y/%m/%d"),
 	)
     except TopLevelLookupException:
@@ -463,7 +466,6 @@ def convert(infile, outfile):
             keywords = keywords,
             keywordsCount = keywordsCount,
             keyword_conflicts = keyword_conflicts,
-            version = VERSION,
             date = datetime.datetime.now().strftime("%Y/%m/%d"),
             footer = footer
     )
diff --git a/debian/dconv/templates/parser/table/row.tpl b/debian/dconv/templates/parser/table/row.tpl
index 16f4d7b..d92bd18 100644
--- a/debian/dconv/templates/parser/table/row.tpl
+++ b/debian/dconv/templates/parser/table/row.tpl
@@ -5,13 +5,13 @@
 <%
     if data in ['yes']:
         style = "class=\"alert-success pagination-centered\""
-        data = 'yes<br /><img src="css/check.png" alt="yes" title="yes" />'
+        data = 'yes<br /><img src="static/check.png" alt="yes" title="yes" />'
     elif data in ['no']:
         style = "class=\"alert-error pagination-centered\""
-        data = 'no<br /><img src="css/cross.png" alt="no" title="no" />'
+        data = 'no<br /><img src="static/cross.png" alt="no" title="no" />'
     elif data in ['X']:
         style = "class=\"pagination-centered\""
-        data = '<img src="css/check.png" alt="X" title="yes" />'
+        data = '<img src="static/check.png" alt="X" title="yes" />'
     elif data in ['-']:
         style = "class=\"pagination-centered\""
         data = '&nbsp;'
diff --git a/debian/dconv/templates/template.html b/debian/dconv/templates/template.html
index 21e6ff2..abf5488 100644
--- a/debian/dconv/templates/template.html
+++ b/debian/dconv/templates/template.html
@@ -3,44 +3,27 @@
 	<head>
 		<meta charset="utf-8" />
 		<title>${headers['title']} ${headers['version']} - ${headers['subtitle']}</title>
-		<link href="bootstrap/css/bootstrap.min.css?${version}" rel="stylesheet" />
-		<link href="css/page.css?${version}" rel="stylesheet" />
+		<link href="static/bootstrap.min.css" rel="stylesheet" />
+		<link href="static/page.css" rel="stylesheet" />
 	</head>
 	<body>
-		<div class="navbar navbar-fixed-top navbar-inverse">
+		<div class="navbar navbar-fixed-top navbar-inverse navbar-top">
 			<div class="navbar-inner">
 				<div class="_container">
 					<a class="brand" href="#">${headers['title']} ${headers['subtitle']} <small>${headers['version'].replace("version ", "")}</small></a>
 					<ul class="nav">
-						<li class="divider-vertical"></li>
 						<li><a href="http://haproxy.1wt.eu/">HAProxy home page</a></li>
 						<li class="dropdown">
 							<a href="#" class="dropdown-toggle" data-toggle="dropdown">
-								Versions
+								Debian resources
 								<b class="caret"></b>
 							</a>
 							<ul class="dropdown-menu">
-								## TODO : provide a structure to dynamically generate per version links
-								<li class="dropdown-submenu">
-									 <a tabindex="-1" href="#">HAProxy 1.4</a>
-									 <ul class="dropdown-menu">
-										<li><a href="configuration-1.4.html">Configuration Manual</a></li>
-										<li class="divider"></li>
-										<li><a href="http://git.1wt.eu/git/haproxy-1.4.git/">GIT Repository</a></li>
-										<li><a href="http://haproxy.1wt.eu/git/?p=haproxy-1.4.git">Browse repository</a></li>
-										<li><a href="http://haproxy.1wt.eu/download/1.4/">Browse directory</a></li>
-									</ul>
-								</li>
-								<li class="dropdown-submenu">
-									 <a tabindex="-1" href="#">HAProxy 1.5</a>
-									 <ul class="dropdown-menu">
-										<li><a href="configuration-1.5.html">Configuration Manual</a></li>
-										<li class="divider"></li>
-										<li><a href="http://git.1wt.eu/git/haproxy.git/">GIT Repository</a></li>
-										<li><a href="http://haproxy.1wt.eu/git/?p=haproxy.git">Browse repository</a></li>
-										<li><a href="http://haproxy.1wt.eu/download/1.5/">Browse directory</a></li>
-									</ul>
-								</li>
+								<li><a href="https://bugs.debian.org/src:haproxy">Bug Tracking System</a></li>
+								<li><a href="https://packages.debian.org/haproxy">Package page</a></li>
+								<li><a href="http://tracker.debian.org/pkg/haproxy">Package Tracking System</a></li>
+								<li class="divider"></li>
+								<li><a href="http://anonscm.debian.org/gitweb/?p=pkg-haproxy/haproxy.git">Package Git Repository</a></li>
 							</ul>
 						</li>
 					</ul>
@@ -71,7 +54,7 @@
 					The feature is automatically disabled when the search field is focused.
 				</p>
 				<p class="text-right">
-					<small>Converted with <a href="http://github.com/cbonte/haproxy-dconv">haproxy-dconv</a> v<b>${version}</b> on <b>${date}</b></small>
+					<small>Converted with <a href="http://github.com/cbonte/haproxy-dconv">haproxy-dconv</a> on <b>${date}</b></small>
 				</p>
 			</div>
 		</div>
@@ -81,9 +64,8 @@
 					<div class="well pagination-centered">
 						<h1>${headers['title']}</h1>
 						<h2>${headers['subtitle']}</h2>
-						<p><strong>${headers['version']}</strong></p>
+						<p><strong>${headers['version']} (Debian)</strong></p>
 						<p>
-							<a href="http://haproxy.1wt.eu/" title="HAProxy Home Page"><img src="http://haproxy.1wt.eu/img/logo-med.png" /></a><br>
 							${headers['author']}<br>
 							${headers['date']}
 						</p>
@@ -94,8 +76,8 @@
 			</div>
 		</div>
 
-		<script src="js/jquery.min.js?${version}"></script>
-		<script src="bootstrap/js/bootstrap.min.js?${version}"></script>
+		<script src="static/jquery.min.js"></script>
+		<script src="static/bootstrap.min.js"></script>
 
 		<script>
 			/* Keyword search */
