diff --git a/src/kitaab-public/build/build.py b/src/kitaab-public/build/build.py index ef902ce..58b89c5 100644 --- a/src/kitaab-public/build/build.py +++ b/src/kitaab-public/build/build.py @@ -68,7 +68,8 @@ def generate_index_pages(template=config.template_index, template_nav=config.tem # Build the files by filling out the template file_loader = FileSystemLoader('') env = Environment(loader=file_loader) - template = env.get_template(template) + # regular index pagse use main template + template = env.get_template(config.template_file) current_index_template = template.render(page_body=subPages, page_date=None, page_tags=None, page_navigation=generate_navigation(template_nav), page_title='index', config=config) slugfile = config.build_folder + index + '_index.html' with open(slugfile, 'w', encoding=encoding) as fobj: @@ -77,11 +78,16 @@ def generate_index_pages(template=config.template_index, template_nav=config.tem file_loader = FileSystemLoader('') env = Environment(loader=file_loader) template = env.get_template(template) - current_index_template = template.render(page_body="".join(metaIndexSubPages), page_date=None, page_tags=None, page_navigation=generate_navigation(template_nav), page_title='index', config=config) + # TODO tag_index subpage is sbroken + # create this page by parsing data instead of pages, like untagged below + print(metaIndexSubPages) + current_index_template = template.render(index_urls=metaIndexSubPages, page_date=None, page_tags=None, page_navigation=generate_navigation(template_nav), page_title='index', config=config) slugfile = config.build_folder + 'tag_index.html' with open(slugfile, 'w', encoding=encoding) as fobj: fobj.write(current_index_template) +# TODO import TagHelper.get_untagged() and make one of the indexs pages + # Generates html files in the site folder, using the entries and the template. def generate_html_pages(site_folder, entries, template, sub_pages_list, template_nav): @@ -256,11 +262,8 @@ def get_date(page): def parse_headings(page): try: - # TODO for some reason this one isn't being parsed by the regex - if '= Kitaab =' in page: - print(page) - page = re.sub(r'= [\[\]a-zA-Z0-9 ]* =', - lambda x: x.group().replace('=','#', 1).strip('='), + page = re.sub(r'= [\[\]a-zA-Z0-9:|+ ]* =', + lambda x: x.group().replace('=','###', 1).strip('='), page) return page except Exception as e: @@ -282,6 +285,7 @@ def create_entries(pages): continue markdown_text = open(page, 'r').read() + markdown_text = parse_headings(markdown_text) markdown_text = style_iframes(markdown_text) markdown_text = fix_images_urls(markdown_text) markdown_text = fix_wiki_links(markdown_text, path["folder"]) @@ -290,7 +294,6 @@ def create_entries(pages): markdown_text = remove_tags(markdown_text) markdown_text = remove_title(markdown_text) markdown_text = remove_date(markdown_text) - markdown_text = parse_headings(markdown_text) pageContent = markdown(markdown_text) # Create the page object with all the informations we need @@ -391,7 +394,7 @@ def clean_path(path): path_items["slug"] = path_items["folder"] + "/" + path_items["slug"] # TODO weird special case - if "index" in path_items["file"]: + if "index" == path_items["file"]: path_items["parent_url"] = "" path_items["parent_text"] = config.home_name path_items["slug"] = "created_index" + ".html" @@ -424,7 +427,6 @@ def generate_sub_pages(entries, num, folder, title, title_name=""): else: link_url = entry["file"] + ".html" -# TODO there's a comma being generated here somewhere in metaIndexSubPages that I'm trying to get rid of if entry["file"] != "index": entry_string = "
  • + + {% set count = 0 %} + + {% for index_url in index_urls %} + + {% set count = count + 1 %} + {% if count == 5 %} + + + {% endif %} + {% endfor %} +
    {{index_url}}
    +

    + + + + diff --git a/src/kitaab-public/partial/main.html b/src/kitaab-public/partial/main.html index 3d5eae9..aa667b0 100644 --- a/src/kitaab-public/partial/main.html +++ b/src/kitaab-public/partial/main.html @@ -49,6 +49,7 @@ media="screen" title="no title" charset="utf-8">
    {{ page_navigation }} +

    {{page_title}}

    {{page_tags}}