Skip to content

Commit

Permalink
Make the bibliography section regexp a bit more robust
Browse files Browse the repository at this point in the history
The regexp now looks for a blank line to precede the bibliography
<div> section.

Right now the div section is inserted by oc-csl like this:

    ```

    <style>.csl-entry{text-indent: -1.5em; margin-left: 1.5em;}</style><div class="csl-bib-body">
    ```

This updated regex should work in the case that changes to something
like below as well:

    ```

    <style>.csl-entry{text-indent: -1.5em; margin-left: 1.5em;}</style>
    <div class="csl-bib-body">
    ```
  • Loading branch information
kaushalmodi committed Feb 11, 2022
1 parent 1fb65d6 commit 035b623
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions ox-hugo.el
Expand Up @@ -580,7 +580,8 @@ Some of the inbuilt functions that can be added to this list:
:group 'org-export-hugo
:type '(repeat function))

(defcustom org-hugo-citations-plist '(:bibliography-section-regexp "\n.*<div class=\"csl-bib-body\">"
(defcustom org-hugo-citations-plist '(:bibliography-section-regexp "\n\n\\(.\\|\\n\\)*?<div class=\"csl-bib-body\">"
;; ^^^^ blank line before the <div> block
:bibliography-section-heading "Bibliography")
"Property list for storing default properties for citation exports.
Expand Down Expand Up @@ -1964,7 +1965,7 @@ holding export options."
(level-mark (make-string (+ loffset 1) ?#)))
(setq contents (replace-regexp-in-string
bib-regexp
(format "\n%s %s\n\\&" level-mark bib-heading) contents)))))
(format "\n\n%s %s\\&" level-mark bib-heading) contents)))))

;; (message "[org-hugo-inner-template DBG] toc-level: %s" toc-level)
(org-trim (concat
Expand Down

0 comments on commit 035b623

Please sign in to comment.