Here's a more complex one for me:
I have content like this being pulled into a jekyll post:
# Lorem ipsum dolor sit amet.
Consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore.
~
# Et dolore magna aliqua.
Ut enim ad minim veniam, quis nostrud exercitation.
~
# Ullamco laboris nisi.
Ut aliquip ex ea commodo consequat.
~
I'm pulling this into my layout like this: {{ post.content | jekreged: 1 | markdownify }}
Jekreged is a custom liquid plugin I wrote that splits the content based on the ~
and then specifies which piece to include. The layout requires ripping apart a post like that.
I am trying to adapt this to then run a subset of match commands that I can call specifically from the liquid tag.
here's the example (and the one not working) that I am trying to troubleshoot.
module Jekyll
module AssetFilter
def jekreged(input, chunk)
drugs = input.split("~")[chunk]
title = (drugs).match(/^#{1}.+$/)
jekreged = "#{title}"
end
end
end
Liquid::Template.register_filter(Jekyll::AssetFilter)
I get no output from this. What I would ideally like is to be able to specify "title" as a parameter from the liquid tag but I'm not sure how to connect that through into the plugin.
Long range version I'll have something like title = regmatch for title, body = ..., img = ...
Thanks for any and all help!