Skip to content

Commit

Permalink
Add ltr to all characters
Browse files Browse the repository at this point in the history
Even rigth-to-left languages like Arabic or Hebrew are easier to read
with their English description if they're formatted left-to-right with
the character first.
If we ever have descriptions in other languages, we must re-evaluate
that argument, but for now, I think it's better like this.

Also, more classes now use the `Character` type. That should hopefully
simplify something, too.
  • Loading branch information
fdw committed Jan 8, 2021
1 parent 76b23a5 commit 74cb946
Show file tree
Hide file tree
Showing 50 changed files with 2,988 additions and 2,982 deletions.
9 changes: 5 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
# [NEXT]
## Added
- rofimoji now has a manpage (#57).
- rofimoji now has a manpage. (#57)
- There's a new file for [Nerd Font icons](https://www.nerdfonts.com/).

## Changed
- The emojis from 13.1 have been added!
- Instead of several parameters to choose the input method, they have been consolidated into `--action` (`-a`).
- The annotations on emojis don't contain their name (#59).
- The results are now sorted by rofi, by default based on Levenshtein distance (#59).
- The annotations on emojis don't contain their name. (#59)
- The results are now sorted by rofi, by default based on Levenshtein distance. (#59)
- All entries are now forced to be left aligned, even for right-to-left languages. (#62)
- The dependency on `pyxdg` was removed.
- Some code cleanup (#56, #58).
- Some code cleanup. (#56, #58)

# [4.3.0]
## Added
Expand Down
2 changes: 1 addition & 1 deletion extractors/blockextractor.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def write_to_files(self: 'BlockExtractor'):

with Path(f"../picker/data/{block.name.lower().replace(' ', '_')}.csv").open('w') as symbol_file:
for character in block.characters:
symbol_file.write(f"{character.char} {html.escape(character.name)}\n")
symbol_file.write(f'{character.directional_char} {html.escape(character.name)}\n')

def extract(self):
self.fetch_blocks()
Expand Down
8 changes: 8 additions & 0 deletions extractors/characterfactory.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,20 @@
from typing import Union

import requests
from unicodedata import bidirectional


class Character(object):
ltr_mark = '\u200e'

def __init__(self, char: int, name: str):
self.char = chr(char)
self.name = name.strip().title()
self.force_ltr = bidirectional(self.char) in ('AL', 'AN', 'R', 'RLE', 'RLI', 'RLO')

@property
def directional_char(self):
return f'{self.ltr_mark if self.force_ltr else ""}{self.char}'


class CharacterFactory(object):
Expand Down
13 changes: 5 additions & 8 deletions extractors/nerdextractor.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
import html
from pathlib import Path
from collections import namedtuple
from unicodedata import bidirectional

import requests
from bs4 import BeautifulSoup

Icon = namedtuple('Icon', 'icon name force_ltr')
ltr_mark = '\u200e'
from extractors.characterfactory import Character


class NerdExtractor(object):
def __init__(self: 'NerdExtractor'):
Expand All @@ -23,18 +21,17 @@ def fetch_icons(self: 'NerdExtractor'):

characters = BeautifulSoup(response.text, 'html.parser').find(id='glyphCheatSheet').find_all(class_='column')
for c in characters:
icon = chr(int(c.find(class_='codepoint').string, 16))
icon = int(c.find(class_='codepoint').string, 16)
name = c.find(class_='class-name').string
force_ltr = bidirectional(icon) in ('AL', 'AN', 'R', 'RLE', 'RLI', 'RLO')
self.icons.append(Icon(icon, name, force_ltr))
self.icons.append(Character(icon, name))

def write_to_file(self: 'NerdExtractor'):
if len(self.icons) == 0:
return

with Path("../picker/data/nerd_font.csv").open('w') as symbol_file:
for icon in self.icons:
symbol_file.write(f"{ltr_mark if icon.force_ltr else ''}{icon.icon} {html.escape(icon.name.lower())}\n")
symbol_file.write(f"{icon.directional_char} {html.escape(icon.name.lower())}\n")

def extract(self: 'NerdExtractor'):
self.fetch_icons()
Expand Down
162 changes: 81 additions & 81 deletions picker/data/adlam.csv
Original file line number Diff line number Diff line change
@@ -1,88 +1,88 @@
𞤀 Adlam Capital Letter Alif
𞤁 Adlam Capital Letter Daali
𞤂 Adlam Capital Letter Laam
𞤃 Adlam Capital Letter Miim
𞤄 Adlam Capital Letter Ba
𞤅 Adlam Capital Letter Sinnyiiyhe
𞤆 Adlam Capital Letter Pe
𞤇 Adlam Capital Letter Bhe
𞤈 Adlam Capital Letter Ra
𞤉 Adlam Capital Letter E
𞤊 Adlam Capital Letter Fa
𞤋 Adlam Capital Letter I
𞤌 Adlam Capital Letter O
𞤍 Adlam Capital Letter Dha
𞤎 Adlam Capital Letter Yhe
𞤏 Adlam Capital Letter Waw
𞤐 Adlam Capital Letter Nun
𞤑 Adlam Capital Letter Kaf
𞤒 Adlam Capital Letter Ya
𞤓 Adlam Capital Letter U
𞤔 Adlam Capital Letter Jiim
𞤕 Adlam Capital Letter Chi
𞤖 Adlam Capital Letter Ha
𞤗 Adlam Capital Letter Qaaf
𞤘 Adlam Capital Letter Ga
𞤙 Adlam Capital Letter Nya
𞤚 Adlam Capital Letter Tu
𞤛 Adlam Capital Letter Nha
𞤜 Adlam Capital Letter Va
𞤝 Adlam Capital Letter Kha
𞤞 Adlam Capital Letter Gbe
𞤟 Adlam Capital Letter Zal
𞤠 Adlam Capital Letter Kpo
𞤡 Adlam Capital Letter Sha
𞤢 Adlam Small Letter Alif
𞤣 Adlam Small Letter Daali
𞤤 Adlam Small Letter Laam
𞤥 Adlam Small Letter Miim
𞤦 Adlam Small Letter Ba
𞤧 Adlam Small Letter Sinnyiiyhe
𞤨 Adlam Small Letter Pe
𞤩 Adlam Small Letter Bhe
𞤪 Adlam Small Letter Ra
𞤫 Adlam Small Letter E
𞤬 Adlam Small Letter Fa
𞤭 Adlam Small Letter I
𞤮 Adlam Small Letter O
𞤯 Adlam Small Letter Dha
𞤰 Adlam Small Letter Yhe
𞤱 Adlam Small Letter Waw
𞤲 Adlam Small Letter Nun
𞤳 Adlam Small Letter Kaf
𞤴 Adlam Small Letter Ya
𞤵 Adlam Small Letter U
𞤶 Adlam Small Letter Jiim
𞤷 Adlam Small Letter Chi
𞤸 Adlam Small Letter Ha
𞤹 Adlam Small Letter Qaaf
𞤺 Adlam Small Letter Ga
𞤻 Adlam Small Letter Nya
𞤼 Adlam Small Letter Tu
𞤽 Adlam Small Letter Nha
𞤾 Adlam Small Letter Va
𞤿 Adlam Small Letter Kha
𞥀 Adlam Small Letter Gbe
𞥁 Adlam Small Letter Zal
𞥂 Adlam Small Letter Kpo
𞥃 Adlam Small Letter Sha
𞤀 Adlam Capital Letter Alif
𞤁 Adlam Capital Letter Daali
𞤂 Adlam Capital Letter Laam
𞤃 Adlam Capital Letter Miim
𞤄 Adlam Capital Letter Ba
𞤅 Adlam Capital Letter Sinnyiiyhe
𞤆 Adlam Capital Letter Pe
𞤇 Adlam Capital Letter Bhe
𞤈 Adlam Capital Letter Ra
𞤉 Adlam Capital Letter E
𞤊 Adlam Capital Letter Fa
𞤋 Adlam Capital Letter I
𞤌 Adlam Capital Letter O
𞤍 Adlam Capital Letter Dha
𞤎 Adlam Capital Letter Yhe
𞤏 Adlam Capital Letter Waw
𞤐 Adlam Capital Letter Nun
𞤑 Adlam Capital Letter Kaf
𞤒 Adlam Capital Letter Ya
𞤓 Adlam Capital Letter U
𞤔 Adlam Capital Letter Jiim
𞤕 Adlam Capital Letter Chi
𞤖 Adlam Capital Letter Ha
𞤗 Adlam Capital Letter Qaaf
𞤘 Adlam Capital Letter Ga
𞤙 Adlam Capital Letter Nya
𞤚 Adlam Capital Letter Tu
𞤛 Adlam Capital Letter Nha
𞤜 Adlam Capital Letter Va
𞤝 Adlam Capital Letter Kha
𞤞 Adlam Capital Letter Gbe
𞤟 Adlam Capital Letter Zal
𞤠 Adlam Capital Letter Kpo
𞤡 Adlam Capital Letter Sha
𞤢 Adlam Small Letter Alif
𞤣 Adlam Small Letter Daali
𞤤 Adlam Small Letter Laam
𞤥 Adlam Small Letter Miim
𞤦 Adlam Small Letter Ba
𞤧 Adlam Small Letter Sinnyiiyhe
𞤨 Adlam Small Letter Pe
𞤩 Adlam Small Letter Bhe
𞤪 Adlam Small Letter Ra
𞤫 Adlam Small Letter E
𞤬 Adlam Small Letter Fa
𞤭 Adlam Small Letter I
𞤮 Adlam Small Letter O
𞤯 Adlam Small Letter Dha
𞤰 Adlam Small Letter Yhe
𞤱 Adlam Small Letter Waw
𞤲 Adlam Small Letter Nun
𞤳 Adlam Small Letter Kaf
𞤴 Adlam Small Letter Ya
𞤵 Adlam Small Letter U
𞤶 Adlam Small Letter Jiim
𞤷 Adlam Small Letter Chi
𞤸 Adlam Small Letter Ha
𞤹 Adlam Small Letter Qaaf
𞤺 Adlam Small Letter Ga
𞤻 Adlam Small Letter Nya
𞤼 Adlam Small Letter Tu
𞤽 Adlam Small Letter Nha
𞤾 Adlam Small Letter Va
𞤿 Adlam Small Letter Kha
𞥀 Adlam Small Letter Gbe
𞥁 Adlam Small Letter Zal
𞥂 Adlam Small Letter Kpo
𞥃 Adlam Small Letter Sha
𞥄 Adlam Alif Lengthener
𞥅 Adlam Vowel Lengthener
𞥆 Adlam Gemination Mark
𞥇 Adlam Hamza
𞥈 Adlam Consonant Modifier
𞥉 Adlam Geminate Consonant Modifier
𞥊 Adlam Nukta
𞥋 Adlam Nasalization Mark
𞥐 Adlam Digit Zero
𞥑 Adlam Digit One
𞥒 Adlam Digit Two
𞥓 Adlam Digit Three
𞥔 Adlam Digit Four
𞥕 Adlam Digit Five
𞥖 Adlam Digit Six
𞥗 Adlam Digit Seven
𞥘 Adlam Digit Eight
𞥙 Adlam Digit Nine
𞥞 Adlam Initial Exclamation Mark
𞥟 Adlam Initial Question Mark
𞥋 Adlam Nasalization Mark
𞥐 Adlam Digit Zero
𞥑 Adlam Digit One
𞥒 Adlam Digit Two
𞥓 Adlam Digit Three
𞥔 Adlam Digit Four
𞥕 Adlam Digit Five
𞥖 Adlam Digit Six
𞥗 Adlam Digit Seven
𞥘 Adlam Digit Eight
𞥙 Adlam Digit Nine
𞥞 Adlam Initial Exclamation Mark
𞥟 Adlam Initial Question Mark
88 changes: 44 additions & 44 deletions picker/data/alphabetic_presentation_forms.csv
Original file line number Diff line number Diff line change
Expand Up @@ -10,49 +10,49 @@
ﬕ Armenian Small Ligature Men Ini
ﬖ Armenian Small Ligature Vew Now
ﬗ Armenian Small Ligature Men Xeh
יִ Hebrew Letter Yod With Hiriq
יִ Hebrew Letter Yod With Hiriq
ﬞ Hebrew Point Judeo-Spanish Varika
ײַ Hebrew Ligature Yiddish Yod Yod Patah
ﬠ Hebrew Letter Alternative Ayin
ﬡ Hebrew Letter Wide Alef
ﬢ Hebrew Letter Wide Dalet
ﬣ Hebrew Letter Wide He
ﬤ Hebrew Letter Wide Kaf
ﬥ Hebrew Letter Wide Lamed
ﬦ Hebrew Letter Wide Final Mem
ﬧ Hebrew Letter Wide Resh
ﬨ Hebrew Letter Wide Tav
ײַ Hebrew Ligature Yiddish Yod Yod Patah
ﬠ Hebrew Letter Alternative Ayin
ﬡ Hebrew Letter Wide Alef
ﬢ Hebrew Letter Wide Dalet
ﬣ Hebrew Letter Wide He
ﬤ Hebrew Letter Wide Kaf
ﬥ Hebrew Letter Wide Lamed
ﬦ Hebrew Letter Wide Final Mem
ﬧ Hebrew Letter Wide Resh
ﬨ Hebrew Letter Wide Tav
﬩ Hebrew Letter Alternative Plus Sign
שׁ Hebrew Letter Shin With Shin Dot
שׂ Hebrew Letter Shin With Sin Dot
שּׁ Hebrew Letter Shin With Dagesh And Shin Dot
שּׂ Hebrew Letter Shin With Dagesh And Sin Dot
אַ Hebrew Letter Alef With Patah
אָ Hebrew Letter Alef With Qamats
אּ Hebrew Letter Alef With Mapiq
בּ Hebrew Letter Bet With Dagesh
גּ Hebrew Letter Gimel With Dagesh
דּ Hebrew Letter Dalet With Dagesh
הּ Hebrew Letter He With Mapiq
וּ Hebrew Letter Vav With Dagesh
זּ Hebrew Letter Zayin With Dagesh
טּ Hebrew Letter Tet With Dagesh
יּ Hebrew Letter Yod With Dagesh
ךּ Hebrew Letter Final Kaf With Dagesh
כּ Hebrew Letter Kaf With Dagesh
לּ Hebrew Letter Lamed With Dagesh
מּ Hebrew Letter Mem With Dagesh
נּ Hebrew Letter Nun With Dagesh
סּ Hebrew Letter Samekh With Dagesh
ףּ Hebrew Letter Final Pe With Dagesh
פּ Hebrew Letter Pe With Dagesh
צּ Hebrew Letter Tsadi With Dagesh
קּ Hebrew Letter Qof With Dagesh
רּ Hebrew Letter Resh With Dagesh
שּ Hebrew Letter Shin With Dagesh
תּ Hebrew Letter Tav With Dagesh
וֹ Hebrew Letter Vav With Holam
בֿ Hebrew Letter Bet With Rafe
כֿ Hebrew Letter Kaf With Rafe
פֿ Hebrew Letter Pe With Rafe
ﭏ Hebrew Ligature Alef Lamed
שׁ Hebrew Letter Shin With Shin Dot
שׂ Hebrew Letter Shin With Sin Dot
שּׁ Hebrew Letter Shin With Dagesh And Shin Dot
שּׂ Hebrew Letter Shin With Dagesh And Sin Dot
אַ Hebrew Letter Alef With Patah
אָ Hebrew Letter Alef With Qamats
אּ Hebrew Letter Alef With Mapiq
בּ Hebrew Letter Bet With Dagesh
גּ Hebrew Letter Gimel With Dagesh
דּ Hebrew Letter Dalet With Dagesh
הּ Hebrew Letter He With Mapiq
וּ Hebrew Letter Vav With Dagesh
זּ Hebrew Letter Zayin With Dagesh
טּ Hebrew Letter Tet With Dagesh
יּ Hebrew Letter Yod With Dagesh
ךּ Hebrew Letter Final Kaf With Dagesh
כּ Hebrew Letter Kaf With Dagesh
לּ Hebrew Letter Lamed With Dagesh
מּ Hebrew Letter Mem With Dagesh
נּ Hebrew Letter Nun With Dagesh
סּ Hebrew Letter Samekh With Dagesh
ףּ Hebrew Letter Final Pe With Dagesh
פּ Hebrew Letter Pe With Dagesh
צּ Hebrew Letter Tsadi With Dagesh
קּ Hebrew Letter Qof With Dagesh
רּ Hebrew Letter Resh With Dagesh
שּ Hebrew Letter Shin With Dagesh
תּ Hebrew Letter Tav With Dagesh
וֹ Hebrew Letter Vav With Holam
בֿ Hebrew Letter Bet With Rafe
כֿ Hebrew Letter Kaf With Rafe
פֿ Hebrew Letter Pe With Rafe
ﭏ Hebrew Ligature Alef Lamed
Loading

0 comments on commit 74cb946

Please sign in to comment.