Commits

Steve Losh committed e1affa4

Moar.

Comments (0)

Files changed (8)

bookmarkdown/bookmarkdown

 join = os.path.join
 
 base_context = {
-    'title': getattr(config, 'title', ''),
+    'book_title': getattr(config, 'title', ''),
     'author': getattr(config, 'author', ''),
     'author_url': getattr(config, 'author_url', ''),}
 # }}}
     with open(source, 'r') as f:
         content = markdown.markdown(f.read())
 
-    out = render(template, content=content, **context)
+    name = pq(content)('h1').text()
+    out = render(template, content=content, name=name, **context)
     target = join('build', 'html', '%s.html' % filename)
 
     with open(target, 'w') as f:

bookmarkdown/static/styles/style.less

 }
 html, body {
     font: normal 16px/22px 'Palatino', 'Georgia', sans-serif;
+    color: #333;
 
     h1 {
         font-size: 28px;

bookmarkdown/templates/base.html

     <body class="{% block class %}{% endblock %}">
         <div class="container">
             <header class="sixteen columns">
-                <h1><a href="/">{{ title }}</a></h1>
+                <h1><a href="/">{{ book_title }}</a></h1>
             </header>
 
             {% block content_full %}

bookmarkdown/templates/chapter.html

 
 {% block content_full %}
     <section class="nav three columns">
+        {{ name }}
         <div class="prevnext">
             <a class="prev" href="">&laquo; Previous</a>
             <a class="next" href="">Next &raquo;</a>
 
     <section class="content twelve columns offset-by-one">
         {{ content }}
-
-        <div class="prevnext">
-            <a class="prev" href="">&laquo; Previous</a>
-            <a class="next" href="">Next &raquo;</a>
-        </div>
     </section>
 {% endblock %}

bookmarkdown/templates/single.html

 
 {% block content %}
     {{ content }}
+
+    <div class="prevnext">
+        <a class="prev" href="">&laquo; Previous</a>
+        <a class="next" href="">Next &raquo;</a>
+    </div>
 {% endblock %}

sample/chapters/00.markdown

 
 To easily find the location and name of the file on *any* operating system, run
 `:echo $MYVIMRC` in Vim.  The path will be displayed at the bottom of the screen.
+
+Create this file if it doesn't already exist.

sample/chapters/01.markdown

 done.  Using `:echom` will save the output and let you run `:messages` to view it
 later.
 
-Extra Credit
-------------
+Exercises
+---------
 
 Read `:help echo`.
 

sample/chapters/02.markdown

 Setting Options
 ===============
 
-What Should Happen
-------------------
+Vim has many options you can set to change how it behaves.
 
-Extra Credit
-------------
+There are two main kinds of options: boolean options (either "on" or "off") and
+options that take a value.
 
+Run the following command:
 
+    :set number
+
+Line numbers should appear in Vim.  Now run this:
+
+    :set nonumber
+
+The line numbers should disappear.  `number` is a boolean option -- it can be off or
+on.  You turn it "on" by running `:set number` and "off" with `:set nonumber`.
+
+You can also "toggle" boolean options to set them to the *opposite* of whatever
+they are now.  Run this:
+
+    :set number!
+
+The line numbers should reappear.  Now run it again:
+
+    :set number!
+
+They should disappear once more.  Adding a `!` (exclamation point or "bang") to
+a boolean option toggles it.
+
+You can ask Vim what an option is currently set to by using a `?`.  Run these
+commands and watch what happens after each:
+
+    :set number
+    :set number?
+    :set nonumber
+    :set number?
+
+Notice how the first `:set number?` command displayed `number` while the second
+displayed `nonumber`.
+
+Some options take a value instead of just being off or on.  Run the following
+commands and watch what happens after each:
+
+    :set number
+    :set numberwidth=10
+    :set numberwidth=4
+    :set numberwidth?
+
+The `numberwidth` option changes how wide the column containing line numbers will be.
+
+Finally, you can specify more than one option in the same `:set` command.  Try
+running this:
+
+    :set number numberwidth=6
+
+Exercises
+---------
+
+Read `:help number`.
+
+Read `:help relativenumber`.
+
+Read `:help numberwidth`.
+
+Read `:help wrap`.
+
+Add a few lines to your vimrc file to set these four options however you like.