org-hugo-slug: Convert "+" chars in headings to " plus "

master
Kaushal Modi 7 years ago
parent ade6244950
commit 2456ee887a
  1. 15
      ox-hugo.el
  2. 4
      test/site/content-org/all-posts.org
  3. 8
      test/site/content/posts/post-heading-slugs.md

@ -1805,7 +1805,8 @@ The `slug' generated from that STR follows these rules:
- Not have *any* HTML tag like \"<code>..</code>\",
\"<span class=..>..</span>\", etc.
- Not contain any URLs (if STR happens to be a Markdown link).
- Replace \".\" in STR with \"dot\", and \"&\" with \"and\".
- Replace \".\" in STR with \"dot\", \"&\" with \"and\",
\"+\" with \"plus\".
- Replace parentheses with double-hyphens. So \"foo (bar) baz\"
becomes \"foo--bar--baz\".
- Replace non [[:alnum:]-] chars with spaces, and then one or
@ -1820,10 +1821,14 @@ The `slug' generated from that STR follows these rules:
;; below regexp is the closing parenthesis of a Markdown
;; link: [Desc](Link).
(str (replace-regexp-in-string (concat "\\](" ffap-url-regexp "[^)]+)") "]" str))
;; Replace "&" with " and ".
(str (replace-regexp-in-string "&" " and " str))
;; Replace "." with " dot ".
(str (replace-regexp-in-string "\\." " dot " str))
;; Replace "&" with " and ", "." with " dot ", "+" with
;; " plus ".
(str (replace-regexp-in-string
"&" " and "
(replace-regexp-in-string
"\\." " dot "
(replace-regexp-in-string
"\\+" " plus " str))))
;; Replace all characters except alphabets, numbers and
;; parentheses with spaces.
(str (replace-regexp-in-string "[^[:alnum:]()]" " " str))

@ -402,6 +402,10 @@ Something 2.1
** Releasing version 1.1
** Foo ( Bar ) Baz
** (Foo)Bar.Baz&Zoo
- ~.~~dot~
- ~&~~and~
** C++
- ~+~~plus~
** Hey! I have a link [[https://example.org][here]] (Awesome!)
** Este título es en español
** Non-English titles

@ -12,6 +12,14 @@ draft = false
## (Foo)Bar.Baz&Zoo {#foo--bar-dot-baz-and-zoo}
- `.``dot`
- `&``and`
## C++ {#c-plus-plus}
- `+``plus`
## Hey! I have a link [here](https://example.org) (Awesome!) {#hey-i-have-a-link-here--awesome}

Loading…
Cancel
Save