From 71623dcc491a226d4a4329566dc847088b218c95 Mon Sep 17 00:00:00 2001
From: Raniere Silva <raniere@ime.unicamp.br>
Date: Wed, 26 Nov 2014 17:28:15 -0200
Subject: [PATCH] Small improve at tools/blockquote2div.py

- Use UPPERCASE for global constants
- Add Learning Objectives to SPECIAL_TITLES
- Fix samples
---
 pages/01-one.md         |  2 +-
 pages/02-two.md         |  2 +-
 tools/blockquote2div.py | 20 +++++++++++---------
 3 files changed, 13 insertions(+), 11 deletions(-)

diff --git a/pages/01-one.md b/pages/01-one.md
index 9857e50..ca4dc26 100644
--- a/pages/01-one.md
+++ b/pages/01-one.md
@@ -4,7 +4,7 @@ title: Lesson Title
 subtitle: Topic Title One
 minutes: 10
 ---
-> ## Learning Objectives {.objectives}
+> ## Learning Objectives
 >
 > * Learning objective 1
 > * Learning objective 2
diff --git a/pages/02-two.md b/pages/02-two.md
index b3fdb64..0412d1b 100644
--- a/pages/02-two.md
+++ b/pages/02-two.md
@@ -4,7 +4,7 @@ title: Lesson Title
 subtitle: Topic Title Two
 minutes: 10
 ---
-> ## Learning Objectives {.objectives}
+> ## Learning Objectives
 >
 > * Learning objective 1
 > * Learning objective 2
diff --git a/tools/blockquote2div.py b/tools/blockquote2div.py
index 6e20af0..5212c56 100755
--- a/tools/blockquote2div.py
+++ b/tools/blockquote2div.py
@@ -8,10 +8,11 @@ Usage:
 
 A blockquote will be converted if
 
-1. it begins with a header
-2. that header has attributes
-3. those attributes contain a single class
-4. that class is one of ['objectives', 'callout', 'challenge']
+1.  it begins with a header
+2.  that
+    1.  match "Prerequisites", "Objectives" or
+    2.  has attributes containing a single class matching
+        one of ['callout', 'challenge']
 
 For example, this is a valid blockquote:
 
@@ -36,12 +37,13 @@ import pandocfilters as pf
 
 # These are classes that, if set on the title of a blockquote, will
 # trigger the blockquote to be converted to a div.
-special_classes = ['objectives', 'callout', 'challenge']
+SPECIAL_CLASSES = ['callout', 'challenge']
 
 # These are titles of blockquotes that will cause the blockquote to
 # be converted into a div. They are 'title': 'class' pairs, where the
 # 'title' will create a blockquote with the corresponding 'class'.
-special_titles = {'prerequisites': 'prereq'}
+SPECIAL_TITLES = {'prerequisites': 'prereq',
+                  'learning objectives': 'objectives'}
 
 
 def find_header(blockquote):
@@ -88,11 +90,11 @@ def blockquote2div(key, value, format, meta):
         id, classes, kvs = attr
 
         ltitle = pf.stringify(inlines).lower()
-        if ltitle in special_titles:
-            classes.append(special_titles[ltitle])
+        if ltitle in SPECIAL_TITLES:
+            classes.append(SPECIAL_TITLES[ltitle])
             return pf.Div(attr, blockquote)
 
-        elif len(classes) == 1 and classes[0] in special_classes:
+        elif len(classes) == 1 and classes[0] in SPECIAL_CLASSES:
             remove_attributes(blockquote)
             # a blockquote is just a list of blocks, so it can be
             # passed directly to Div, which expects Div(attr, blocks)
-- 
GitLab