Closed robertohuertasm closed 5 years ago
I've been digging into how this works and it seems that my issue is with the replace_document_body
function.
I guess, by the code, that the second line was intended to partition the html into three parts using a regular expression to capture the body.
This seems to be failing and I'm only getting the head
variable informed, but with the whole document in it. Obviously, as opener
and tail
are empty the rest of the function won't replace the emojis at all:
def replace_document_body(doc)
src = emoji_src(doc.site.config)
head, opener, tail = doc.output.partition(OPENING_BODY_TAG_REGEX)
body_content, *rest = tail.partition("</body>")
processed_markup = filter_with_emoji(src).call(body_content)[:output].to_s
String.new(head) << opener << processed_markup << rest.join
end
I've changed this function to just replace the emojis in the doc.output
directly and it seems to be working.
I'm not sure how to proceed, as I don't know if this bug happens to me because of my Ruby
, Jekyll
, Bundler
versions (I don't know that much about the Ruby ecosystem). I guess there must be more people suffering this bug and I'd be willing to add a PR if someone could help me to pinpoint if this is indeed a bug only affecting +Jekyll 3.8.5
.
Can you test on a more recent Ruby version? 2.6, 2.5 or even 2.4?
I'm publishing my site with netlify
and they use Ruby 2.4.3
. Still not working. I'll try to test newer versions.
Confirmed locally. Ruby 2.4.3
not working.
Ruby 2.6.3
not working either. I'm using Bundler 2.0.1
.
Could you try with a 1.17.x version of bundler? The bundler folks say that 2.0.x should be backwards compatible with 1.17.x but we've run into lots of folks who are having issues with it.
Same with Bundler 1.17.3
, Ruby 2.4.3
and jemoji 0.10.2
.
For the moment, in case anyone else is having the same problem, I forked the repo and created a new branch called fix-rob-issue
. Then, in my Gemfile
:
group :jekyll_plugins do
gem 'jekyll-feed'
gem 'jekyll-sitemap'
gem 'jekyll-archives'
gem 'jekyll-paginate'
gem 'jemoji', git: 'https://github.com/robertohuertasm/jemoji', branch: 'fix-rob-issue'
end
This works perfectly for me.
@robertohuertasm Is your site's source code publicly available? I'd like to investigate the cause behind this issue..
@ashmaroli, it's not public but I've assembled a new public repo reproducing the issue: https://gitlab.com/robertohuertasm/jemoji-bug
Open the only post (http://127.0.0.1:4001/2018/09/29/test/) and, if everything works, you should see an emoji. I only keep getting :wink:
unless I completely refactor the replace_document_body
function.
Hope it helps!
@robertohuertasm Yep, your test repo helped isolate the bug. The fix is to simply modify the regex used to support multiline body tag..
Thanks @ashmaroli for the quick fix. I've seen there's a new release 0.11.1
. Unfortunately for me, the github-pages
gem only works with jemoji 0.10.2
.
Hopefully, github-pages
will ship a new release soon. Meanwhile, I've also ported the patch to be implemented within jekyll-mentions
(the plugins work quite similarly, with a very minor difference).
I've been using this plugin so far and it was working perfectly but recently I've found that it doesn't work anymore and I don't really know why. Surely, I've changed something in my installation that broke it but I don't have a clue of what may be going on.
I'm using
jekyll 3.8.5
. I've trying updating and reinstalling all the packages, but no luck.I have included
jemoji
in theplugins
section in_config.yml
:And this is my
Gemfile.lock
:Any ideas? Thanks for your support!