29 lines
670 B
Python
29 lines
670 B
Python
import os
|
|
from markdown import markdown
|
|
import frontmatter
|
|
|
|
markdown_dir = '{}/markdown'.format(
|
|
os.path.dirname(os.path.abspath(__file__)))
|
|
|
|
def __get_content_dict():
|
|
faqs = dict()
|
|
for f in os.listdir(markdown_dir):
|
|
f_abspath = '{}/{}'.format(markdown_dir, f)
|
|
matter = frontmatter.load(f_abspath)
|
|
faq = {matter.metadata['question']: {
|
|
'tag': matter.metadata['tag'],
|
|
'answer': markdown(matter.content)}}
|
|
|
|
faqs.update(faq)
|
|
|
|
return faqs
|
|
|
|
content = __get_content_dict()
|
|
def get_content():
|
|
return content
|
|
|
|
title = 'Frequently asked questions'
|
|
def get_title():
|
|
return title
|
|
|