mirror of
https://github.com/gohugoio/hugo.git
synced 2024-12-25 00:52:46 +00:00
parent
c4a0b6e8ab
commit
cb9dfc2613
3 changed files with 13 additions and 0 deletions
|
@ -8,6 +8,11 @@
|
||||||
Blackfriday flag: **`HTML_USE_SMARTYPANTS`** <br>
|
Blackfriday flag: **`HTML_USE_SMARTYPANTS`** <br>
|
||||||
Purpose: `false` disables smart punctuation substitutions, including smart quotes, smart dashes, smart fractions, etc. If `true`, it may be fine-tuned with the `angledQuotes`, `fractions`, `smartDashes`, and `latexDashes` flags (see below).
|
Purpose: `false` disables smart punctuation substitutions, including smart quotes, smart dashes, smart fractions, etc. If `true`, it may be fine-tuned with the `angledQuotes`, `fractions`, `smartDashes`, and `latexDashes` flags (see below).
|
||||||
|
|
||||||
|
`smartypantsQuotesNBSP`
|
||||||
|
: default: **`false`** <br>
|
||||||
|
Blackfriday flag: **`HTML_SMARTYPANTS_QUOTES_NBSP`** <br>
|
||||||
|
Purpose: `true` enables French style Guillemets with non-breaking space inside the quotes.
|
||||||
|
|
||||||
`angledQuotes`
|
`angledQuotes`
|
||||||
: default: **`false`**<br>
|
: default: **`false`**<br>
|
||||||
Blackfriday flag: **`HTML_SMARTYPANTS_ANGLED_QUOTES`**<br>
|
Blackfriday flag: **`HTML_SMARTYPANTS_ANGLED_QUOTES`**<br>
|
||||||
|
|
|
@ -63,6 +63,7 @@ func NewContentSpec(cfg config.Provider) *ContentSpec {
|
||||||
// Blackfriday holds configuration values for Blackfriday rendering.
|
// Blackfriday holds configuration values for Blackfriday rendering.
|
||||||
type Blackfriday struct {
|
type Blackfriday struct {
|
||||||
Smartypants bool
|
Smartypants bool
|
||||||
|
SmartypantsQuotesNBSP bool
|
||||||
AngledQuotes bool
|
AngledQuotes bool
|
||||||
Fractions bool
|
Fractions bool
|
||||||
HrefTargetBlank bool
|
HrefTargetBlank bool
|
||||||
|
@ -81,6 +82,7 @@ func (c ContentSpec) NewBlackfriday() *Blackfriday {
|
||||||
defaultParam := map[string]interface{}{
|
defaultParam := map[string]interface{}{
|
||||||
"smartypants": true,
|
"smartypants": true,
|
||||||
"angledQuotes": false,
|
"angledQuotes": false,
|
||||||
|
"smartypantsQuotesNBSP": false,
|
||||||
"fractions": true,
|
"fractions": true,
|
||||||
"hrefTargetBlank": false,
|
"hrefTargetBlank": false,
|
||||||
"smartDashes": true,
|
"smartDashes": true,
|
||||||
|
@ -229,6 +231,10 @@ func (c ContentSpec) getHTMLRenderer(defaultFlags int, ctx *RenderingContext) bl
|
||||||
htmlFlags |= blackfriday.HTML_USE_SMARTYPANTS
|
htmlFlags |= blackfriday.HTML_USE_SMARTYPANTS
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ctx.Config.SmartypantsQuotesNBSP {
|
||||||
|
htmlFlags |= blackfriday.HTML_SMARTYPANTS_QUOTES_NBSP
|
||||||
|
}
|
||||||
|
|
||||||
if ctx.Config.AngledQuotes {
|
if ctx.Config.AngledQuotes {
|
||||||
htmlFlags |= blackfriday.HTML_SMARTYPANTS_ANGLED_QUOTES
|
htmlFlags |= blackfriday.HTML_SMARTYPANTS_ANGLED_QUOTES
|
||||||
}
|
}
|
||||||
|
|
|
@ -171,6 +171,7 @@ func TestGetHTMLRendererAllFlags(t *testing.T) {
|
||||||
{blackfriday.HTML_USE_XHTML},
|
{blackfriday.HTML_USE_XHTML},
|
||||||
{blackfriday.HTML_FOOTNOTE_RETURN_LINKS},
|
{blackfriday.HTML_FOOTNOTE_RETURN_LINKS},
|
||||||
{blackfriday.HTML_USE_SMARTYPANTS},
|
{blackfriday.HTML_USE_SMARTYPANTS},
|
||||||
|
{blackfriday.HTML_SMARTYPANTS_QUOTES_NBSP},
|
||||||
{blackfriday.HTML_SMARTYPANTS_ANGLED_QUOTES},
|
{blackfriday.HTML_SMARTYPANTS_ANGLED_QUOTES},
|
||||||
{blackfriday.HTML_SMARTYPANTS_FRACTIONS},
|
{blackfriday.HTML_SMARTYPANTS_FRACTIONS},
|
||||||
{blackfriday.HTML_HREF_TARGET_BLANK},
|
{blackfriday.HTML_HREF_TARGET_BLANK},
|
||||||
|
@ -186,6 +187,7 @@ func TestGetHTMLRendererAllFlags(t *testing.T) {
|
||||||
ctx.Config.PlainIDAnchors = true
|
ctx.Config.PlainIDAnchors = true
|
||||||
ctx.Config.SmartDashes = true
|
ctx.Config.SmartDashes = true
|
||||||
ctx.Config.Smartypants = true
|
ctx.Config.Smartypants = true
|
||||||
|
ctx.Config.SmartypantsQuotesNBSP = true
|
||||||
ctx.Config.SourceRelativeLinksEval = true
|
ctx.Config.SourceRelativeLinksEval = true
|
||||||
renderer := c.getHTMLRenderer(defaultFlags, ctx)
|
renderer := c.getHTMLRenderer(defaultFlags, ctx)
|
||||||
actualFlags := renderer.GetFlags()
|
actualFlags := renderer.GetFlags()
|
||||||
|
|
Loading…
Reference in a new issue