Inspect metadata such as front matter, word count, etc. of markdown files.
assert get_meta('test_files/front_matter2.md')['mdseo-ignore'] == ['title', 'body', 'desc']
test_eq(get_meta('test_files/front_matter_test_docs.md'),
{'fname': 'test_files/front_matter_test_docs.md',
'n_words': 2,
'key2': 'value2',
'slug': 'custom/pathfor/site/this-is-waytoolong/wedontwantthis',
'key': 'value',
'mdseo-ignore': []}
)
assert len(meta_list('.')) > 1
assert find_dupe('.', 'title')
assert not find_dupe('.', 'foo')
test_fail(chk_dupe_title)
assert not _min_len_err(_test_fm, 'description', 10000) #this is in mdeseo-ignore so rule is ignored
assert not _min_len_err(_test_fm, 'image', 10) # this key doesn't exist
assert len(_test_fm['slug']) == 19
assert _min_len_err(_test_fm, 'slug', 500) # 50 > 5
assert _max_len_err(_test_fm, 'slug', 5) # 19 > 5
assert not _min_len_err(_test_fm, 'slug', 5)
assert not _max_len_err(_test_fm, 'slug', 39)
_test_fm4 = get_meta('test_files/front_matter4.md')
assert not _max_len_err(_test_fm4, 'slug', 5) # because slug is in seo-ignore
assert not _min_len_err(_test_fm4, 'slug', 500) # because slug is in seo-ignore
test_fail(partial(chk_fm, key='description'))
test_fail(partial(chk_fm, key='authors'))
test_fail(chk_len)