public inbox archive for pandoc-discuss@googlegroups.com
 help / color / mirror / Atom feed
* Specify two separate paths for --extract-media?
@ 2018-07-29 13:39 Axel Rauschmayer
       [not found] ` <2a6f3744-e2a7-4423-bb7c-ec83ddb3133f-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
  0 siblings, 1 reply; 4+ messages in thread
From: Axel Rauschmayer @ 2018-07-29 13:39 UTC (permalink / raw)
  To: pandoc-discuss


[-- Attachment #1.1: Type: text/plain, Size: 1928 bytes --]

The use case is as follows.

*Problem*

Files:

  # Input
  content/foo.md
  content/img/diagram.svg

  # Output (out/ is a build directory that is gitignored and often cleared)
  out/foo.html
  out/img/diagram.svg

Command:

  pandoc --standalone -o out/foo.html --extract-media=out content/foo.md

Input:

  Image: ![](img/diagram.svg)

Actual output:

  Image: <img src="out/img/diagram.svg" />

Desired output:

  Image: <img src="img/diagram.svg" />

*Possible solutions*

Possible solution 1 – introduce a new reader option extract-media-base for 
the HTML base path. It complements extract-media and its default value is 
extract-media. For example:

  pandoc --standalone -o out/foo.html --extract-media=out 
--extract-media-base='' content/foo.md

Possible solution 2 –  introduce a completely new and independent reader 
option extract-media-into where media paths into the extraction directory 
out/ are always relative to the path specified via --output:

  pandoc --standalone -o out/foo.html --extract-media-into=out
 content/foo.md

Possible solution 3 – introduce a flag that changes how extract-media
 operates:

  pandoc --standalone -o out/foo.html --extract-media-base-is-output
 --extract-media=out content/foo.md

Am I making sense? Or am I thinking about this wrong?

-- 
You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To post to this group, send email to pandoc-discuss-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/2a6f3744-e2a7-4423-bb7c-ec83ddb3133f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

[-- Attachment #1.2: Type: text/html, Size: 5205 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Specify two separate paths for --extract-media?
       [not found] ` <2a6f3744-e2a7-4423-bb7c-ec83ddb3133f-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
@ 2018-07-30 18:13   ` John MacFarlane
       [not found]     ` <m2h8kgy4l7.fsf-pgq/RBwaQ+zq8tPRBa0AtqxOck334EZe@public.gmane.org>
  0 siblings, 1 reply; 4+ messages in thread
From: John MacFarlane @ 2018-07-30 18:13 UTC (permalink / raw)
  To: Axel Rauschmayer, pandoc-discuss

Axel Rauschmayer <rauschma-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> writes:

How about

mkdir -p out
cd out
pandoc --standalone -o foo.html --extract-media=. ../content/foo.md


> The use case is as follows.
>
> *Problem*
>
> Files:
>
>   # Input
>   content/foo.md
>   content/img/diagram.svg
>
>   # Output (out/ is a build directory that is gitignored and often cleared)
>   out/foo.html
>   out/img/diagram.svg
>
> Command:
>
>   pandoc --standalone -o out/foo.html --extract-media=out content/foo.md
>
> Input:
>
>   Image: ![](img/diagram.svg)
>
> Actual output:
>
>   Image: <img src="out/img/diagram.svg" />
>
> Desired output:
>
>   Image: <img src="img/diagram.svg" />
>
> *Possible solutions*
>
> Possible solution 1 – introduce a new reader option extract-media-base for 
> the HTML base path. It complements extract-media and its default value is 
> extract-media. For example:
>
>   pandoc --standalone -o out/foo.html --extract-media=out 
> --extract-media-base='' content/foo.md
>
> Possible solution 2 –  introduce a completely new and independent reader 
> option extract-media-into where media paths into the extraction directory 
> out/ are always relative to the path specified via --output:
>
>   pandoc --standalone -o out/foo.html --extract-media-into=out
>  content/foo.md
>
> Possible solution 3 – introduce a flag that changes how extract-media
>  operates:
>
>   pandoc --standalone -o out/foo.html --extract-media-base-is-output
>  --extract-media=out content/foo.md
>
> Am I making sense? Or am I thinking about this wrong?
>
> -- 
> You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
> To post to this group, send email to pandoc-discuss-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
> To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/2a6f3744-e2a7-4423-bb7c-ec83ddb3133f%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To post to this group, send email to pandoc-discuss-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/m2h8kgy4l7.fsf%40johnmacfarlane.net.
For more options, visit https://groups.google.com/d/optout.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Specify two separate paths for --extract-media?
       [not found]     ` <m2h8kgy4l7.fsf-pgq/RBwaQ+zq8tPRBa0AtqxOck334EZe@public.gmane.org>
@ 2018-07-30 19:55       ` Axel Rauschmayer
  2018-08-01 17:17       ` Axel Rauschmayer
  1 sibling, 0 replies; 4+ messages in thread
From: Axel Rauschmayer @ 2018-07-30 19:55 UTC (permalink / raw)
  To: pandoc-discuss


[-- Attachment #1.1: Type: text/plain, Size: 959 bytes --]


>
> How about 
>
 

mkdir -p out 
> cd out 
> pandoc --standalone -o foo.html --extract-media=. ../content/foo.md 


Cool, that works, thanks!

If you have time: Wouldn’t creating paths in foo.html relative to foo.html 
(vs. relative to the current working directory) be a better approach? Are 
there things that the current approach enables that you’d lose?

-- 
You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To post to this group, send email to pandoc-discuss-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/8aa1827c-b61f-4ee6-993e-32acd01d1a23%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

[-- Attachment #1.2: Type: text/html, Size: 1958 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Specify two separate paths for --extract-media?
       [not found]     ` <m2h8kgy4l7.fsf-pgq/RBwaQ+zq8tPRBa0AtqxOck334EZe@public.gmane.org>
  2018-07-30 19:55       ` Axel Rauschmayer
@ 2018-08-01 17:17       ` Axel Rauschmayer
  1 sibling, 0 replies; 4+ messages in thread
From: Axel Rauschmayer @ 2018-08-01 17:17 UTC (permalink / raw)
  To: pandoc-discuss


[-- Attachment #1.1: Type: text/plain, Size: 1194 bytes --]

Alas, I spoke to soon: I need to be in the same directory as the content, 
so that \includepdf{} works with relative paths. That is also a work-around 
– for that command not handling spaces (in the latest version of XeLaTeX – 
it did before, see (*)). And spaces in the path are something I can’t 
change at the moment.

I think I’ll stick with my original approach: choose a long unique name for 
the extracted media directory and then search-and-replace in the produced 
HTML output and copying the original directory into the build location.

(*) https://github.com/ho-tex/oberdiek/issues/31

-- 
You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To post to this group, send email to pandoc-discuss-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/0c48e6e1-3fcd-4a72-a61b-166e6213a32c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

[-- Attachment #1.2: Type: text/html, Size: 1675 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2018-08-01 17:17 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-07-29 13:39 Specify two separate paths for --extract-media? Axel Rauschmayer
     [not found] ` <2a6f3744-e2a7-4423-bb7c-ec83ddb3133f-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2018-07-30 18:13   ` John MacFarlane
     [not found]     ` <m2h8kgy4l7.fsf-pgq/RBwaQ+zq8tPRBa0AtqxOck334EZe@public.gmane.org>
2018-07-30 19:55       ` Axel Rauschmayer
2018-08-01 17:17       ` Axel Rauschmayer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).