Permalink
Browse files

Reorganize the summary rendering

  • Loading branch information...
1 parent 11a7a0f commit 0a5c576a722ddb1201ca63d31e3ab627cb287c80 @cbonte committed Nov 3, 2012
Showing with 57 additions and 32 deletions.
  1. +7 −2 css/page.css
  2. +6 −0 haproxy-dconv.py
  3. +42 −0 templates/summary.html
  4. +2 −30 templates/template.html
View
@@ -122,7 +122,7 @@ pre.arguments {
.sidebar-nav b {
font-size: 13px;
}
-a small {
+small {
color: #888;
}
.level1 {
@@ -132,6 +132,9 @@ a small {
border-left: 1px solid #ccc;
padding-left: 10px;
}
+.tab {
+ padding-left: 20px;
+}
.keyword {
font-family: Menlo, Monaco, "Courier New", monospace;
white-space: pre;
@@ -168,7 +171,9 @@ h5 {
border-bottom: 1px solid #ccc;
margin-bottom: 18px;
}
-
+.noheight {
+ min-height: 0 !important;
+}
.separator {
margin-bottom: 18px;
}
View
@@ -277,6 +277,12 @@ def convert(infile, outfile):
print >> sys.stderr, "Parsing chapter %s..." % title
if title == "Summary":
+ summaryTemplate = pctxt.templates.get_template('summary.html')
+
+ documentAppend(summaryTemplate.render(
+ chapters = chapters,
+ chapterIndexes = chapterIndexes,
+ ))
continue
if title:
View
@@ -0,0 +1,42 @@
+<div class="page-header">
+ <h1>Summary</h1>
+</div>
+<div class="row-fluid">
+ <div class="span6">
+ <% previousLevel = None %>
+ % for k in chapterIndexes:
+ <% chapter = chapters[k] %>
+ % if chapter['title']:
+ <%
+ if chapter['level'] == 1:
+ otag = "<b>"
+ etag = "</b>"
+ else:
+ otag = etag = ""
+ %>
+ % if chapter['chapter'] == '7':
+ ## Quick and dirty hack to split the summary in 2 columns
+ ## TODO : implement a generic way split the summary
+ </div><div class="span6">
+ <% previousLevel = None %>
+ % endif
+ % if otag and previousLevel:
+ <br />
+ % endif
+ <div class="row-fluid">
+ <div class="span1 pagination-right noheight">${otag}<small>${chapter['chapter']}.</small>${etag}</div>
+ <div class="span11 noheight">
+ % for tab in range(1, chapter['level']):
+ <div class="tab">
+ % endfor
+ <a href="#${chapter['chapter']}">${otag}${chapter['title']}${etag}</a>
+ % for tab in range(1, chapter['level']):
+ </div>
+ % endfor
+ </div>
+ </div>
+ <% previousLevel = chapter['level'] %>
+ % endif
+ % endfor
+ </div>
+</div>
View
@@ -37,42 +37,14 @@
</div>
</div>
</div>
-
+
<form class="well form-search" onsubmit="if (this.keyword.value) window.location.hash=this.keyword.value; return false">
<label>Search keyword:</label>
<input type="text" name="keyword" class="span3 search-query" style="margin: 0 auto;" data-provide="typeahead" data-source='["${'","'.join(keywords)}"]' autocomplete="off"/>
<input class="btn btn-primary" type="submit" value="Go"/>
</form>
- <div class="row">
- <div class="span3">
- <div class="sidebar-nav">
- <ul class="nav nav-list">
- <li class="nav-header">Summary</li>
- <% level = 0 %>
- % for k in chapterIndexes:
- <% chapter = chapters[k] %>
- % if chapter['title']:
- <%
- if level != chapter['level'] and chapter['level'] == 1:
- otag = "<b>"
- etag = "</b>"
- else:
- otag = etag = ""
- %>
- % if otag:
- <li class="divider"></li>
- % endif
- <li><a href="#${chapter['chapter']}">${otag}<small>${chapter['chapter']}.&nbsp;</small>${chapter['title']}${etag}</a></li>
- % endif
- % endfor
- </ul>
- </div>
- </div>
- <div class="span9">
- ${document}
- </div>
- </div>
+ ${document}
</div>
<script src="js/jquery.min.js"></script>
<script src="bootstrap/js/bootstrap.min.js"></script>

0 comments on commit 0a5c576

Please sign in to comment.