Giter Site home page Giter Site logo

sphinx-contrib / emojicodes Goto Github PK

View Code? Open in Web Editor NEW
48.0 48.0 15.0 120 KB

An extension to use emoji codes in your Sphinx documentation! 😍

Home Page: https://sphinxemojicodes.readthedocs.io/

License: BSD 3-Clause "New" or "Revised" License

Python 91.70% CSS 1.97% JavaScript 6.33%
documentation emoji hacktoberfest python sphinx sphinx-extension sphinxcontrib twemoji

emojicodes's People

Contributors

0robustus1 avatar domdfcoding avatar gousaiyang avatar honzajavorek avatar peque avatar yangkev avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

emojicodes's Issues

Document list of supported emoji styles

The README mentions

sphinxemoji_style = ...

but there's no list of what styles are supported. I'm willing to send a PR if I get to know where to learn the supported styles.

How do you feel about a theme enabling this extension for *all* its users?

The title says it all, honestly. In case you're curious about what theme this is for, it's https://github.com/pradyunsg/lutra/ (live at https://pradyunsg.me/lutra/). :)

For now, this theme isn't published on PyPI. The way that this works in the theme is that (1) the theme depends on this package and (2) if the theme is used, this extension is enabled as well (https://github.com/pradyunsg/lutra/blob/23ef5df197d3e0c85ea66453b1d9d6c361f59a77/src/lutra/__init__.py#L311).

Support colored emojis in PDF output

As of #22, there is support for black and white emojis, but the Symbola font does not display all emojis properly (i.e.: modifiers are not applied). It would be great to support colored emojis.

Twemoji should be preferred over Noto, since that is what we are already allowing in the HTML builds.

See:

Ideally, it should be easy to run/reproduce from current Linux distributions without requiring much effort on the user side.

The font must be free/libre though.

Output in Latex

Is it difficult to avoid writing out emojis when using pdflatex builder?

With pdflatex an error is issued. With xelatex a "question mark" is shown instead of the emoji. I have googled a bit and it's quite complicated to print out emojis using Latex.

I know the only directive at Sphinx, but it is mainly targeted for text blocks, not for inline text. Furthermore it makes documentation more verbose.

It would be fine to use your package if it would ignore emojies when using latex builders.

Test documentation

I would suggest:

doc8 README.rst
doc8 docs/source/
make -C docs html SPHINXOPTS="-W -E"
make -C docs linkcheck

I think it would be great to be able to run tests locally with Tox (and make GitHub Actions run Tox in CI). But that could be a separate issue. See for example osbrain's Tox configuration and how Travis runs just Tox.

'charmap' codec can't decode byte X in position Y: character maps to <undefined>

