hugo

Unnamed repository; edit this file 'description' to name the repository.

git clone git://git.shimmy1996.com/hugo.git
commit 4a2eda49cdd3180ab884a696ac987d7d6bb375db
parent eb519afefdd506de46968f598fe78af7cda49dee
Author: Anthony Fok <foka@debian.org>
Date:   Tue,  4 Aug 2015 13:05:48 -0600

Add option to disable Blackfriday Smartypants

Can be used in site config or per page front matter:

```
[blackfriday]
smartypants = false
```

Diffstat:
Mdocs/content/overview/configuration.md | 30++++++++++++++++++++++--------
Mhelpers/content.go | 7++++++-
2 files changed, 28 insertions(+), 9 deletions(-)
diff --git a/docs/content/overview/configuration.md b/docs/content/overview/configuration.md
@@ -166,6 +166,16 @@ But Hugo does expose some options---as listed in the table below, matched with t
 
 <tbody>
 <tr>
+<td><code><strong>smartypants</strong></code></td>
+<td><code>true</code></td>
+<td><code>HTML_USE_SMARTYPANTS</code></td>
+</tr>
+<tr>
+<td class="purpose-title">Purpose:</td>
+<td class="purpose-description" colspan="2">Enable enable smart punctuation substitutions.</td>
+</tr>
+
+<tr>
 <td><code><strong>angledQuotes</strong></code></td>
 <td><code>false</code></td>
 <td><code>HTML_SMARTYPANTS_ANGLED_QUOTES</code></td>
@@ -191,23 +201,25 @@ but only these three.</small></td>
 </tr>
 
 <tr>
-<td><code><strong>hrefTargetBlank</strong></code></td>
-<td><code>false</code></td>
-<td><code>HTML_HREF_TARGET_BLANK</code></td>
+<td><code><strong>latexDashes</strong></code></td>
+<td><code>true</code></td>
+<td><code>HTML_SMARTYPANTS_LATEX_DASHES</code></td>
 </tr>
 <tr>
 <td class="purpose-title">Purpose:</td>
-<td class="purpose-description" colspan="2">Open external links in a new window/tab.</small></td>
+<td class="purpose-description" colspan="2">Disable LaTeX style dashes.</small></td>
 </tr>
 
+<tr style="height: 0.3em;"></tr>
+
 <tr>
-<td><code><strong>latexDashes</strong></code></td>
-<td><code>true</code></td>
-<td><code>HTML_SMARTYPANTS_LATEX_DASHES</code></td>
+<td><code><strong>hrefTargetBlank</strong></code></td>
+<td><code>false</code></td>
+<td><code>HTML_HREF_TARGET_BLANK</code></td>
 </tr>
 <tr>
 <td class="purpose-title">Purpose:</td>
-<td class="purpose-description" colspan="2">Disable LaTeX style dashes.</small></td>
+<td class="purpose-description" colspan="2">Open external links in a new window/tab.</small></td>
 </tr>
 
 <tr>
@@ -220,6 +232,8 @@ but only these three.</small></td>
 <td class="purpose-description" colspan="2">If <code>true</code>, then header and footnote IDs are generated without the document ID <small>(e.g.&nbsp;<code>#my-header</code> instead of <code>#my-header:bec3ed8ba720b9073ab75abcf3ba5d97</code>)</small></td>
 </tr>
 
+<tr style="height: 0.3em;"></tr>
+
 <tr>
 <td><code><strong>extensions</strong></code></td>
 <td><code>[]</code></td>
diff --git a/helpers/content.go b/helpers/content.go
@@ -40,6 +40,7 @@ var SummaryDivider = []byte("<!--more-->")
 
 // Blackfriday holds configuration values for Blackfriday rendering.
 type Blackfriday struct {
+	Smartypants     bool
 	AngledQuotes    bool
 	Fractions       bool
 	HrefTargetBlank bool
@@ -52,6 +53,7 @@ type Blackfriday struct {
 // NewBlackfriday creates a new Blackfriday with some sane defaults.
 func NewBlackfriday() *Blackfriday {
 	return &Blackfriday{
+		Smartypants:     true,
 		AngledQuotes:    false,
 		Fractions:       true,
 		HrefTargetBlank: false,
@@ -148,9 +150,12 @@ func GetHTMLRenderer(defaultFlags int, ctx *RenderingContext) blackfriday.Render
 
 	htmlFlags := defaultFlags
 	htmlFlags |= blackfriday.HTML_USE_XHTML
-	htmlFlags |= blackfriday.HTML_USE_SMARTYPANTS
 	htmlFlags |= blackfriday.HTML_FOOTNOTE_RETURN_LINKS
 
+	if ctx.getConfig().Smartypants {
+		htmlFlags |= blackfriday.HTML_USE_SMARTYPANTS
+	}
+
 	if ctx.getConfig().AngledQuotes {
 		htmlFlags |= blackfriday.HTML_SMARTYPANTS_ANGLED_QUOTES
 	}