Fizzadar / Luapress

:newspaper: Static site/blog generator written in Lua.
MIT License
199 stars 32 forks source link

Gallery Plugin Error: Gallery wrapped in <code> and not generating thumbnail. #90

Open knarxism opened 4 years ago

knarxism commented 4 years ago

Hi there, could somebody point me in the right direction? I am trying to use the default gallery plugin. What I've done so far.

/usr/bin/lua5.1: .../rocks-5.1/luapress/4.1.2-0/plugins/gallery/init.lua:77: Gallery: not a directory: gallery/gallery
stack traceback:
    [C]: in function 'error'
    .../rocks-5.1/luapress/4.1.2-0/plugins/gallery/init.lua:77: in function 'plugin'
    /usr/local/share/lua/5.1/luapress/util.lua:169: in function '_process_plugins'
    /usr/local/share/lua/5.1/luapress/util.lua:223: in function '_process_content'
    /usr/local/share/lua/5.1/luapress/util.lua:312: in function 'load_markdowns'
    /usr/local/share/lua/5.1/luapress.lua:216: in function 'build'
    ...lib/luarocks/rocks-5.1/luapress/4.1.2-0/bin/luapress:210: in function 'build'
    ...lib/luarocks/rocks-5.1/luapress/4.1.2-0/bin/luapress:237: in main chunk

I've tried placing the 'gallery' folder (with images) in several different locations, but the error above keeps occurring.

knarxism commented 4 years ago

Hi, I solved the above issue but found additional issues that are unfortunately out of my wheelhouse for now. The fix for the above error was simply creating a subdirectory in the gallery folder. The "Gallery: not a directory: gallery/gallery" solution for me was:

  1. create a folder called gallery (next to pages/posts)
  2. within the gallery folder, created a folder called "gallery" and place the images inside here (eg "gallery/gallery"
  3. create a page named gallery.md with the code "$! gallery !$"
  4. run "luapress" in the command line.

This generated the gallery (well sort of):

convert: no decode delegate for this image format `JPG' @ error/constitute.c/ReadImage/562.
convert: no images defined `public_html/gallery/gallery/thumbs/7.jpg' @ error/convert.c/ConvertImageCommand/3282.
knarxism commented 4 years ago

Hey, I got this figured out - well at least to agree that I can use it!

Thumbnail Issue: Problem with imagemagick was a faulty installation, apparently its an issue from installing with source. I missed a few libraries :/ I followed this guide: https://mindaslab.github.io/2018/11/22/install-latest-version-of-imagemagick-in-ubuntu-18-04.html and changed one word (libpng12-dev to libpng-dev) at the beginning:

sudo apt-get install build-essential checkinstall libx11-dev libxext-dev zlib1g-dev libpng-dev libjpeg-dev libfreetype6-dev libxml2-dev

That fixed the thumbnail problem above.

Code Wrap Issue: The <code> issue meant that I had to wade through lua code. I am not a lua programmer, I just like luapress :)

In my /usr/local/lib/luarocks/rocks-5.1/luapress/4.1.2-0/plugins/gallery/init.lua, i changed the line at 167 from:

-- protect from markdown
 return "<div>" .. table.concat(tbl) .. "</div>"

to

-- protect from markdown
-- return "<div>" .. table.concat(tbl) .. "</div>"
return  table.concat(tbl)

I have no idea exactly why that worked, and it does append tickmarks (```) at the beginning and at the end of the gallery.html. But that I can delete :) Not sure if there is a better solution, so I'll leave this open for now.