Skip to content

Commit

Permalink
Add test for #552
Browse files Browse the repository at this point in the history
doc: Also improve the "Inlined SVG" section in the manual
  • Loading branch information
kaushalmodi committed Feb 4, 2022
1 parent ebf9a69 commit ae64fc1
Show file tree
Hide file tree
Showing 4 changed files with 98 additions and 3 deletions.
24 changes: 21 additions & 3 deletions doc/ox-hugo-manual.org
Expand Up @@ -3019,20 +3019,38 @@ The /section path/ derived at this level is ~"main/sub2/"~.
Inlined SVGs are supported by a new HTML attribute introduced by
~ox-hugo~: *inlined*.

Simply add ~#+attr_html: :inlined t~ above the SVG file link.
Just add ~#+attr_html: :inlined t~
#+begin_mark
above the SVG file link
#+end_mark
.

Here's an example of inlining an SVG:

#+begin_src org
,#+caption: An SVG with hyperlink
,#+begin_src plantuml :file ../test/site/content-org/images/svg-with-hyperlinks.svg :exports results
skinparam svgLinkTarget _parent
start
:[[https://ox-hugo.scripter.co/ ox-hugo homepage]];
stop
,#+end_src
,#+caption: An SVG with a *hyperlink*
,#+attr_html: :inlined t
,#+RESULTS:
[[file:../test/site/content-org/images/svg-with-hyperlinks.svg]]
#+end_src

.. which results in:

#+caption: An SVG with hyperlink
#+begin_src plantuml :file ../test/site/content-org/images/svg-with-hyperlinks.svg :exports results
skinparam svgLinkTarget _parent
start
:[[https://ox-hugo.scripter.co/ ox-hugo homepage]];
stop
#+end_src
#+caption: An SVG with a *hyperlink*
#+attr_html: :inlined t
#+RESULTS:
[[file:../test/site/content-org/images/svg-with-hyperlinks.svg]]
*** CJK Support
:PROPERTIES:
Expand Down
11 changes: 11 additions & 0 deletions test/site/content-org/all-posts.org
Expand Up @@ -389,6 +389,17 @@ stop
#+attr_html: :inlined t
#+RESULTS:
[[file:images/svg-with-hyperlinks.svg]]
*** Captioned source block followed by an inlined SVG
{{{oxhugoissue(552)}}}

#+caption: My class diagram
#+begin_src plantuml :file images/issue-552.svg :exports both
class A
url of A is [[https://example.org/]]
#+end_src
#+attr_html: :inlined t
#+RESULTS:
[[file:images/issue-552.svg]]
** Figures from included Org file :include:
:PROPERTIES:
:EXPORT_FILE_NAME: figures-from-included-org-file
Expand Down
17 changes: 17 additions & 0 deletions test/site/content-org/images/issue-552.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
49 changes: 49 additions & 0 deletions test/site/content/posts/inlined-svg.md
Expand Up @@ -54,3 +54,52 @@ style="stroke: #A80036; stroke-width: 1.0;"/></g></svg>

<span class="figure-number">Figure 1: </span>An SVG with **hyperlinks** -- generated using PlantUML
</div>


## Captioned source block followed by an inlined SVG {#captioned-source-block-followed-by-an-inlined-svg}

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

```plantuml
class A
url of A is [[https://example.org/]]
```

<div class="src-block-caption">
<span class="src-block-number">Code Snippet 1</span>:
My class diagram
</div>

<svg
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
contentScriptType="application/ecmascript" contentStyleType="text/css"
height="67px" preserveAspectRatio="none"
style="width:57px;height:67px;" version="1.1" viewBox="0 0 57 67"
width="57px" zoomAndPan="magnify"><defs><filter height="300%"
id="f492as0tkgyr4" width="300%" x="-1" y="-1"><feGaussianBlur
result="blurOut" stdDeviation="2.0"/><feColorMatrix in="blurOut"
result="blurOut2" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 .4 0"/><feOffset dx="4.0" dy="4.0" in="blurOut2"
result="blurOut3"/><feBlend in="SourceGraphic" in2="blurOut3"
mode="normal"/></filter></defs><g><a target="_top"
xlink:actuate="onRequest" xlink:href="https://example.org/"
xlink:show="new" xlink:title="https://example.org/"
xlink:type="simple"><rect fill="#FEFECE" filter="url(#f492as0tkgyr4)"
height="48" id="A" style="stroke: #A80036; stroke-width: 1.5;"
width="40" x="6" y="8"/><ellipse cx="21" cy="24" fill="#ADD1B2"
rx="11" ry="11" style="stroke: #A80036; stroke-width: 1.0;"/><path
d="M23.9688,29.6406 Q23.3906,29.9375 22.75,30.0781 Q22.1094,30.2344
21.4063,30.2344 Q18.9063,30.2344 17.5781,28.5938 Q16.2656,26.9375
16.2656,23.8125 Q16.2656,20.6875 17.5781,19.0313 Q18.9063,17.375
21.4063,17.375 Q22.1094,17.375 22.75,17.5313 Q23.4063,17.6875
23.9688,17.9844 L23.9688,20.7031 Q23.3438,20.125 22.75,19.8594
Q22.1563,19.5781 21.5313,19.5781 Q20.1875,19.5781 19.5,20.6563
Q18.8125,21.7188 18.8125,23.8125 Q18.8125,25.9063 19.5,26.9844
Q20.1875,28.0469 21.5313,28.0469 Q22.1563,28.0469 22.75,27.7813
Q23.3438,27.5 23.9688,26.9219 L23.9688,29.6406 Z "/><text
fill="#000000" font-family="sans-serif" font-size="12"
lengthAdjust="spacingAndGlyphs" textLength="8" x="35"
y="28.1543">A</text><line style="stroke: #A80036; stroke-width: 1.5;"
x1="7" x2="45" y1="40" y2="40"/><line style="stroke: #A80036;
stroke-width: 1.5;" x1="7" x2="45" y1="48" y2="48"/></a></g></svg>

0 comments on commit ae64fc1

Please sign in to comment.