Skip to content
This repository has been archived by the owner on Oct 9, 2023. It is now read-only.

KOLANICH-tools/emojifilt.cpp

Repository files navigation

emojifilt.cpp Unlicensed work

GitHub Actions Libraries.io Status

We have moved to https://codeberg.org/KOLANICH-tools/emojifilt.cpp, grab new versions there.

Under the disguise of "better security" Micro$oft-owned GitHub has discriminated users of 1FA passwords while having commercial interest in success of FIDO 1FA specifications and Windows Hello implementation which it promotes as a replacement for passwords. It will result in dire consequencies and is competely inacceptable, read why.

If you don't want to participate in harming yourself, it is recommended to follow the lead and migrate somewhere away of GitHub and Micro$oft. Here is the list of alternatives and rationales to do it. If they delete the discussion, there are certain well-known places where you can get a copy of it. Read why you should also leave GitHub.


A tool to replace emoji slugs (i. e. :lock:) with actual emoji (i. e. 🔒) within text files.

Rationale

Some Markdown sources on GitHub (ReadMes, issues texts, comments, etc.) have emoji inside them in the form of ASCII slugs enclosed in :. It is inconvenient to read them in that form. This tool replaces them with actual emoji, so you should be able to see them within a text editor.

Usage

emojifilt < ../a.md > ../b.md

should do the job, given the emoji database is situated in ./emoji.mo.

Emoji database

Emoji database is stored within a mo translation file (in fact, a key-value store for strings) for libintl/gettext. The key is the emoji abbreviation, the value is the emoji sequence. You can download a pregenerated one (2023-02-06) (merged from different sources, see the license file inside the archive), or you can generate an own fresh one with the python-based tool.

Build and installation

We use CPack to generate native packages for your package manager.

  • Modern versions of clang/gcc are recommended as compilers. Modern versions of CMake are recommended as the build system.
  • Build and install https://codeberg.org/KOLANICH-libs/libmo.cpp - a library for looking up values in libintl/gettext mo translation files. Since it seems libintl/gettext don't allow to do hashtable lookup using the concrete file, we use an own lib for it.
  • If you build for Windows, build and install a package for my fork of whereami (the difference to the original is packaging using CPack). This is required: Windows apps don't follow FHS and for it the app is meant to be portable.
  • Build and install a package for CTRE - a library for generating parsers for regular grammars in compile time. It's optional, if it is unavailable, the tool will use std::regex.
  • Then build and install this package.
  • Generate the database of mapping emoji slugs to code point sequences using emojiSlugMappingGen tool and save it to /usr/share/emojifilt/emoji.mo tool: python3 -m emojiSlugMappingGen > emoji.mo && sudo fakeroot cp ./emoji.mo /usr/share/emojifilt/emoji.mo .
  • The tool is ready to be used.

Related projects

About

A tool to replace emoji slugs with actual emoji within text files. !!! Migrated to Codeberg !!!

Topics

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published