Giter Club home page Giter Club logo

Comments (8)

odkr avatar odkr commented on July 20, 2024

No good ones. Which version do you mean by "latest dev version"? Pandoc's master branch as per May 4? I just tried to compile 8fc5766 (most recent), d3ec53b (May 4), and 97fe2ea16 (May 3), but cabal install fails to install haddock in every case. How did you get it to compile?

from pandoc-zotxt.lua.

njbart avatar njbart commented on July 20, 2024

I’ve been trying 8fc5766 and the currently most recent 82eb4df28 (resulting in the same error as described above). As to installing, I’m following the instructions at https://github.com/jgm/pandoc/wiki/Installing-the-development-version-of-pandoc, using stack rather than cabal-install.

from pandoc-zotxt.lua.

odkr avatar odkr commented on July 20, 2024

Thanks for the pointer. I can re-predouce the error. pandoc-citeproc is not involved at all, which was to expect:

Calling

echo @adorno1967SociologyPsychologyPart | ./pandoc -L pandoc-zotxt.lua -F pandoc-citeproc

outputs:

Error running filter /Users/odin/.pandoc/filters/pandoc-zotxt.lua:
PandocCouldNotFindDataFileError "lunajson.lua"
stack traceback:
[C]: in ?
[C]: in function 'require'
/Users/odin/.pandoc/filters/pandoc-zotxt.lua:179: in main chunk
bin$ echo @adorno1967SociologyPsychologyPart | ./pandoc -L pandoc-zotxt.lua
Error running filter /Users/odin/.pandoc/filters/pandoc-zotxt.lua:
PandocCouldNotFindDataFileError "lunajson.lua"
stack traceback:
[C]: in ?
[C]: in function 'require'
/Users/odin/.pandoc/filters/pandoc-zotxt.lua:179: in main chunk

I've created a debug version of the filter, called pandoc-zotxt-debug.lua, with the additional line

io.stderr:write(PANDOC_SCRIPT_FILE, '\n', package.path, '\n')

above the local json = require 'lunajson' statement.

Calling

echo @adorno1967SociologyPsychologyPart | ./pandoc -L pandoc-zotxt-debug.lua

outputs:

/Users/odin/.pandoc/filters/pandoc-zotxt-debug.lua
/usr/local/Cellar/luarocks/3.2.1/share/lua/5.3/?.lua;/usr/local/share/lua/5.3/?.lua;/usr/local/share/lua/5.3/?/init.lua;/usr/local/lib/lua/5.3/?.lua;/usr/local/lib/lua/5.3/?/init.lua;./?.lua;./?/init.lua;/Users/odin/.luarocks/share/lua/5.3/?.lua;/Users/odin/.luarocks/share/lua/5.3/?/init.lua;/Users/odin/.pandoc/filters/share/lua/5.3/?.lua;/Users/odin/.pandoc/filters/pandoc-zotxt-debug.lua-0.3.17/share/lua/5.3/?.lua
Error running filter /Users/odin/.pandoc/filters/pandoc-zotxt-debug.lua:
PandocCouldNotFindDataFileError "lunajson.lua"
stack traceback:
[C]: in ?
[C]: in function 'require'
/Users/odin/.pandoc/filters/pandoc-zotxt-debug.lua:181: in main chunk

That is, the script locates itself (/Users/odin/.pandoc/filters/pandoc-zotxt-debug.lua) and adds the correct patterns ( /Users/odin/.pandoc/filters/share/lua/5.3/?.lua;/Users/odin/.pandoc/filters/pandoc-zotxt-debug.lua-0.3.17/share/lua/5.3/?.lua) to package.path.

By contrast, calling

echo @adorno1967SociologyPsychologyPart | pandoc -L pandoc-zotxt-debug.lua
/Users/odin/.pandoc/filters/pandoc-zotxt-debug.lua

outputs:

/Users/odin/.pandoc/filters/pandoc-zotxt-debug.lua
/usr/local/Cellar/luarocks/3.2.1/share/lua/5.3/?.lua;/usr/local/share/lua/5.3/?.lua;/usr/local/share/lua/5.3/?/init.lua;/usr/local/lib/lua/5.3/?.lua;/usr/local/lib/lua/5.3/?/init.lua;./?.lua;./?/init.lua;/Users/odin/.luarocks/share/lua/5.3/?.lua;/Users/odin/.luarocks/share/lua/5.3/?/init.lua;/Users/odin/.pandoc/filters/share/lua/5.3/?.lua;/Users/odin/.pandoc/filters/pandoc-zotxt-debug.lua-0.3.17/share/lua/5.3/?.lua
<p><span class="citation" data-cites="adorno1967SociologyPsychologyPart">@adorno1967SociologyPsychologyPart</span></p>

