From 2da5e1c6a8dee0df38cf1f4f75632dc80c2d49f3 Mon Sep 17 00:00:00 2001
From: Aaron O'Leary <aaron.oleary@gmail.com>
Date: Thu, 27 Nov 2014 12:24:18 +0000
Subject: [PATCH] clarify documentation, make all classes special

This means that you can trigger div creation by

1. Using a special title
2. Using a special class on an arbitrary title
---
 tools/blockquote2div.py | 25 ++++++++++++++++++++-----
 1 file changed, 20 insertions(+), 5 deletions(-)

diff --git a/tools/blockquote2div.py b/tools/blockquote2div.py
index 5212c56..6797c86 100755
--- a/tools/blockquote2div.py
+++ b/tools/blockquote2div.py
@@ -9,10 +9,10 @@ Usage:
 A blockquote will be converted if
 
 1.  it begins with a header
-2.  that
-    1.  match "Prerequisites", "Objectives" or
+2.  that either
+    1.  matches "Prerequisites", "Objectives", "Callout" or "Challenge" OR
     2.  has attributes containing a single class matching
-        one of ['callout', 'challenge']
+        one of ['prereq', 'objectives', 'callout', 'challenge']
 
 For example, this is a valid blockquote:
 
@@ -26,6 +26,18 @@ and it will be converted into this markdown:
     Let's do something.
     </div>
 
+This is also a valid blockquote:
+
+    > ## Prerequisites
+    > Breakfast!
+
+and it will be converted into this markdown:
+
+    <div class='prereq'>
+    ## Prerequisites
+    Breakfast!
+    </div>
+
 
 For debugging purposes you may find it useful to test the filter
 like this:
@@ -37,13 +49,16 @@ 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 = ['callout', 'challenge']
+SPECIAL_CLASSES = ['callout', 'challenge', 'prereq', 'objectives']
 
 # 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',
-                  'learning objectives': 'objectives'}
+                  'learning objectives': 'objectives',
+                  'objectives': 'objectives',
+                  'challenge': 'challenge',
+                  'callout': 'callout'}
 
 
 def find_header(blockquote):
-- 
GitLab