Commits

Steve Losh committed 14a2c27

Moar.

  • Participants
  • Parent commits e051cdc

Comments (0)

Files changed (3)

File bookmarkdown/bookmarkdown

     with open(target, 'w') as f:
         f.write(out)
 
-def _build_index_file():
+def _build_index_file(chapters):
     source = 'introduction.markdown'
 
     if not os.path.exists(source):
     with open(source, 'r') as f:
         content = markdown.markdown(f.read())
 
-    out = env.get_template('splash.html').render(content=content)
+    out = env.get_template('splash.html').render(content=content, chapters=chapters)
     target = join('build', 'html', 'index.html')
 
     with open(target, 'w') as f:
 
     _copy_static()
 
-    _build_index_file()
     _build_html_file('acknowledgements', 'single')
     _build_html_file('license', 'single')
     _build_html_file('preface', 'single')
 
+    chapters = []
     for filename in os.listdir('chapters'):
         if filename.endswith('.markdown'):
-            _build_html_file(join('chapters', filename.rsplit('.')[0]), 'chapter')
+            name = filename.rsplit('.')[0]
+            _build_html_file(join('chapters', name), 'chapter')
+            chapters.append(name)
 
-def _build_pdf():
-    mkdirs(join('build', 'pdf'))
+    _build_index_file(chapters)
 
 
 # Commands -------------------------------------------------------------------------
 @baker.command
-def pdf():
-    '''Build the PDF version of the book.'''
-    _build_pdf()
-
-@baker.command
 def html():
     '''Build the HTML version of the book.'''
     _build_html()
 def build():
     '''Build all versions of the book.'''
     _build_html()
-    _build_pdf()
 
 @baker.command
 def serve(address='127.0.0.1', port=8000):

File bookmarkdown/static/styles/style.less

 }
 html, body {
     font: normal 16px/22px 'Palatino', 'Georgia', sans-serif;
-}
 
-header {
-    margin-top: 30px;
-    margin-bottom: 30px;
-    text-align: center;
-}
-footer {
-    margin-top: 30px;
-    text-align: center;
-    font-style: italic;
+    h2 {
+        font-size: 28px;
+    }
+    h3 {
+        font-size: 24px;
+    }
+    h4 {
+        font-size: 20px;
+    }
+    header {
+        margin-top: 30px;
+        margin-bottom: 30px;
+        text-align: center;
+    }
+    footer {
+        margin-top: 30px;
+        text-align: center;
+        font-style: italic;
+    }
+    .toc {
+        ol {
+            margin-left: 0;
+
+            li {
+                list-style: none;
+            }
+        }
+    }
 }
 
 body.splash {

File bookmarkdown/templates/splash.html

             <ol>
                 <li><a href="/acknowledgements.html">Acknowledgements</a></li>
                 <li><a href="/preface.html">Preface</a></li>
+                {% for chapter in chapters %}
+                    <li><a href="/chapters/{{ chapter }}.html">{{ chapter }}</a></li>
+                {% endfor %}
             </ol>
         </section>
     </section>