Skip to content

Commit

Permalink
Add test for #339
Browse files Browse the repository at this point in the history
  • Loading branch information
kaushalmodi committed Jan 6, 2022
1 parent 73e11f9 commit 6ae98d0
Show file tree
Hide file tree
Showing 2 changed files with 69 additions and 0 deletions.
21 changes: 21 additions & 0 deletions test/site/content-org/all-posts.org
Expand Up @@ -188,6 +188,9 @@ This is an inline non-hyperlinked image with the width attribute:
[[/images/org-mode-unicorn-logo.png]]
*** Inline hyperlinked image
**** No Alt text or any other attributes
:PROPERTIES:
:CUSTOM_ID: inline-image-to-be-copied-to-static--no-attr
:END:
This is an inline non-hyperlinked image without alt text or other
attributes:
[[../files-to-be-copied-to-static/foo/copy-2-of-unicorn-logo.png][file:../files-to-be-copied-to-static/foo/copy-2-of-unicorn-logo.png]].
Expand Down Expand Up @@ -386,6 +389,24 @@ stop
#+attr_html: :inlined t
#+RESULTS:
[[file:images/svg-with-hyperlinks.svg]]
** Figures from included Org file :include:
:PROPERTIES:
:EXPORT_FILE_NAME: figures-from-included-org-file
:END:
{{{oxhugoissue(339)}}}

*** Including another subtree from this same file
This test can be truly tested by locally deleting
~test/site/static/ox-hugo/copy-2-of-unicorn-logo.png~ from this repo,
exporting this file and checking that the file got copied again.

#+include: "./all-posts.org::#inline-image-to-be-copied-to-static--no-attr" :only-contents t
*** Including a subtree from a file in different directory
This test can be truly tested by locally deleting
~test/site/static/ox-hugo/gnu.png~ from this repo, exporting this file
and checking that the file got copied again.

#+include: "./images-in-content/images-in-content.org::*Post 1" :only-contents t
* Video :videos:
** Embedded Video :embedded:
:PROPERTIES:
Expand Down
48 changes: 48 additions & 0 deletions test/site/content/posts/figures-from-included-org-file.md
@@ -0,0 +1,48 @@
+++
title = "Figures from included Org file"
tags = ["image", "include"]
draft = false
+++

`ox-hugo` Issue #[339](https://github.com/kaushalmodi/ox-hugo/issues/339)


## Including another subtree from this same file {#including-another-subtree-from-this-same-file}

This test can be truly tested by locally deleting
`test/site/static/ox-hugo/copy-2-of-unicorn-logo.png` from this repo,
exporting this file and checking that the file got copied again.

This is an inline non-hyperlinked image without alt text or other
attributes:
[![](/ox-hugo/copy-2-of-unicorn-logo.png)](/ox-hugo/copy-2-of-unicorn-logo.png).


## Including a subtree from a file in different directory {#including-a-subtree-from-a-file-in-different-directory}

This test can be truly tested by locally deleting
`test/site/static/ox-hugo/gnu.png` from this repo, exporting this file
and checking that the file got copied again.

Post 1 contents

I have the `gnu.png` file in the same directory that contains the
source Org file of this post.

```text
./content-org
├── images-in-content/
│ ├── images-in-content.org
│ │ * Post 1 (Org subtree) → ./content/images-in-content/post1.md **THIS POST**
│ │ * Post 2 (Org subtree) → ./content/images-in-content/post2.md
│ ├── gnu.png → ./static/ox-hugo/gnu.png **BELOW IMAGE**
│ └── org.png → ./static/ox-hugo/org.png
├── post3/
│ ├── post3.org → ./content/images-in-content/post3.md
│ └── gnu-copy.png → ./static/ox-hugo/gnu-copy.png
└── post4/
├── post4.org → ./content/images-in-content/post4.md
└── org-copy.png → ./static/ox-hugo/org-copy.png
```

{{< figure src="/ox-hugo/gnu.png" >}}

0 comments on commit 6ae98d0

Please sign in to comment.