Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

paths using a tilde prefix not discovered with --self-contained #3135

Closed
kevinushey opened this issue Sep 29, 2016 · 3 comments
Closed

paths using a tilde prefix not discovered with --self-contained #3135

kevinushey opened this issue Sep 29, 2016 · 3 comments

Comments

@kevinushey
Copy link

kevinushey commented Sep 29, 2016

This might be intentional / by design, but wanted to log for posterity. Suppose we do have an image at the path ~/scratch/image.png, and the following Markdown file:

# Hello Markdown
![An Image](~/scratch/image.png)

Attempting to call pandoc with this gives:

kevin@cdrv:~/scratch
$ pandoc hello.md --self-contained
pandoc: Could not fetch ~/scratch/test.png
~/scratch/test.png: openBinaryFile: does not exist (No such file or directory)

This example works fine with a full path rather than an aliased path. Any chance pandoc could do tilde expansion on paths for self-contained documents (replacing with the value of an environment variable, e.g. HOME (USERPROFILE on Windows)?


$ pandoc --version
pandoc 1.17.2
Compiled with texmath 0.8.6.4, highlighting-kate 0.6.2.1.
Syntax highlighting is supported for the following languages:
    abc, actionscript, ada, agda, apache, asn1, asp, awk, bash, bibtex, boo, c,
    changelog, clojure, cmake, coffee, coldfusion, commonlisp, cpp, cs, css,
    curry, d, diff, djangotemplate, dockerfile, dot, doxygen, doxygenlua, dtd,
    eiffel, elixir, email, erlang, fasm, fortran, fsharp, gcc, glsl,
    gnuassembler, go, hamlet, haskell, haxe, html, idris, ini, isocpp, java,
    javadoc, javascript, json, jsp, julia, kotlin, latex, lex, lilypond,
    literatecurry, literatehaskell, llvm, lua, m4, makefile, mandoc, markdown,
    mathematica, matlab, maxima, mediawiki, metafont, mips, modelines, modula2,
    modula3, monobasic, nasm, noweb, objectivec, objectivecpp, ocaml, octave,
    opencl, pascal, perl, php, pike, postscript, prolog, pure, python, r,
    relaxng, relaxngcompact, rest, rhtml, roff, ruby, rust, scala, scheme, sci,
    sed, sgml, sql, sqlmysql, sqlpostgresql, tcl, tcsh, texinfo, verilog, vhdl,
    xml, xorg, xslt, xul, yacc, yaml, zsh
Default user data directory: /Users/kevin/.pandoc
Copyright (C) 2006-2016 John MacFarlane
Web:  http://pandoc.org
This is free software; see the source for copying conditions.
There is no warranty, not even for merchantability or fitness
for a particular purpose.
@jgm
Copy link
Owner

jgm commented Oct 2, 2016

The tilde expansion is done by the shell and varies from one shell to another. It doesn't seem any more appropriate for pandoc to expand ~ than it would be for pandoc to expand ? or * or $HOME.

@jkr
Copy link
Collaborator

jkr commented Oct 4, 2016

Should there be some pandoc convention, though, for refering to $HOME? I have a single default bib file for all my academic writing, and I can't refer to it in YAML in a way that will work on both OSX and linux. I usually solve this by using a Makefile, which enters the bib as a command-line option. But in quick one-offs, it would be nice to refer to it in the YAML. Similarly, I can imagine there might be folks who want to use a resource in an image across multiple files (say, a company logo for letters) without copying it into each project dir.

@jgm
Copy link
Owner

jgm commented Nov 20, 2016

Closing this. @jkr, re your question, I think a better approach would be some kind of environment variable that pandoc-citeproc would look in for bibliography files, see #3212.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants