Skip to content

Commit

Permalink
Fix EXPORT_HUGO_SECTION not getting inherited
Browse files Browse the repository at this point in the history
Fixes #90

- Also update changelog
  • Loading branch information
kaushalmodi committed Oct 30, 2017
1 parent 9df23b7 commit c32359c
Show file tree
Hide file tree
Showing 8 changed files with 92 additions and 7 deletions.
13 changes: 13 additions & 0 deletions README.org
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,15 @@ 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
** v0.4.1 <2017-10-29 Sun>
*** Features
- Support specifying the =:height= parameter in the =#+ATTR_HTML=
above image links. That eventually gets transformed to the =height=
parameter in the =figure= tag in the HTML generated by Hugo. This
feature requires building Hugo from its master branch with commit
[[https://github.com/gohugoio/hugo/commit/488631fe0abc3667355345c7eb98ba7a2204deb5][488631fe]] (or Hugo v0.31+).
*** Fixes
- Fix =EXPORT_HUGO_SECTION= not getting inherited [[[https://github.com/kaushalmodi/ox-hugo/issues/90][90]]].
** v0.4 <2017-10-28 Sat>
*** Backward-incompatible changes
- Restore the default Org behavior of =#+TAGS=. Now that keyword (and
Expand All @@ -177,6 +186,10 @@ available customization options for this package.

See the new section added to documentation:
[[https://ox-hugo.scripter.co/doc/tags-and-categories][*Tags and Categories*]]
*** Features
- Support specifying the =:width= parameter in the =#+ATTR_HTML= above
image links. That eventually gets transformed to the =width=
parameter in the =figure= tag in the HTML generated by Hugo.
** v0.3.2 <2017-10-24 Tue>
*** Fixes
- Fix issue with headline metadata parsing (ALLTAGS, CLOSED, TODO)
Expand Down
24 changes: 24 additions & 0 deletions doc/content/doc/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,23 @@ draft = false
identifier = "changelog"
+++

## v0.4.1 <span class="timestamp-wrapper"><span class="timestamp">&lt;2017-10-29 Sun&gt;</span></span> {#v0-dot-4-dot-1}


### Features {#features}

- Support specifying the `:height` parameter in the `#+ATTR_HTML`
above image links. That eventually gets transformed to the `height`
parameter in the `figure` tag in the HTML generated by Hugo. This
feature requires building Hugo from its master branch with commit
[488631fe](https://github.com/gohugoio/hugo/commit/488631fe0abc3667355345c7eb98ba7a2204deb5) (or Hugo v0.31+).


### Fixes {#fixes}

- Fix `EXPORT_HUGO_SECTION` not getting inherited [[90](https://github.com/kaushalmodi/ox-hugo/issues/90)].


## v0.4 <span class="timestamp-wrapper"><span class="timestamp">&lt;2017-10-28 Sat&gt;</span></span> {#v0-dot-4}


Expand Down Expand Up @@ -33,6 +50,13 @@ See the new section added to documentation:
[**Tags and Categories**](/doc/tags-and-categories)


### Features {#features}

- Support specifying the `:width` parameter in the `#+ATTR_HTML` above
image links. That eventually gets transformed to the `width`
parameter in the `figure` tag in the HTML generated by Hugo.


## v0.3.2 <span class="timestamp-wrapper"><span class="timestamp">&lt;2017-10-24 Tue&gt;</span></span> {#v0-dot-3-dot-2}


Expand Down
13 changes: 13 additions & 0 deletions doc/ox-hugo-manual.org
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,15 @@
:PROPERTIES:
:CUSTOM_ID: changelog
:END:
** v0.4.1 <2017-10-29 Sun>
*** Features
- Support specifying the =:height= parameter in the =#+ATTR_HTML=
above image links. That eventually gets transformed to the =height=
parameter in the =figure= tag in the HTML generated by Hugo. This
feature requires building Hugo from its master branch with commit
[[https://github.com/gohugoio/hugo/commit/488631fe0abc3667355345c7eb98ba7a2204deb5][488631fe]] (or Hugo v0.31+).
*** Fixes
- Fix =EXPORT_HUGO_SECTION= not getting inherited {{{issue(90)}}}.
** v0.4 <2017-10-28 Sat>
*** Backward-incompatible changes
- Restore the default Org behavior of =#+TAGS=. Now that keyword (and
Expand All @@ -35,6 +44,10 @@

See the new section added to documentation:
{{{doc(tags-and-categories,*Tags and Categories*)}}}
*** Features
- Support specifying the =:width= parameter in the =#+ATTR_HTML= above
image links. That eventually gets transformed to the =width=
parameter in the =figure= tag in the HTML generated by Hugo.
** v0.3.2 <2017-10-24 Tue>
*** Fixes
- Fix issue with headline metadata parsing (ALLTAGS, CLOSED, TODO)
Expand Down
14 changes: 9 additions & 5 deletions ox-hugo.el
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
;; URL: https://ox-hugo.scripter.co
;; Package-Requires: ((emacs "24.5") (org "9.0"))
;; Keywords: Org, markdown, docs
;; Version: 0.4
;; Version: 0.4.1

;;; Commentary:

Expand Down Expand Up @@ -1905,7 +1905,12 @@ contents of hidden elements.
Return output file's name."
(interactive)
(org-hugo--before-export-function)
(let* ((info (org-combine-plists
;; Allow certain `ox-hugo' properties to be inherited. It is
;; important to set the `org-use-property-inheritance' before
;; setting the `info' var so that properties like
;; EXPORT_HUGO_SECTION get inherited.
(let* ((org-use-property-inheritance (org-hugo--selective-property-inheritance))
(info (org-combine-plists
(org-export--get-export-attributes
'hugo subtreep visible-only)
(org-export--get-buffer-attributes)
Expand All @@ -1920,9 +1925,8 @@ Return output file's name."
(pub-dir (let ((dir (concat base-dir content-dir section-dir)))
(make-directory dir :parents) ;Create the directory if it does not exist
dir))
(outfile (org-export-output-file-name ".md" subtreep pub-dir))
;; Allow certain `ox-hugo' properties to be inherited.
(org-use-property-inheritance (org-hugo--selective-property-inheritance)))
(outfile (org-export-output-file-name ".md" subtreep pub-dir)))
;; (message "[org-hugo-export-to-md DBG] section-dir = %s" section-dir)
(unless subtreep ;Reset the variables that are used only for subtree exports
(setq org-hugo--subtree-count 0)
(setq org-hugo--subtree-coord nil))
Expand Down
16 changes: 16 additions & 0 deletions test/site/content-org/all-posts.org
Original file line number Diff line number Diff line change
Expand Up @@ -1835,6 +1835,22 @@ a_{b} a_{bc} a^{b} a^{bc}
a_b a_bc a^b a^bc
*** Following text will export =_{..}= as subscript and =^{..}= as superscript
a_{b} a_{bc} a^{b} a^{bc}
* Section Inheritance :section_inheritance:
** Section A
:PROPERTIES:
:EXPORT_HUGO_SECTION: section-a
:END:
*** Post A1
:PROPERTIES:
:EXPORT_FILE_NAME: post-a1
:END:
This post should be created in =content/section-a/=.
*** Category X :@cat_x:
**** Post AX
:PROPERTIES:
:EXPORT_FILE_NAME: post-ax
:END:
This post should also be created in =content/section-a/=.
* TODO Pre-Draft State
:PROPERTIES:
:EXPORT_FILE_NAME: draft-state-todo
Expand Down
4 changes: 2 additions & 2 deletions test/site/content/posts/figure-shortcode-and-attr-html.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ image is 200px × 200px. But the image will still show up in 1000px ×

**NOTE**: Support for specifying `height` parameter to the Hugo `figure`
shortcut was only added recently in [hugo PR #4018](https://github.com/gohugoio/hugo/pull/4018). So setting this
parameter will need **hugo v0.31** or newer.
parameter will need **hugo v0.31** or later.

---

Expand All @@ -100,7 +100,7 @@ this image is 200px × 200px. But the image will still show up in

### Setting both `:width` and `:height` {#setting-both-width-and-height}

The **NOTE** above applies here too.. needs **hugo v0.31** or newer.
The **NOTE** above applies here too.. needs **hugo v0.31** or later.

The figure sizes below are intentionally set _mis-proportionally_ just
for testing.
Expand Down
7 changes: 7 additions & 0 deletions test/site/content/section-a/post-a1.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
+++
title = "Post A1"
tags = ["section-inheritance"]
draft = false
+++

This post should be created in `content/section-a/`.
8 changes: 8 additions & 0 deletions test/site/content/section-a/post-ax.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
+++
title = "Post AX"
tags = ["section-inheritance"]
categories = ["cat-x"]
draft = false
+++

This post should also be created in `content/section-a/`.

0 comments on commit c32359c

Please sign in to comment.