Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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