In a system whose system encoding is not UTF-8, sphinxemoji will fail with UnicodeDecodeError:

  File "C:\projects\sphinx-binary\build\venv\lib\site-packages\sphinx\cmd\build.py", line 284, in build_main
    app.build(args.force_all, filenames)
  ...
  File "C:\projects\sphinx-binary\build\venv\lib\site-packages\docutils\transforms\__init__.py", line 172, in apply_transforms
    transform.apply(**kwargs)
  File "C:\projects\sphinx-binary\build\venv\lib\site-packages\sphinxemoji\sphinxemoji.py", line 26, in apply
    replacements = json.load(open(codes))
  File "C:\Python36\lib\json\__init__.py", line 296, in load
    return loads(fp.read(),
  File "C:\Python36\lib\encodings\cp1252.py", line 23, in decode
    return codecs.charmap_decode(input,self.errors,decoding_table)[0]
UnicodeDecodeError: 'charmap' codec can't decode byte 0x8d in position 18: character maps to <undefined>
Encoding error:
'charmap' codec can't decode byte 0x8d in position 18: character maps to <undefined>

The problem could be fixed by passing the encoding='utf-8-sig' parameter to the open(codes) call.

RemovedInSphinx40Warning: The app.add_javascript() is deprecated

Hi,

sphinxemoji.py calls app.add_javascript() three times on lines 60, 61 and 62 (right at the bottom of the file). This function was renamed to add_js_file in Sphinx version 1.8 and the old version will be removed in Sphinx 4.0.

Currently Sphinx only throws a warning about this but eventually it will break. It looks like the two functions have the same syntax, so the fix should be as simple as changing the name in sphinxemoji.py.

See https://www.sphinx-doc.org/en/master/extdev/appapi.html#sphinx.application.Sphinx.add_js_file for a bit more info.

Add tests to CI

A very simple test should check for emoji codes in the table.

In example:

  • 😊
  • πŸ³οΈβ€πŸŒˆ (reportedly broken before 961a266)
  • ❄️ (it may have been broken too until 961a266)

0.1.9: sphinx 4.2 warnings

+ /usr/bin/python3 setup.py build_sphinx -b man --build-dir build/sphinx
running build_sphinx
Running Sphinx v4.2.0
making output directory... done
building [mo]: targets for 0 po files that are out of date
building [man]: all manpages
updating environment: [new config] 1 added, 0 changed, 0 removed
reading sources... [100%] index
/home/tkloczko/rpmbuild/BUILD/emojicodes-0.1.9/docs/source/index.rst:5: WARNING: Inline emphasis start-string without end-string.
/home/tkloczko/rpmbuild/BUILD/emojicodes-0.1.9/docs/source/index.rst:5: WARNING: Inline emphasis start-string without end-string.
/home/tkloczko/rpmbuild/BUILD/emojicodes-0.1.9/docs/source/index.rst:5: WARNING: Inline emphasis start-string without end-string.
looking for now-outdated files... none found
pickling environment... done
checking consistency... done
writing... sphinxemojicodes.1 { } done
build succeeded, 3 warnings.

BTW: as license in setup.py is listed license='BSD License' howevewrthere are few BSD licenses:
BSD-2-Clause (https://opensource.org/licenses/BSD-2-Clause/)
BSD-3-Clause (https://opensource.org/licenses/BSD-3-Clause/)
BSD-4-Clause (https://spdx.org/licenses/BSD-4-Clause.html)

May I ask for claryfication which one in thi case is used?

Support md files

Currently, emojis are only supported in .rst. It would be great to be able to use the tool for .md files as well

PosixPath problem and 0.3.0

Hi,

I am sorry this is a bit sparse on details, but my build script is failing after 0.3.0 came out. I am using the ubuntu:latest docker image here, but it also happens for python 3.10. When I pin at version 0.2.0 the build script works again.

Extension error (sphinxemoji.sphinxemoji):
Handler <function copy_asset_files at 0x7f7d95121e10> for event 'build-finished' threw an exception (exception: 'PosixPath' object has no attribute 'lower')
make: *** [Makefile:20: gettext] Error 1
Traceback (most recent call last):
  File "/usr/lib/python3.10/runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/usr/lib/python3.10/runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "/builds/cp/02002public/src/cp_box/material/ipp_cicd_deploy.py", line 47, in <module>
    _cicd_deploy_all()
  File "/builds/cp/02002public/src/cp_box/material/ipp_cicd_deploy.py", line 43, in _cicd_deploy_all
    build_documentation(cut_files=True, open_browser=False, CE=args.ce, update_translations=True)
  File "/builds/cp/02002public/src/cp_box/material/build_documentation.py", line 182, in build_documentation
    pr1 = run(f"cd {paths['docs']} && make gettext", print_output=False, log_output=True, check=True)
  File "/usr/local/lib/python3.10/dist-packages/unitgrade_private/run.py", line 125, in run
    raise Exception(f"Command failed with exit code {process.returncode}: {cmd}")
Exception: Command failed with exit code 2: cd /builds/cp/02002public/src/docs && make gettext

Missing some emoji codes/aliases

Compared to GitHub:

import json

import requests

github = set(json.loads(requests.get('https://api.github.com/emojis').text).keys())
gitlab = set(json.loads(requests.get('https://gitlab.com/gitlab-org/gitlab-ce/raw/master/fixtures/emojis/index.json').text).keys())
aliases = set(json.loads(requests.get('https://gitlab.com/gitlab-org/gitlab-ce/raw/master/fixtures/emojis/aliases.json').text).keys())

gitlab.update(aliases)
print(github - gitlab)

We are missing:

{'french_guiana', 'switzerland', 'family_man_man_boy_boy',
'tipping_hand_woman', 'sun_behind_large_cloud', 'no_good_woman',
'women_wrestling', 'liberia', 'family_man_man_boy', 'moon',
'south_georgia_south_sandwich_islands', 'paw_prints', 'romania',
'massage_woman', 'serbia', 'norway', 'tornado', 'niger', 'palau',
'bosnia_herzegovina', 'st_kitts_nevis', 'mozambique', 'western_sahara',
'poland', 'biking_man', 'facepunch', 'hugs', 'ng_woman', 'ethiopia',
'cocos_islands', 'st_vincent_grenadines', 'dancing_women', 'zimbabwe',
'running_woman', 'spiral_notepad', 'antigua_barbuda', 'gibraltar', 'sri_lanka',
'family_man_girl', 'black_flag', 'fist_raised', 'balance_scale', 'lebanon',
'policewoman', 'woman_shrugging', 'equatorial_guinea', 'fist_oncoming',
'woman_teacher', 'faroe_islands', 'dominica', 'roll_eyes',
'palestinian_territories', 'haircut_man', 'bahrain', 'sudan', 'woman_farmer',
'phone', 'samoa', 'construction_worker_man', 'rescue_worker_helmet',
'botswana', 'madagascar', 'family_man_woman_boy_boy', 'cape_verde',
'christmas_island', 'honduras', 'kazakhstan', 'martinique', 'rwanda',
'micronesia', 'malawi', 'woman_with_turban', 'north_korea', 'brunei',
'heavy_heart_exclamation', 'american_samoa', 'colombia', 'mountain_biking_man',
'boat', 'singapore', 'kosovo', 'mandarin', 'man_astronaut', 'massage_man',
'pen', 'frowning_woman', 'puerto_rico', 'australia', 'timor_leste',
'trollface', 'rowing_man', 'monaco', 'el_salvador', 'woman_juggling',
'seychelles', 'finnadie', 'falkland_islands', 'milk_glass', 'libya',
'squirrel', 'congo_brazzaville', 'uzbekistan', 'mauritania',
'caribbean_netherlands', 'pitcairn_islands', 'montenegro', 'mali', 'curacao',
'jersey', 'guatemala', 'wallis_futuna', 'croatia', 'goberserk',
'snowman_with_snow', 'cowboy_hat_face', 'swaziland', 'basecampy', 'st_helena',
'spiral_calendar', 'pouting_man', 'man_factory_worker', 'octocat', 'mongolia',
'mountain_biking_woman', 'djibouti', 'guinea_bissau',
'family_man_woman_girl_boy', 'ukraine', 'shipit', 'man_office_worker',
'sleeping_bed', 'sassy_woman', 'northern_mariana_islands',
'construction_worker_woman', 'new_caledonia', 'iran', 'tshirt',
'family_man_girl_boy', 'shoe', 'eye_speech_bubble', 'hurtrealbad', 'bowtie',
'trinidad_tobago', 'cayman_islands', 'new_zealand', 'congo_kinshasa',
'armenia', 'golfing_woman', 'collision', 'british_indian_ocean_territory',
'benin', 'barbados', 'luxembourg', 'woman_playing_water_polo', 'montserrat',
'peru', 'surfing_woman', 'vulcan_salute', 'fleur_de_lis', 'ng_man', 'andorra',
'qatar', 'bangladesh', 'central_african_republic', 'guinea',
'mantelpiece_clock', 'family_woman_girl', 'vanuatu', 'malta',
'british_virgin_islands', 'papua_new_guinea', 'malaysia', 'nepal', 'estonia',
'next_track_button', 'family_man_girl_girl', 'sun_behind_small_cloud',
'sint_maarten', 'wind_face', 'eritrea', 'st_lucia', 'pakistan',
'woman_factory_worker', 'flight_departure', 'algeria', 'togo',
'woman_scientist', 'mexico', 'man_cook', 'man_singer', 'suriname', 'macau',
'woman_artist', 'grenada', 'guyana', 'ecuador', 'framed_picture', 'jamaica',
'woman_office_worker', 'rage3', 'business_suit_levitating', 'godmode',
'lesotho', 'keycap_ten', 'woman_mechanic', 'family_man_boy', 'hand', 'chad',
'belize', 'family_woman_boy_boy', 'family_man_man_girl_girl',
'1st_place_medal', '2nd_place_medal', 'burkina_faso', 'solomon_islands',
'sun_behind_rain_cloud', 'guam', 'medal_sports', 'gabon', 'tonga',
'aland_islands', 'finland', 'norfolk_island', 'us_virgin_islands',
'white_flag', 'lithuania', 'woman_pilot', 'morocco', 'cambodia', 'surfing_man',
'blonde_woman', 'kick_scooter', 'suspect', 'golfing_man',
'family_man_woman_girl', 'swimming_man', 'previous_track_button', 'hocho',
'couplekiss_man_man', 'french_southern_territories', 'iceland',
'walking_woman', 'fiji', 'sao_tome_principe', 'bowing_woman',
'family_woman_woman_girl', 'woman_technologist', 'french_polynesia',
'family_woman_girl_girl', 'slovakia', 'dominican_republic', 'female_detective',
'bolivia', 'rage1', 'belarus', 'uk', 'basketball_woman', 'kyrgyzstan',
'senegal', 'tunisia', 'running_man', 'bahamas', 'angola', 'namibia',
'man_facepalming', 'man_judge', 'sweden', 'orange', 'st_pierre_miquelon',
'parasol_on_ground', 'man_playing_handball', 'running', 'man_cartwheeling',
'man_farmer', 'turks_caicos_islands', 'afghanistan', 'belgium', 'rowing_woman',
'woman_cook', 'egypt', 'camera_flash', 'woman_student', 'blonde_man', 'greece',
'pouting_woman', 'gambia', 'family_man_man_girl', 'biking_woman',
'swimming_woman', 'car', 'neckbeard', 'woman_singer', 'thailand',
'fountain_pen', 'tajikistan', 'tokelau', 'couple_with_heart_man_man',
'man_artist', 'cuba', 'computer_mouse', 'nicaragua', 'family_woman_girl_boy',
'rage4', 'woman_playing_handball', 'burundi', 'men_wrestling', 'open_book',
'marshall_islands', 'family_woman_woman_girl_boy',
'cloud_with_lightning_and_rain', 'kiwi_fruit', 'isle_of_man', 'vietnam',
'family_woman_woman_boy', 'man_technologist', 'weight_lifting_man',
'frowning_face', 'man_juggling', 'man_mechanic', 'bulgaria', 'kenya',
'cook_islands', 'india', 'israel', 'albania', 'macedonia', 'saudi_arabia',
'venezuela', 'woman_astronaut', 'couple_with_heart_woman_woman',
'crossed_fingers', 'woman_facepalming', 'man_firefighter', 'man_student',
'cyprus', 'laos', 'frowning_man', 'comoros', 'detective', 'man_health_worker',
'somalia', 'aruba', 'family_woman_boy', 'zambia', 'slovenia', 'fist_right',
'jordan', 'paraguay', 'couplekiss_man_woman', 'dancing_men', 'haiti',
'basketball_man', 'netherlands', 'taiwan', 'person_fencing', 'mayotte',
'family_man_boy_boy', 'couplekiss_woman_woman', 'maldives', 'canary_islands',
'yemen', 'male_detective', 'cote_divoire', 'artificial_satellite',
'walking_man', 'uruguay', 'fried_egg', 'brazil', 'tipping_hand_man',
'family_man_woman_girl_girl', 'nauru', 'liechtenstein', 'philippines',
'austria', 'family_man_woman_boy', 'man_shrugging', 'mauritius', 'houses',
'myanmar', 'bhutan', 'cameroon', 'reunion', 'guernsey', 'st_barthelemy',
'guardswoman', 'hungary', 'pout', 'iraq', 'woman_firefighter', 'georgia',
'man_scientist', 'motor_boat', 'san_marino', 'policeman', 'canada',
'guadeloupe', 'basecamp', 'ireland', 'latvia', 'ghana',
'family_woman_woman_girl_girl', 'south_sudan', 'heavy_exclamation_mark',
'anguilla', 'medal_military', 'vatican_city', 'bowing_man',
'woman_cartwheeling', 'oman', 'czech_republic', 'man_playing_water_polo',
'kuwait', 'shopping', 'woman_judge', 'panama', 'greenland', 'flipper',
'raising_hand_woman', 'costa_rica', 'man_pilot', 'play_or_pause_button',
'3rd_place_medal', 'film_strip', 'man_teacher', 'denmark', 'derelict_house',
'no_good_man', 'flight_arrival', 'sassy_man', 'tanzania', 'uganda',
'fist_left', 'woman_health_worker', 'bermuda', 'niue', 'portugal', 'syria',
'south_africa', 'electron', 'family_man_man_girl_boy', 'hong_kong', 'kiribati',
'honeybee', 'ice_hockey', 'couple_with_heart_woman_man', 'sierra_leone',
'haircut_woman', 'clamp', 'argentina', 'clinking_glasses', 'ok_man',
'family_woman_woman_boy_boy', 'weight_lifting_woman', 'feelsgood',
'antarctica', 'plate_with_cutlery', 'newspaper_roll', 'united_arab_emirates',
'azerbaijan', 'fu', 'open_umbrella', 'moldova', 'rage2', 'lantern',
'raising_hand_man', 'european_union'}

See https://gitlab.com/gitlab-org/gitlab-ce/issues/62985

OpenMoji

I just stumbled upon this :) I felt like this is the best place where I’d β€œnote for myself” that something like OpenMoji exists... πŸ˜€

https://openmoji.org/

We could add support for OpenMoji to emojicodes :)

Guidance to add it to readthedocs

Hi,

Is there a chance for a step-by-step manual on how to add this to one's project in readthedocs? I followed the instructions, I can see RTD installs sphinxemoji, I have it in extensions, build goes through successfully, however no replacement happens and I see |:rawemojitexthere:| instead of the images/glyphs. What am I missing?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.