Skip to content

Commit

Permalink
test: add external id link test org files & fix
Browse files Browse the repository at this point in the history
  • Loading branch information
coldnight committed Jul 23, 2021
1 parent dc24a0c commit 2fd5e6b
Show file tree
Hide file tree
Showing 5 changed files with 193 additions and 5 deletions.
13 changes: 8 additions & 5 deletions ox-hugo.el
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,8 @@
;; `org-refile.el' is new in Org 9.4
;; https://code.orgmode.org/bzg/org-mode/commit/f636cf91b6cbe322eca56e23283f4614548c9d65
(require 'org-refile nil :noerror) ;For `org-get-outline-path'
(require 'org-id nil :noerror) ;For `org-id-goto'

(declare-function org-hugo-pandoc-cite--parse-citations-maybe "ox-hugo-pandoc-cite")

(defvar ffap-url-regexp) ;Silence byte-compiler
Expand Down Expand Up @@ -2050,6 +2052,7 @@ and rewrite link paths to make blogging more seamless."
(raw-path (org-element-property :path link))
(type (org-element-property :type link))
(link-is-url (member type '("http" "https" "ftp" "mailto"))))

(when (and (stringp raw-path)
link-is-url)
(setq raw-path (org-blackfriday--url-sanitize
Expand Down Expand Up @@ -4011,11 +4014,11 @@ links."
;; in the current buffer.
(ast (org-element-parse-buffer))
(org-use-property-inheritance (org-hugo--selective-property-inheritance))
(info (org-combine-plists
(list :parse-tree ast)
(org-export--get-export-attributes 'hugo)
(org-export--get-buffer-attributes)
(org-export-get-environment 'hugo)))
(info (org-export--collect-tree-properties ast (org-combine-plists
(list :parse-tree ast)
(org-export--get-export-attributes 'hugo)
(org-export--get-buffer-attributes)
(org-export-get-environment 'hugo))))
(local-variables (buffer-local-variables))
(bound-variables (org-export--list-bound-variables))
vars)
Expand Down
86 changes: 86 additions & 0 deletions test/site/content-org/org-id-link-child.org
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
:PROPERTIES:
:ID: FAADA682-B553-48BE-AC15-F80BDEE5A962
:END:
#+title: Org-mode ID links child
#+hugo_base_dir: ../.
#+hugo_section: org-id-links
#+author:

This is page with org-id created, and other pages can link this post
via org-id.

balala.

balala.

balala.

balala.

balala.

balala.

balala.

balala.

balala.

balala.

balala.

balala.

balala.

balala.

balala.

balala.

balala.

balala.


* Section
:PROPERTIES:
:ID: E34A55C5-0F05-437E-B3F1-23B2A32743A2
:END:
In this section, we also created a org-id. That is supported to link
via org-id too.

balala.

balala.

balala.

balala.

balala.

balala.

balala.

balala.

balala.

balala.

balala.

balala.

balala.

balala.

balala.

balala.
9 changes: 9 additions & 0 deletions test/site/content-org/org-id-link-parent.org
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#+title: Org-mode ID links parent
#+hugo_base_dir: ../.
#+hugo_section: org-id-links
#+author:

This is a parent page that link other page via Org-mode id links:

- Point to a org file [[id:FAADA682-B553-48BE-AC15-F80BDEE5A962][Org-mode id links child]]
- Point to a section in org file [[id:E34A55C5-0F05-437E-B3F1-23B2A32743A2][Section]]
81 changes: 81 additions & 0 deletions test/site/content/org-id-links/org-id-link-child.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
+++
title = "Org-mode ID links child"
draft = false
+++

This is page with org-id created, and other pages can link this post
via org-id.

balala.

balala.

balala.

balala.

balala.

balala.

balala.

balala.

balala.

balala.

balala.

balala.

balala.

balala.

balala.

balala.

balala.

balala.


## Section {#section}

In this section, we also created a org-id. That is supported to link
via org-id too.

balala.

balala.

balala.

balala.

balala.

balala.

balala.

balala.

balala.

balala.

balala.

balala.

balala.

balala.

balala.

balala.
9 changes: 9 additions & 0 deletions test/site/content/org-id-links/org-id-link-parent.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
+++
title = "Org-mode ID links parent"
draft = false
+++

This is a parent page that link other page via Org-mode id links:

- Point to a org file [Org-mode id links child]({{<relref "org-id-link-child.md#" >}})
- Point to a section in org file [Section]({{<relref "org-id-link-child.md#section" >}})

0 comments on commit 2fd5e6b

Please sign in to comment.