From 90b894dae8b780c92f74f839c7c0c278848f2161 Mon Sep 17 00:00:00 2001
From: Greg Wilson <gvwilson@third-bit.com>
Date: Tue, 26 Apr 2016 19:49:47 -0400
Subject: [PATCH] Refreshing from example

---
 _includes/all_keypoints.html |  2 +-
 _includes/episode_title.html |  4 ++--
 _includes/syllabus.html      |  2 +-
 assets/css/lesson.scss       |  2 +-
 bin/validator                | 19 ++++++++++++++++---
 5 files changed, 21 insertions(+), 8 deletions(-)

diff --git a/_includes/all_keypoints.html b/_includes/all_keypoints.html
index 2656acc..bedfd73 100644
--- a/_includes/all_keypoints.html
+++ b/_includes/all_keypoints.html
@@ -7,7 +7,7 @@
   {% unless episode.break %}
     <tr>
       <td class="col-md-3">
-        <a href="{{ site.root }}/{{ episode.url }}">{{ episode.title }}</a>
+        <a href="{{ site.root }}{{ episode.url }}">{{ episode.title }}</a>
       </td>
       <td class="col-md-9">
         <ul>
diff --git a/_includes/episode_title.html b/_includes/episode_title.html
index e6fbb8c..297abde 100644
--- a/_includes/episode_title.html
+++ b/_includes/episode_title.html
@@ -14,13 +14,13 @@
 {% endfor %}
 <div class="row">
   <div class="col-md-1">
-    <h3>{% if prev_episode %}<a href="{{ site.root }}/{{ prev_episode.url }}"><span class="glyphicon glyphicon-menu-left"></span></a>{% endif %}</h3>
+    <h3>{% if prev_episode %}<a href="{{ site.root }}{{ prev_episode.url }}"><span class="glyphicon glyphicon-menu-left"></span></a>{% endif %}</h3>
   </div>
   <div class="col-md-10">
     <h3 class="maintitle"><a href="{{ site.root }}/">{{ site.title }}</a></h3>
     <h1 class="maintitle">{{ page.title }}</h1>
   </div>
   <div class="col-md-1">
-    <h3>{% if next_episode %}<a href="{{ site.root }}/{{ next_episode.url }}"><span class="glyphicon glyphicon-menu-right"></span></a>{% endif %}</h3>
+    <h3>{% if next_episode %}<a href="{{ site.root }}{{ next_episode.url }}"><span class="glyphicon glyphicon-menu-right"></span></a>{% endif %}</h3>
   </div>
 </div>
diff --git a/_includes/syllabus.html b/_includes/syllabus.html
index 0240d85..5f4b7c8 100644
--- a/_includes/syllabus.html
+++ b/_includes/syllabus.html
@@ -34,7 +34,7 @@
       {% if multiday %}<td class="col-md-1">{% if episode.start %}Day {{ day }}{% endif %}</td>{% endif %}
       <td class="col-md-1">{% if hours < 10 %}0{% endif %}{{ hours }}:{% if minutes < 10 %}0{% endif %}{{ minutes }}</td>
       <td class="col-md-3">
-        <a href="{{ site.root }}/{{ episode.url }}">{{ episode.title }}</a>
+        <a href="{{ site.root }}{{ episode.url }}">{{ episode.title }}</a>
       </td>
       <td class="col-md-7">
         {% if episode.break %}
diff --git a/assets/css/lesson.scss b/assets/css/lesson.scss
index 2f933b8..604245e 100644
--- a/assets/css/lesson.scss
+++ b/assets/css/lesson.scss
@@ -71,7 +71,7 @@ $codeblock-padding: 5px !default;
 
 .callout{ @include bkSetup(#31708f, "\e146"); }
 .challenge{ @include bkSetup(#3c763d, "\270f"); }
-.getready{ @include bkSetup(#D4C30B, "\e067"); }
+.checklist{ @include bkSetup(#D4C30B, "\e067"); }
 .keypoints{ @include bkSetup(#0B80F0, "\e101"); }
 .objectives{ @include bkSetup(#D4C30B, "\e124"); }
 .prereq{ @include bkSetup(#D4C30B, "\e240"); }
diff --git a/bin/validator b/bin/validator
index c173905..2c5ad24 100755
--- a/bin/validator
+++ b/bin/validator
@@ -15,8 +15,8 @@ from bs4 import BeautifulSoup
 from lxml import etree
 
 
-# Default configuration.
-DEFAULT_CONFIG = '''\
+# Default lesson configuration.
+LESSON_CONFIG = '''\
 patterns:
   '*.html':
     - has_title_in_head
@@ -66,6 +66,11 @@ def parse_args():
                       default=None,
                       dest='config_file',
                       help='configuration file')
+    parser.add_option('-l', '--lesson',
+                      default=False,
+                      action='store_true',
+                      dest='check_lesson',
+                      help='check a lesson')
     parser.add_option('-s', '--source',
                       default='_site',
                       dest='source_dir',
@@ -75,10 +80,16 @@ def parse_args():
                       action='count',
                       dest='verbose',
                       help='report actions')
+    parser.add_option('-w', '--workshop',
+                      default=False,
+                      action='store_true',
+                      dest='check_workshop',
+                      help='check a workshop')
 
     args, extras = parser.parse_args()
 
     _require(not extras, 'Unexpected trailing command-line arguments "{0}"'.format(extras))
+    _require(args.check_lesson != args.check_workshop, 'Must have exactly one of -l/-w')
 
     return args
 
@@ -91,8 +102,10 @@ def read_config(args):
     if args.config_file:
         with open(args.config_file, 'r') as reader:
             args.config = yaml.load(reader)
+    elif args.check_lesson:
+        args.config = yaml.load(LESSON_CONFIG)
     else:
-        args.config = yaml.load(DEFAULT_CONFIG)
+        assert False, 'Do not know what configuration to load'
 
     args.patterns = args.config['patterns']
 
-- 
GitLab