Skip to content
Snippets Groups Projects
Commit 0b9ee8d8 authored by Wuttke, Joachim's avatar Wuttke, Joachim
Browse files

+ devtools/code/hugo-shortcode-usage.py

parent 950185a1
No related branches found
No related tags found
1 merge request!1478Webdoc: describe Beam API; rm unused shortcodes
#!/usr/bin/env python3
# run over `fmd`
import edtools as et
import os, re, sys
flist = os.listdir('/G/sw/ba/hugo/layouts/shortcodes')
smap = {}
for fname in flist:
smap[fname.split('.')[0]] = 0
def user_edit(fn, t):
for sn in smap.keys():
for m in re.finditer(r'\W'+sn+r'\W', t):
smap[sn] += 1
return t
et.ed_argfiles(user_edit)
for sn, count in sorted(smap.items()):
print(f'{sn} used {count} times')
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment