Last active
September 30, 2021 13:39
-
-
Save ashwinvis/980412bcbed221f95fa89cbdb73b40be to your computer and use it in GitHub Desktop.
Check if a term is already included in glossario
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env xonsh | |
# Requires: xonsh, awk | |
# git clone https://github.com/carpentries/glosario | |
# cd glossario | |
# xonsh already_included_in_glossario.xsh | |
slugs = [ | |
name.strip() | |
for name in $(awk -F: '/slug/{print $2}' glossary.yml).splitlines() | |
] | |
print(slugs) | |
for name in """ | |
browser cache | |
control flow | |
decrement | |
encoding | |
error | |
feature | |
field | |
head | |
increment | |
index | |
keyword | |
merge | |
network | |
node | |
option | |
parameter | |
PyPI | |
record | |
reserved word | |
scope | |
source code | |
stack | |
type | |
variable | |
workflow | |
""".splitlines(): | |
name_lowercase = "_".join(name.lower().split()) | |
if name_lowercase in slugs: | |
# print(name, end=" ") | |
i = slugs.index(name_lowercase) | |
print(slugs[i]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment