jMonkeyEngine/wiki

Need help adding emoji

mitm001 opened this issue · 2 comments

Been trying to implement the asciidoctor gem for emoji.

https://github.com/asciidoctor/asciidoctor-extensions-lab/blob/master/lib/emoji-inline-macro.rb

I have moved this extension to the root directory under a new lib folder for now.

https://github.com/jMonkeyEngine/wiki

So far, the twemoji-awesome.css file is properly written into the gh-pages branch folders,

Any page using the emoji has it properly added to the icon tag of output document on commit.
For example emoji:smile[] emoji:smile[2x] emoji:smile[4x]

<i class="twa twa-smile"></i> <i class="twa twa-2x twa-smile"></i> <i class="twa twa-4x twa-smile"></i>

But the hangup it seems is the stylesheet link tag or at least that's what I am thinking.

For this example the emoji is called from https://wiki.jmonkeyengine.org/jme3/advanced/custom_controls.html#usage. All three are sitting to the right of the text :smile:

<link rel="stylesheet" href="/home/travis/build/jMonkeyEngine/wiki/build/asciidoc/html5/jme3/advanced/twemoji-awesome.css">

I am pretty sure that if I can get the style link to read

<link rel="stylesheet" href="./twemoji-awesome.css">

emoji will be implemented.

I think the problem lies here in the template helpers.rb file with this line.

styles << { text: read_asset(normalize_system_path(stylesheet, stylesdir), true) }

The emoji ruby extension file has a similar line.

destination = doc.normalize_system_path stylesheet_name, stylesoutdir, (doc.safe >= SafeMode::SAFE ? outdir : nil)

So I think its expecting to read the twemoji-awesome.css located in the same folder as the output html file. Trouble is I dont understand how to get this to set the correct stylsheet link.

I can use the attribute for setting the stylesheet in the header of the adoc file and emoji works,

:stylesheet: twemoji-awesome.css

but that overrides the default style, which is not wanted. I could just combine the default stylesheet with the twemoji-awesome.css but thats a hack.

@davidB or anyone for that matter, can you help?

Edit: Forgot to mention, setup in the gradle file,

wiki/build.gradle

Lines 21 to 22 in 5a52fdb

// Add requirement on Ruby extension.
requires './lib/emoji-inline-macro.rb'

For posterity:

Went ahead and included stylesheet attribute setting to get this online. How this works is I did an include in the twemoji-awesome.css so setting the stylesheet attribute in the header of documents would pull in the asciidoctor.css and coderay-asciidoctor.css.

@import url(asciidoctor.css);
@import url(coderay-asciidoctor.css);

This is a hack that should be undone in the future when or if someone can fix the above mentioned issue which prevents the inline macro from working since it cannot resolve the twemoji-awesome.css path.

implemented.