Skip to content

Commit

Permalink
Refactor headline -> heading for consistency
Browse files Browse the repository at this point in the history
Motivation for this change:
- https://lists.gnu.org/r/emacs-orgmode/2021-07/msg00563.html
- https://lists.gnu.org/r/emacs-orgmode/2021-08/msg00056.html

While that change hasn't yet entered the Org mode codebase of today
<2022/01/03>, I like the idea of using the term "heading" instead of
"headline".

Definitions from WordNet (ref:
https://lists.gnu.org/r/emacs-orgmode/2021-07/msg00576.html):

  heading
      n 1: a line of text serving to indicate what the passage below
           it is about; "the heading seemed to have little to do with
           the text" [syn: {heading}, {header}, {head}]
  headline
      n 1: the heading or caption of a newspaper article [syn:
           {headline}, {newspaper headline}]
  • Loading branch information
kaushalmodi committed Jan 3, 2022
1 parent dcf668a commit 2bd84cc
Show file tree
Hide file tree
Showing 19 changed files with 156 additions and 151 deletions.
6 changes: 3 additions & 3 deletions README.org
Original file line number Diff line number Diff line change
Expand Up @@ -388,15 +388,15 @@ to an empty string (=""=).
#[[https://github.com/kaushalmodi/ox-hugo/issues/89][89]].
- File-based exports must now use =#+hugo_tags= to set the post tags.
- Subtree-based exports can use the =EXPORT_HUGO_TAGS= property to
override Org-style tags on the same headline (and the ones inherited
override Org-style tags on the same heading (and the ones inherited
from Org-style tags from any of the parent subtrees and
=#+filetags=).
- Note that for subtree-based exports, =#+filetags= can be used to
set tags globally in the file. Earlier =#+tags= was used for that
purpose.
- Subtree-based exports can use the =EXPORT_HUGO_CATEGORIES= property
to override Org-style categories (tags with "@" prefix) on the same
headline (and the ones inherited from Org-style categories from any
heading (and the ones inherited from Org-style categories from any
of the parent subtrees and =#+filetags=).
- Note that for subtree-based exports, =#+filetags= can be used to
set categories (tags with "@") globally in the file.
Expand All @@ -409,7 +409,7 @@ See the new section added to documentation:
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)
- Fix issue with heading metadata parsing (ALLTAGS, CLOSED, TODO)
when a post Org heading was immediately followed by that post's
sub-heading. This issue was seen in subtree-based exports
#[[https://github.com/kaushalmodi/ox-hugo/issues/87][87]].
Expand Down
18 changes: 9 additions & 9 deletions doc/ox-hugo-manual.org
Original file line number Diff line number Diff line change
Expand Up @@ -218,15 +218,15 @@
{{{issue(89)}}}.
- File-based exports must now use =#+hugo_tags= to set the post tags.
- Subtree-based exports can use the =EXPORT_HUGO_TAGS= property to
override Org-style tags on the same headline (and the ones inherited
override Org-style tags on the same heading (and the ones inherited
from Org-style tags from any of the parent subtrees and
=#+filetags=).
- Note that for subtree-based exports, =#+filetags= can be used to
set tags globally in the file. Earlier =#+tags= was used for that
purpose.
- Subtree-based exports can use the =EXPORT_HUGO_CATEGORIES= property
to override Org-style categories (tags with "@" prefix) on the same
headline (and the ones inherited from Org-style categories from any
heading (and the ones inherited from Org-style categories from any
of the parent subtrees and =#+filetags=).
- Note that for subtree-based exports, =#+filetags= can be used to
set categories (tags with "@") globally in the file.
Expand All @@ -239,7 +239,7 @@ See the new section added to documentation:
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)
- Fix issue with heading metadata parsing (ALLTAGS, CLOSED, TODO)
when a post Org heading was immediately followed by that post's
sub-heading. This issue was seen in subtree-based exports
{{{issue(87)}}}.
Expand Down Expand Up @@ -1702,12 +1702,12 @@ Though, the advantage of Org-generated TOC is that you get finer
control on:
- *Where* to include the TOC --- Location of the =#+toc= keyword in the
Org content.
- How many headlines to include in the TOC --- /Example: =#+toc:
headlines 2=/ or =:EXPORT_OPTIONS: toc:2=.
- Whether you want *all* the headlines in the TOC to be numbered or
- How many headings to include in the TOC --- /Example: =#+toc:
headings 2=/ or =:EXPORT_OPTIONS: toc:2=.
- Whether you want *all* the headings in the TOC to be numbered or
not --- See =org-hugo-export-with-section-numbers=.
- Whether you want *only some* headlines numbered (both in post body
and the TOC) --- Set the =UNNUMBERED= property of that headline to
- Whether you want *only some* headings numbered (both in post body
and the TOC) --- Set the =UNNUMBERED= property of that heading to
=t=.
- Whether you want to list the sub-headings *only from the current
heading in the post* --- /Example: ~#+toc: headlines 1 local~/.
Expand Down Expand Up @@ -2246,7 +2246,7 @@ Hit =C-x C-s= and be in awe as the browser auto-refreshes to the
If you do not want to manually type the =EXPORT_FILE_NAME= for each
new post, here is an example Org Capture template can help:
#+begin_src emacs-lisp
;; Populates only the EXPORT_FILE_NAME property in the inserted headline.
;; Populates only the EXPORT_FILE_NAME property in the inserted heading.
(with-eval-after-load 'org-capture
(defun org-hugo-new-subtree-post-capture-template ()
"Returns `org-capture' template string for new Hugo post.
Expand Down
26 changes: 13 additions & 13 deletions ox-blackfriday.el
Original file line number Diff line number Diff line change
Expand Up @@ -130,15 +130,15 @@ tag needs to be `python'."
;;; Miscellaneous Helper Functions

;;;; Table of contents
(defun org-blackfriday-format-toc (headline info)
"Return an appropriate table of contents entry for HEADLINE.
(defun org-blackfriday-format-toc (heading info)
"Return an appropriate table of contents entry for HEADING.
INFO is a plist used as a communication channel."
(let* ((title (org-export-data (org-export-get-alt-title headline info) info))
(level (1- (org-element-property :level headline)))
(let* ((title (org-export-data (org-export-get-alt-title heading info) info))
(level (1- (org-element-property :level heading)))
(indent (concat (make-string (* level 2) ? )))
(anchor (or (org-element-property :CUSTOM_ID headline)
(org-export-get-reference headline info))))
(anchor (or (org-element-property :CUSTOM_ID heading)
(org-export-get-reference heading info))))
(concat indent "- [" title "]" "(#" anchor ")")))

;;;; Footnote section
Expand Down Expand Up @@ -651,14 +651,14 @@ CONTENTS is nil. INFO is a plist holding contextual information."
CONTENTS is the transcoded contents string. INFO is a plist
holding export options."
(let* ((depth (plist-get info :with-toc))
(headlines (and depth (org-export-collect-headlines info depth)))
(toc-tail (if headlines "\n\n" ""))
(headings (and depth (org-export-collect-headlines info depth)))
(toc-tail (if headings "\n\n" ""))
(toc-string ""))

(when headlines
(dolist (headline headlines)
(when headings
(dolist (heading headings)
(setq toc-string (concat toc-string
(org-blackfriday-format-toc headline info)
(org-blackfriday-format-toc heading info)
"\n"))))
(org-trim (concat toc-string toc-tail contents "\n"
(org-blackfriday-footnote-section nil info)))))
Expand Down Expand Up @@ -1242,7 +1242,7 @@ asynchronously. The resulting buffer should be accessible
through the `org-export-stack' interface.
When optional argument SUBTREEP is non-nil, export the sub-tree
at point, extracting information from the headline properties
at point, extracting information from the heading properties
first.
When optional argument VISIBLE-ONLY is non-nil, don't export
Expand Down Expand Up @@ -1280,7 +1280,7 @@ asynchronously. The resulting file should be accessible through
the `org-export-stack' interface.
When optional argument SUBTREEP is non-nil, export the sub-tree
at point, extracting information from the headline properties
at point, extracting information from the heading properties
first.
When optional argument VISIBLE-ONLY is non-nil, don't export
Expand Down
Loading

0 comments on commit 2bd84cc

Please sign in to comment.