Skip to content

Instantly share code, notes, and snippets.

@ashwinvis
Last active September 30, 2021 13:39
Show Gist options
  • Save ashwinvis/980412bcbed221f95fa89cbdb73b40be to your computer and use it in GitHub Desktop.
Save ashwinvis/980412bcbed221f95fa89cbdb73b40be to your computer and use it in GitHub Desktop.
Check if a term is already included in glossario
#!/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