diff --git a/README.org b/README.org
index 357b82a2..8b73c6c1 100644
--- a/README.org
+++ b/README.org
@@ -153,19 +153,28 @@ The common =ox-hugo= export bindings are:
Do =M-x customize-group=, and select =org-export-hugo= to see the
available customization options for this package.
* Changelog
-** 0.2.2 <2017-10-10 Tue>
+** v0.2.3 <2017-10-11 Wed>
+*** Fixes
+- =org-hugo-slug= earlier stripped off only the =code= HTML tag
+ (~ ..
~) from the input string, if present. Now it does
+ that for *any* HTML tag, like =span=. For example, this HTML gets
+ stripped off from the above heading (only inside =org-hugo-slug=
+ when deriving the slug string): ~<2017-10-11
+ Wed>~.
+** v0.2.2 <2017-10-10 Tue>
*** Backward-incompatible changes
- Now =ox-hugo= by default requires text, to be sub/super-scripted, to
be wrapped in ={}=. So now =a_b= will be exported as =a_b=, but
=a_{b}= will be exported as =ab=. To revert back to the
earlier behavior, user needs to add =#+OPTIONS: ^:t= to their Org
file.
-** 0.2.1 <2017-09-28 Thu>
+** v0.2.1 <2017-09-28 Thu>
*** Fixes
- Single column tables now export correctly [[[https://github.com/kaushalmodi/ox-hugo/issues/84][84]]].
- Ignore =HUGO_WEIGHT= set to =auto= for /per-file/ exports
[[[https://github.com/kaushalmodi/ox-hugo/issues/83][83]]].
-** 0.2 <2017-09-27 Wed>
+** v0.2 <2017-09-27 Wed>
*** Features
- Add support for all Hugo =figure= shortcode parameters
[[[https://github.com/kaushalmodi/ox-hugo/issues/79][79]]].
@@ -184,17 +193,17 @@ available customization options for this package.
*** Backward-incompatible changes
- Switch the default value of =org-hugo-use-code-for-kbd= option to
=nil= [[[https://github.com/kaushalmodi/ox-hugo/commit/88ba15ae9bc809b0983315446c88fecfda3534e5][88ba15ae]]].
-** 0.1.3 <2017-09-13 Wed>
+** v0.1.3 <2017-09-13 Wed>
- Now a HUGO key value set to ="nil"=, like =#+HUGO_CODE_FENCE: nil=,
will evaluate as /nil/ instead of /t/, as now
=org-hugo--plist-get-true-p= is used to parse boolean keys instead
of =plist-get=.
-** 0.1.2 <2017-09-12 Tue>
+** v0.1.2 <2017-09-12 Tue>
- Make DateTime matching better; new internal variable
=org-hugo--date-time-regexp=. Earlier time zones ahead of UTC (with
=+= sign) were not detected as dates in =org-hugo--quote-string= and
thus were unnecessarily quoted.
-** 0.1.1 <2017-09-11 Mon>
+** v0.1.1 <2017-09-11 Mon>
- Use CLOSED log drawer info if available to set the date in
front-matter [[[https://github.com/kaushalmodi/ox-hugo/issues/68][68]]].
- Code optimization: Use of =org-entry-get= at places instead of
diff --git a/doc/content/doc/changelog.md b/doc/content/doc/changelog.md
index c8d1c812..953e05e0 100644
--- a/doc/content/doc/changelog.md
+++ b/doc/content/doc/changelog.md
@@ -6,7 +6,21 @@ draft = false
identifier = "changelog"
+++
-## 0.2.2 <2017-10-10 Tue> {#0-dot-2-dot-2-span-class-timestamp-wrapper-span-class-timestamp-and-lt-2017-10-10-tue-and-gt-span-span}
+## v0.2.3 <2017-10-11 Wed> {#v0-dot-2-dot-3}
+
+
+### Fixes {#fixes}
+
+- `org-hugo-slug` earlier stripped off only the `code` HTML tag
+ (` ..
`) from the input string, if present. Now it does
+ that for **any** HTML tag, like `span`. For example, this HTML gets
+ stripped off from the above heading (only inside `org-hugo-slug`
+ when deriving the slug string): `<2017-10-11
+ Wed>`.
+
+
+## v0.2.2 <2017-10-10 Tue> {#v0-dot-2-dot-2}
### Backward-incompatible changes {#backward-incompatible-changes}
@@ -18,7 +32,7 @@ draft = false
file.
-## 0.2.1 <2017-09-28 Thu> {#0-dot-2-dot-1-span-class-timestamp-wrapper-span-class-timestamp-and-lt-2017-09-28-thu-and-gt-span-span}
+## v0.2.1 <2017-09-28 Thu> {#v0-dot-2-dot-1}
### Fixes {#fixes}
@@ -28,7 +42,7 @@ draft = false
[[83](https://github.com/kaushalmodi/ox-hugo/issues/83)].
-## 0.2 <2017-09-27 Wed> {#0-dot-2-span-class-timestamp-wrapper-span-class-timestamp-and-lt-2017-09-27-wed-and-gt-span-span}
+## v0.2 <2017-09-27 Wed> {#v0-dot-2}
### Features {#features}
@@ -58,7 +72,7 @@ draft = false
`nil` [[88ba15ae](https://github.com/kaushalmodi/ox-hugo/commit/88ba15ae9bc809b0983315446c88fecfda3534e5)].
-## 0.1.3 <2017-09-13 Wed> {#0-dot-1-dot-3-span-class-timestamp-wrapper-span-class-timestamp-and-lt-2017-09-13-wed-and-gt-span-span}
+## v0.1.3 <2017-09-13 Wed> {#v0-dot-1-dot-3}
- Now a HUGO key value set to `"nil"`, like `#+HUGO_CODE_FENCE: nil`,
will evaluate as _nil_ instead of _t_, as now
@@ -66,7 +80,7 @@ draft = false
of `plist-get`.
-## 0.1.2 <2017-09-12 Tue> {#0-dot-1-dot-2-span-class-timestamp-wrapper-span-class-timestamp-and-lt-2017-09-12-tue-and-gt-span-span}
+## v0.1.2 <2017-09-12 Tue> {#v0-dot-1-dot-2}
- Make DateTime matching better; new internal variable
`org-hugo--date-time-regexp`. Earlier time zones ahead of UTC (with
@@ -74,7 +88,7 @@ draft = false
thus were unnecessarily quoted.
-## 0.1.1 <2017-09-11 Mon> {#0-dot-1-dot-1-span-class-timestamp-wrapper-span-class-timestamp-and-lt-2017-09-11-mon-and-gt-span-span}
+## v0.1.1 <2017-09-11 Mon> {#v0-dot-1-dot-1}
- Use CLOSED log drawer info if available to set the date in
front-matter [[68](https://github.com/kaushalmodi/ox-hugo/issues/68)].
diff --git a/doc/ox-hugo-export-gh-doc.el b/doc/ox-hugo-export-gh-doc.el
new file mode 100644
index 00000000..1d77b08e
--- /dev/null
+++ b/doc/ox-hugo-export-gh-doc.el
@@ -0,0 +1,56 @@
+;; Time-stamp: <2017-10-11 04:28:38 kmodi>
+
+;; Export Org document to GitHub documents like README.org,
+;; CONTRIBUTING.org.
+
+(defvar ox-hugo-git-root (progn
+ (require 'vc-git)
+ (file-truename (vc-git-root "."))))
+
+(defun ox-hugo-export-gh-doc ()
+ "Export `ox-hugo' Org documentation to documentation on GitHub repo."
+ (interactive)
+ (let* ((ox-hugo-doc-dir (concat ox-hugo-git-root "doc/"))
+ (org-src-preserve-indentation t) ;Preserve the leading whitespace in src blocks
+ (org-id-track-globally nil) ;Prevent "Could not read org-id-values .." error
+ (org-export-with-sub-superscripts '{})
+ (org-export-with-smart-quotes t)
+ (org-export-headline-levels 4)
+ (org-src-fontify-natively t)
+ (subtree-tags-to-export '("readme" "contributing"))
+ ;; If a subtree matches a tag, do not try to export further
+ ;; subtrees separately that could be under that.
+ (org-use-tag-inheritance nil)
+ (org-export-time-stamp-file nil) ;Do not print "Created " in exported files
+ (org-export-with-toc nil)) ;Do not export TOC
+ (dolist (tag subtree-tags-to-export)
+ (let* (;;Retain tags only in the README; needed for `toc-org-insert-toc' to work
+ (org-export-with-tags (if (string= tag "readme") t nil))
+ (exported-file-list (org-map-entries '(org-org-export-to-org nil :subtreep) tag)))
+ ;; Move files to their correct directories
+ (cond
+ ((or (string= "readme" tag)
+ (string= "contributing" tag))
+ (dolist (exported-file exported-file-list)
+ (rename-file (expand-file-name exported-file ox-hugo-doc-dir)
+ (expand-file-name exported-file ox-hugo-git-root)
+ :ok-if-already-exists)))
+ (t
+ nil))))
+ ;; Generate TOC in README.org using the `toc-org' package.
+ (let ((readme-buf (get-buffer "README.org"))
+ (readme-file (expand-file-name "README.org" ox-hugo-git-root)))
+ (when readme-buf ;Close README.org if it's already open
+ (kill-buffer readme-buf))
+ ;; Open the README.org file afresh.
+ (setq readme-buf (find-file-noselect readme-file))
+ (with-current-buffer readme-buf
+ (require 'toc-org)
+ (toc-org-insert-toc)
+ ;; Now remove all Org tags from the README
+ (goto-char (point-min))
+ (while (replace-regexp "^\\(\\* .*?\\)[[:blank:]]*:[^[:blank:]]+:$" "\\1"))
+ (save-buffer)))))
+
+
+(provide 'ox-hugo-export-gh-doc)
diff --git a/doc/ox-hugo-manual.org b/doc/ox-hugo-manual.org
index 0721d92a..36f48cb0 100644
--- a/doc/ox-hugo-manual.org
+++ b/doc/ox-hugo-manual.org
@@ -11,19 +11,28 @@
:PROPERTIES:
:CUSTOM_ID: changelog
:END:
-** 0.2.2 <2017-10-10 Tue>
+** v0.2.3 <2017-10-11 Wed>
+*** Fixes
+- =org-hugo-slug= earlier stripped off only the =code= HTML tag
+ (~ ..
~) from the input string, if present. Now it does
+ that for *any* HTML tag, like =span=. For example, this HTML gets
+ stripped off from the above heading (only inside =org-hugo-slug=
+ when deriving the slug string): ~<2017-10-11
+ Wed>~.
+** v0.2.2 <2017-10-10 Tue>
*** Backward-incompatible changes
- Now =ox-hugo= by default requires text, to be sub/super-scripted, to
be wrapped in ={}=. So now =a_b= will be exported as =a_b=, but
=a_{b}= will be exported as =ab=. To revert back to the
earlier behavior, user needs to add =#+OPTIONS: ^:t= to their Org
file.
-** 0.2.1 <2017-09-28 Thu>
+** v0.2.1 <2017-09-28 Thu>
*** Fixes
- Single column tables now export correctly {{{issue(84)}}}.
- Ignore =HUGO_WEIGHT= set to =auto= for /per-file/ exports
{{{issue(83)}}}.
-** 0.2 <2017-09-27 Wed>
+** v0.2 <2017-09-27 Wed>
*** Features
- Add support for all Hugo =figure= shortcode parameters
{{{issue(79)}}}.
@@ -42,17 +51,17 @@
*** Backward-incompatible changes
- Switch the default value of =org-hugo-use-code-for-kbd= option to
=nil= [[[https://github.com/kaushalmodi/ox-hugo/commit/88ba15ae9bc809b0983315446c88fecfda3534e5][88ba15ae]]].
-** 0.1.3 <2017-09-13 Wed>
+** v0.1.3 <2017-09-13 Wed>
- Now a HUGO key value set to ="nil"=, like =#+HUGO_CODE_FENCE: nil=,
will evaluate as /nil/ instead of /t/, as now
=org-hugo--plist-get-true-p= is used to parse boolean keys instead
of =plist-get=.
-** 0.1.2 <2017-09-12 Tue>
+** v0.1.2 <2017-09-12 Tue>
- Make DateTime matching better; new internal variable
=org-hugo--date-time-regexp=. Earlier time zones ahead of UTC (with
=+= sign) were not detected as dates in =org-hugo--quote-string= and
thus were unnecessarily quoted.
-** 0.1.1 <2017-09-11 Mon>
+** v0.1.1 <2017-09-11 Mon>
- Use CLOSED log drawer info if available to set the date in
front-matter {{{issue(68)}}}.
- Code optimization: Use of =org-entry-get= at places instead of
diff --git a/ox-hugo.el b/ox-hugo.el
index a63ed626..0227d050 100644
--- a/ox-hugo.el
+++ b/ox-hugo.el
@@ -5,7 +5,7 @@
;; URL: https://ox-hugo.scripter.co
;; Package-Requires: ((emacs "24.5") (org "9.0"))
;; Keywords: Org, markdown, docs
-;; Version: 0.2.2
+;; Version: 0.2.3
;;; Commentary:
@@ -689,7 +689,8 @@ returned slug string has the following specification:
- Should contain only lower case alphabet, number and hyphen
characters.
-- Remove \"..
\" part from STR if present.
+- Remove *any* HTML tag like \"..
\", \"..\", etc. from STR if present.
- URLs if present in STR should be removed.
- Replace \".\" in STR with \"and\", and \"&\" with \"and\".
- Parentheses should be replaced with double-hyphens ( \"foo (bar)
@@ -701,8 +702,8 @@ returned slug string has the following specification:
returned string ."
(let* (;; All lower-case
(str (downcase str))
- ;; Remove "..
" stuff if present.
- (str (replace-regexp-in-string ".*
" "" str))
+ ;; Remove ".." HTML tags if present.
+ (str (replace-regexp-in-string "<\\(?1:[a-z]+\\)[^>]*>.*\\1>" "" str))
;; Remove URLs if present in the string. The ")" in the
;; below regexp is the closing parenthesis of a Markdown
;; link: [Desc](Link).
diff --git a/test/setup-ox-hugo.el b/test/setup-ox-hugo.el
index be7a38d9..f5148ec4 100644
--- a/test/setup-ox-hugo.el
+++ b/test/setup-ox-hugo.el
@@ -1,6 +1,7 @@
-;; Time-stamp: <2017-10-10 12:13:14 kmodi>
+;; Time-stamp: <2017-10-11 04:31:46 kmodi>
-;; Setup to test ox-hugo using emacs -Q and the latest stable version of Org
+;; Setup to test ox-hugo using emacs -Q and the latest stable version
+;; of Org.
;; Some sane settings
(setq-default require-final-newline t)
@@ -83,7 +84,8 @@ Emacs installation. If Emacs is installed using
(url (concat (if no-ssl "http" "https") "://melpa.org/packages/")))
(add-to-list 'package-archives (cons "melpa" url) :append))
(add-to-list 'package-archives '("org" . "http://orgmode.org/elpa/") :append) ;For latest `org'
- (add-to-list 'load-path ox-hugo-git-root)
+ (add-to-list 'load-path ox-hugo-git-root) ;For ox-hugo.el, ox-blackfriday.el
+ (add-to-list 'load-path (concat ox-hugo-git-root "doc/")) ;For ox-hugo-export-gh-doc.el
;; Load emacs packages and activate them.
;; Don't delete this line.
@@ -125,50 +127,7 @@ to be installed.")
(defun org-hugo-export-all-subtrees-to-md ()
(org-hugo-export-subtree-to-md :all-subtrees))
-(defun ox-hugo-export-gh-doc ()
- "Export `ox-hugo' Org documentation to documentation on GitHub repo."
- (interactive)
- (let* ((ox-hugo-doc-dir (concat ox-hugo-git-root "doc/"))
- (org-src-preserve-indentation t) ;Preserve the leading whitespace in src blocks
- (org-id-track-globally nil) ;Prevent "Could not read org-id-values .." error
- (org-export-with-sub-superscripts '{})
- (org-export-with-smart-quotes t)
- (org-export-headline-levels 4)
- (org-src-fontify-natively t)
- (subtree-tags-to-export '("readme" "contributing"))
- ;; If a subtree matches a tag, do not try to export further
- ;; subtrees separately that could be under that.
- (org-use-tag-inheritance nil)
- (org-export-time-stamp-file nil) ;Do not print "Created " in exported files
- (org-export-with-toc nil)) ;Do not export TOC
- (dolist (tag subtree-tags-to-export)
- (let* (;;Retain tags only in the README; needed for `toc-org-insert-toc' to work
- (org-export-with-tags (if (string= tag "readme") t nil))
- (exported-file-list (org-map-entries '(org-org-export-to-org nil :subtreep) tag)))
- ;; Move files to their correct directories
- (cond
- ((or (string= "readme" tag)
- (string= "contributing" tag))
- (dolist (exported-file exported-file-list)
- (rename-file (expand-file-name exported-file ox-hugo-doc-dir)
- (expand-file-name exported-file ox-hugo-git-root)
- :ok-if-already-exists)))
- (t
- nil))))
- ;; Generate TOC in README.org using the `toc-org' package.
- (let ((readme-buf (get-buffer "README.org"))
- (readme-file (expand-file-name "README.org" ox-hugo-git-root)))
- (when readme-buf ;Close README.org if it's already open
- (kill-buffer readme-buf))
- ;; Open the README.org file afresh.
- (setq readme-buf (find-file-noselect readme-file))
- (with-current-buffer readme-buf
- (require 'toc-org)
- (toc-org-insert-toc)
- ;; Now remove all Org tags from the README
- (goto-char (point-min))
- (while (replace-regexp "^\\(\\* .*?\\)[[:blank:]]*:[^[:blank:]]+:$" "\\1"))
- (save-buffer)))))
+(require 'ox-hugo-export-gh-doc) ;For `ox-hugo-export-gh-doc'
(with-eval-after-load 'org
;; Allow multiple line Org emphasis markup
diff --git a/test/site/content-org/all-posts.org b/test/site/content-org/all-posts.org
index 021ee477..4558eec9 100644
--- a/test/site/content-org/all-posts.org
+++ b/test/site/content-org/all-posts.org
@@ -199,6 +199,23 @@ Something 2.1
*** ÄËÏÖÜ
*** ÃÐÑÕÞ
*** Ç
+** Headings with HTML
+*** Checklist [1/3]
+Above title would render to ~Checklist [1/3]
~ in
+Markdown.
+**** DONE Item 1
+Above would render to ~DONE Item 1~
+in Markdown.
+**** TODO Item 2
+Above would render to ~TODO Item 2~
+in Markdown.
+**** TODO Item 3
+Above would render to ~TODO Item 3~
+in Markdown.
+*** Version 0.1 <2017-10-11 Wed>
+Above title would render to ~Version 0.1 <2017-10-11
+Wed>~ in Markdown.
* Title in Front Matter
** Awesome title with "quoted text"
:PROPERTIES:
diff --git a/test/site/content/posts/post-heading-slugs.md b/test/site/content/posts/post-heading-slugs.md
index aab39e41..8902eaef 100644
--- a/test/site/content/posts/post-heading-slugs.md
+++ b/test/site/content/posts/post-heading-slugs.md
@@ -38,3 +38,37 @@ draft = false
### Ç {#ç}
+
+
+## Headings with HTML {#headings-with-html}
+
+
+### Checklist [1/3]
{#checklist}
+
+Above title would render to `Checklist [1/3]
` in
+Markdown.
+
+
+#### DONE Item 1 {#item-1}
+
+Above would render to `DONE Item 1`
+in Markdown.
+
+
+#### TODO Item 2 {#item-2}
+
+Above would render to `TODO Item 2`
+in Markdown.
+
+
+#### TODO Item 3 {#item-3}
+
+Above would render to `TODO Item 3`
+in Markdown.
+
+
+### Version 0.1 <2017-10-11 Wed> {#version-0-dot-1}
+
+Above title would render to `Version 0.1 <2017-10-11
+Wed>` in Markdown.