For all I can tell, this is a bug in the development version of Pandoc. I'll file an issue with them.

from pandoc-zotxt.lua.

odkr avatar odkr commented on July 20, 2024

Drilled it down to the essentials:

Two files: require-debug.lua and test.lua. These need to be placed in the same directory.

require-debug.lua:

local concat = table.concat
local unpack = table.unpack
local stderr = io.stderr

PATH_SEP = package.config:sub(1, 1)

do
    local split = '(.-' .. PATH_SEP .. '?)([^' .. PATH_SEP .. ']-)$'
    local sanitisers = {{PATH_SEP .. '%.' .. PATH_SEP, PATH_SEP},
        {PATH_SEP .. '+', PATH_SEP}, {'^%.' .. PATH_SEP, ''}}
    
    function split_path (path)
        assert(path ~= '', 'path is the empty string')
        for _, s in ipairs(sanitisers) do path = path:gsub(unpack(s)) end
        local dir, fname = path:match(split)
        dir = dir:gsub('(.)' .. PATH_SEP .. '$', '%1')
        if dir == '' then dir = '.' end
        if fname == '' then fname = '.' end
        return dir, fname
    end
end

local wd = split_path(PANDOC_SCRIPT_FILE)
stderr:write('working directory: ', wd, '\n')
package.path = concat({package.path, concat({wd, '?.lua'}, PATH_SEP)}, ';')
stderr:write('package.path: ', package.path, '\n')

local test = require 'test'

test.lua is empty; it just has to exist.

Then:

pandoc -L require-debug.lua </dev/null

outputs:

pandoc -L require-debug.lua </dev/null
working directory: /Users/odin/.pandoc/filters
package.path: /usr/local/Cellar/luarocks/3.2.1/share/lua/5.3/?.lua;/usr/local/share/lua/5.3/?.lua;/usr/local/share/lua/5.3/?/init.lua;/usr/local/lib/lua/5.3/?.lua;/usr/local/lib/lua/5.3/?/init.lua;./?.lua;./?/init.lua;/Users/odin/.luarocks/share/lua/5.3/?.lua;/Users/odin/.luarocks/share/lua/5.3/?/init.lua;/Users/odin/.pandoc/filters/?.lua

By contrast, calling

./pandoc -L require-debug.lua </dev/null

outputs:

working directory: /Users/odin/.pandoc/filters
package.path: /usr/local/Cellar/luarocks/3.2.1/share/lua/5.3/?.lua;/usr/local/share/lua/5.3/?.lua;/usr/local/share/lua/5.3/?/init.lua;/usr/local/lib/lua/5.3/?.lua;/usr/local/lib/lua/5.3/?/init.lua;./?.lua;./?/init.lua;/Users/odin/.luarocks/share/lua/5.3/?.lua;/Users/odin/.luarocks/share/lua/5.3/?/init.lua;/Users/odin/.pandoc/filters/?.lua
Error running filter /Users/odin/.pandoc/filters/require-debug.lua:
PandocCouldNotFindDataFileError "test.lua"
stack traceback:
[C]: in ?
[C]: in function 'require'
/Users/odin/.pandoc/filters/require-debug.lua:28: in main chunk

pandoc refers to Pandoc version 2.9.2.1. ./pandoc refers to the development version as per commit 8fc5766.

Where pandoc refers to Pandoc version 2.9.2.1.

from pandoc-zotxt.lua.

odkr avatar odkr commented on July 20, 2024

Why do you suspect commit 0fafe9dd32d5a0266d74ac78b1818050bc69a4bd? (But maybe answer over at jgm/pandoc#6361)

from pandoc-zotxt.lua.

odkr avatar odkr commented on July 20, 2024

Filed at jgm/pandoc#6361.

from pandoc-zotxt.lua.

odkr avatar odkr commented on July 20, 2024

It is a bug in the development version of Pandoc and will be fixed.

from pandoc-zotxt.lua.

njbart avatar njbart commented on July 20, 2024

Works nicely again now, many thanks for having looked into this.

from pandoc-zotxt.lua.

Related Issues (12)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.