Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

emojis as a rst transform #73

Merged
merged 1 commit into from Jul 1, 2015
Merged

Conversation

@mgaitan
Copy link
Contributor

@mgaitan mgaitan commented Apr 3, 2015

This patch allow a much simpler way to uses emojis. Instead a verbose role, it's use an standard substitution |emoji_slug| if that isn't defined in the document and match one of the available emojis



def emoji_role(name, rawtext, text, lineno, inliner, options={}, content=[]):
text = text.lower()
LOGGER.warn('The role :emoji:`{0}` is deprecated. Use |{0}| instead'.format(text))

This comment has been minimized.

@Kwpolska

Kwpolska Apr 3, 2015
Member

why deprecate it?

This comment has been minimized.

@mgaitan

mgaitan Apr 3, 2015
Author Contributor

because There should be one-- and preferably only one --obvious way to do it. (from the Zen)

default_priority = 210

# list from http://www.tortue.me/
emojis = set([

This comment has been minimized.

@ralsina

ralsina Apr 3, 2015
Member

Is there a way to get this list in a file and/or have a way to update it? New emojis happen every once in a while.

This comment has been minimized.

@mgaitan

mgaitan Apr 3, 2015
Author Contributor

Something like

import re
import requests
re.findall(r'"name">(.*)</span', requests.get('http://www.emoji-cheat-sheet.com/').content.decode('utf8'))

or watch this project

https://github.com/arvida/emoji-cheat-sheet.com

(but not sure if torue.me is up to date with that one)


# list from http://www.tortue.me/
emojis = set([
'bowtie', # NOQA

This comment has been minimized.

@ralsina

ralsina Apr 3, 2015
Member

Just curious... why NOQA that one?

This comment has been minimized.

@mgaitan

mgaitan Apr 3, 2015
Author Contributor

strictly, it's over-indented

On Fri, Apr 3, 2015 at 3:14 PM, Roberto Alsina notifications@github.com
wrote:

In v6/emoji/emoji.py
#73 (comment):

 node = nodes.image(
     uri='http://www.tortue.me/emoji/{0}.png'.format(text),
     alt=text,
     classes=['emoji'],
 )
 return [node], []

+class Emojis(Transform):

  • """
  • Replace some substitutions if they aren't defined in the document.
  • """
  • run before the default Substitutions

  • default_priority = 210

Just curious... why NOQA that one?


Reply to this email directly or view it on GitHub
https://github.com/getnikola/plugins/pull/73/files#r27745195.

mgaitan.github.io
textosypretextos.com.ar http://textosyprextextos.com.ar

@Kwpolska
Copy link
Member

@Kwpolska Kwpolska commented Apr 7, 2015

getnikola/nikola#1647 (required for this) has been merged with some changes: site.rst_transforms is used and is guaranteed to exist (no need to do the check). This plugin will also need to be moved to v7 with MinVersion=7.3.2.

ralsina added a commit that referenced this pull request Jul 1, 2015
emojis as a rst transform
@ralsina ralsina merged commit 6104f3d into getnikola:master Jul 1, 2015
1 check passed
1 check passed
continuous-integration/travis-ci/pr The Travis CI build passed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

3 participants