56 lines
No EOL
2.5 KiB
HTML
56 lines
No EOL
2.5 KiB
HTML
<!-- github.com/jygastaud/hugo-microtypo -->
|
|
{{ $content := . }}
|
|
|
|
<!-- # Ordinals -->
|
|
{{ $content = $content | replaceRE "(\\s)(\\d+)(e|è)(r|me)?([\\s.,])" "$1$2<sup>$3$4</sup>$5" }}
|
|
|
|
<!-- # Num -->
|
|
<!-- input.gsub!(%r!n°\s*(\d)!, 'n<sup>o</sup> \1') -->
|
|
{{ $content = $content | replaceRE "n°\\s*(\\d)" "n<sup>o</sup> $1" }}
|
|
|
|
<!-- # French Guillemets -->
|
|
{{ $content = $content | replaceRE "“" "« " }}
|
|
{{ $content = $content | replaceRE "”" " »" }}
|
|
<!-- # ?! not existing in go. Should find an other way -->
|
|
<!-- {{ $content = $content | replaceRE "(\\s| | )*(\\?\\! )(”|”|»)" " »" }} -->
|
|
|
|
<!-- # Point median -->
|
|
<!-- if settings["median"] -->
|
|
<!-- input.gsub!(%r!(\p{L}+)(·\p{L}+)((·)(\p{L}+))?!, '\1<span aria-hidden="true">\2\4</span>\5') -->
|
|
<!-- end -->
|
|
|
|
<!-- # Special punctuation -->
|
|
<!-- input.gsub!(%r!(\s)+\?\!([^\w]|$)!, ' ⁈\2') -->
|
|
<!-- input.gsub!(%r!(\s)+\!\?([^\w]|$)!, ' ⁉\2') -->
|
|
<!-- input.gsub!(%r!(\s)+\!\!\!([^\w]|$)!, ' ‼\2') -->
|
|
<!-- input.gsub!(%r!(\s)+\!\!([^\w]|$)!, ' ‼\2') -->
|
|
|
|
<!-- # Times : need tests -->
|
|
<!-- input.gsub!(%r!(\s)+(\d+)(\s)*x(\s)*(?=\d)!, '\1\2 × \5') -->
|
|
{{ $content = $content | replaceRE "(\\s)+(\\d+)(\\s)*x(\\s)*(^\\d)" "$1$2 × $5" }}
|
|
|
|
<!-- # Non-breaking space before '%' and units (< 4 letters) -->
|
|
{{ $content = $content | replaceRE "(\\s)+(\\d+)(\\s)+([a-zA-Z]|%)" "$1$2 $4$5" }}
|
|
|
|
<!-- # Thin non-breaking space before ;', '!', '?' -->
|
|
{{ $content = $content | replaceRE "( )([;?!])" " $2" }}
|
|
|
|
<!-- # non-breaking space -->
|
|
{{ $content = $content | replaceRE "( )([:])" " $2" }}
|
|
|
|
<!-- # Currencies -->
|
|
{{ $content = $content | replaceRE "(\\d+)\\s*(\\$|€)" "$1 $2" }}
|
|
|
|
<!-- # nbsp after middle dash (dialogs) -->
|
|
<!-- input.gsub!(%r!(—|—)(\s)!, '\1 ') -->
|
|
{{ $content = $content | replaceRE "(—|—)(\\s)" "$1 " }}
|
|
|
|
<!-- # strucutration -->
|
|
{{ $content = $content | replaceRE ":::info" "<div class='info'>" }}
|
|
{{ $content = $content | replaceRE ":::success" "<div class='success'>" }}
|
|
{{ $content = $content | replaceRE ":::danger" "<div class='danger invisble'>" }}
|
|
{{ $content = $content | replaceRE ":::warning" "<div class='warning'>" }}
|
|
{{ $content = $content | replaceRE ":::" "</div>" }}
|
|
|
|
<!-- Render Content -->
|
|
{{ $content | safeHTML }} |