\".
+- Prepend Pandoc inserted \"references\" class div with Markdown
+ heading \"## References\" where the number of hashes depends on
+ LOFFSET. LOFFSET = 1 will insert 2 hashes.
-- Replace \"^:::$\" with closing HTML div tags.
+- Add the Blackfriday required \"
\" hack to Pandoc
+ divs with \"ref\" id's.
-LOFFSET is the offset added to the base level of 1 for headings."
+- Unescape the Hugo shortcodes: \"{{\\\\=< shortcode \\\\=>}}\" ->
+ \"{{< shortcode >}}\"."
(with-temp-buffer
(insert content)
(let ((case-fold-search nil)
(level-mark (make-string (+ loffset 1) ?#)))
(goto-char (point-min))
+
+ ;; Prepend the Pandoc inserted "references" class div with
+ ;; "References" heading in Markdown.
+ (save-excursion
+ ;; There should be at max only one replacement needed for
+ ;; this.
+ (when (re-search-forward org-hugo-pandoc-cite--references-header-regexp nil :noerror)
+ (replace-match (concat level-mark
+ " References {#references}\n\n"
+ "\\&\n
\n")))) ;See footnote 1
+
+ ;; Add the Blackfriday required hack to Pandoc ref divs.
+ (save-excursion
+ (let ((regexp "^
$"))
+ (while (re-search-forward regexp nil :noerror)
+ (replace-match "\\&\n
")))) ;See footnote 1
+
;; Fix Hugo shortcodes.
(save-excursion
(let ((regexp (concat "{{\\\\<"
@@ -165,28 +182,7 @@ LOFFSET is the offset added to the base level of 1 for headings."
"\\\\>}}")))
(while (re-search-forward regexp nil :noerror)
(replace-match "{{< \\1 >}}" :fixedcase))))
- ;; Convert Pandoc ref ID style to HTML div's.
- (save-excursion
- (let ((regexp "^::: {#ref-\\(.+?\\)}$"))
- (while (re-search-forward regexp nil :noerror)
- (replace-match (concat "
"
- "\n
\n") ;See footnote 1
- :fixedcase)
- (re-search-forward "^:::$")
- (replace-match "\n
"))))
- ;; Replace "::: {#refs .references}" with a base-level
- ;; "References" heading in Markdown, followed by an opening HTML
- ;; div tag.
- (save-excursion
- ;; There should be at max only one replacement needed for
- ;; this.
- (when (re-search-forward org-hugo-pandoc-cite--references-header-regexp nil :noerror)
- (replace-match (concat level-mark
- " References {#references}\n\n"
- "
"
- "\n
\n\n")) ;See footnote 1
- (re-search-forward "^:::$")
- (replace-match "\n\n
")))
+
(buffer-substring-no-properties (point-min) (point-max)))))
(defun org-hugo-pandoc-cite--parse-citations (info orig-outfile)
diff --git a/test/site/content-org/all-posts.org b/test/site/content-org/all-posts.org
index 518976f..14bb6bb 100644
--- a/test/site/content-org/all-posts.org
+++ b/test/site/content-org/all-posts.org
@@ -4624,6 +4624,10 @@ Some text.
#+begin_myshortcode
Text not containing *Markdown*
#+end_myshortcode
+*** Testing ox-hugo inserted HTML div tags
+#+begin_foo
+*bold* /italics/
+#+end_foo
*** Testing tables
|----------+----------+----------|
| Header 1 | Header 2 | Header 3 |
diff --git a/test/site/content/posts/citations-example-toml.md b/test/site/content/posts/citations-example-toml.md
index 2c08ebe..4d35ce7 100644
--- a/test/site/content/posts/citations-example-toml.md
+++ b/test/site/content/posts/citations-example-toml.md
@@ -31,6 +31,18 @@ Some text.
{{< myshortcode >}} Text not containing **Markdown** {{< /myshortcode >}}
+## Testing ox-hugo inserted HTML div tags
+
+
+
+
+
+
+
+**bold** *italics*
+
+
+
## Testing tables
| Header 1 | Header 2 | Header 3 |
@@ -78,7 +90,6 @@ Level."