jgm / pandoc

Universal markup converter
https://pandoc.org
Other
34.39k stars 3.37k forks source link

Format template lua as fullpath is not working #6846

Closed mdtrooper closed 3 years ago

mdtrooper commented 3 years ago

I am trying to made a custom format and the next line fails:

$ pandoc -f markdown -t /tmp/sample.lua -s test.md -o test.html
Could not find data file /usr/share/pandoc/data/templates/default.sample.lua

I think when the format sample is a fullpath is easy to see.

Thanks, good project.

mdtrooper commented 3 years ago

And a workaround (with data-dir) does not run:

$ pandoc  --data-dir="/tmp" -f markdown -t sample.lua -s test.md -o test.html --verbose
Could not find data file /usr/share/pandoc/data/templates/default.sample.lua

My laptop has the next config:

$ pandoc --version
pandoc 2.5
Compiled with pandoc-types 1.17.5.4, texmath 0.11.2.2, skylighting 0.7.7
Default user data directory: /home/miguel/.pandoc
Copyright (C) 2006-2018 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.

$ dpkg -l | grep pandoc
ii  pandoc                                        2.5-3build2                             amd64        general markup converter
ii  pandoc-data                                   2.5-3build2                             all          general markup converter - data files

$ lsb_release -a
No LSB modules are available.
Distributor ID: Linuxmint
Description:    Linux Mint 20
Release:    20
Codename:   ulyana
mdtrooper commented 3 years ago

It is relatedship with https://github.com/jgm/pandoc/issues/5866 . But the sample code of sample.lua has the command line example, And it is not clearly:

-- This is a sample custom writer for pandoc.  It produces output
-- that is very similar to that of pandoc's HTML writer.
-- There is one new feature: code blocks marked with class 'dot'
-- are piped through graphviz and images are included in the HTML
-- output using 'data:' URLs. The image format can be controlled
-- via the `image_format` metadata field.
--
-- Invoke with: pandoc -t sample.lua
--
-- Note:  you need not have lua installed on your system to use this
-- custom writer.  However, if you do have lua installed, you can
-- use it to test changes to the script.  'lua sample.lua' will
-- produce informative error messages if your code contains
-- syntax errors.

local pipe = pandoc.pipe
local stringify = (require "pandoc.utils").stringify
mdtrooper commented 3 years ago

I close it, because it is my fault. It runs fine:

$ pandoc -f markdown -t sample.lua -s --template=/tmp/caca.html test.md -o test.html --verbose

Thanks.