fixed up lists and tag_index a lil

This commit is contained in:
Anish Lakhwara 2022-02-07 23:41:16 +10:00
parent d47cc8901f
commit 15a96b5846
5 changed files with 11 additions and 15 deletions

View file

@ -6,18 +6,16 @@ import platform
import re
import shutil
from datetime import datetime
import importlib
# TODO import from shared
TagHelper = importlib.load_module('shared.TagHelper')
# TODO flith
import sys
sys.path.append("./")
from shared import TagHelper, config
# Default encoding
encoding = 'utf-8'
# Import local files
mistune = __import__('mistune')
# TODO import from shared
config = __import__('shared.config')
# Activating the renderer
renderer = mistune.Renderer()
@ -107,7 +105,7 @@ def generate_html_pages(site_folder, entries, template, sub_pages_list, template
template = env.get_template(template)
if len(entry['tags']) > 1:
entry['tags'] = entry['tags'].split(' ')
page_template = template.render(page_body=entry['pageContent'], page_date="<date>%s</date>"%entry['date'], page_tags=entry['tags'], naem_of_site="Kitaab", page_navigation=nav_html, page_title=entry['title'], build_url=entry['parent_text'], config=config)
page_template = template.render(page_body=entry['pageContent'], page_date="<date>%s</date>"%entry['date'], page_tags=entry['tags'], name_of_site="Kitaab", page_navigation=nav_html, page_title=entry['title'], build_url=entry['parent_text'], config=config)
# Checking if content folder exists
folderExists = os.path.exists(site_folder+entry['folder'])
@ -270,7 +268,7 @@ def get_date(page):
def parse_headings(page):
try:
page = re.sub(r'= [\[\]a-zA-Z0-9:|+ ]* =',
page = re.sub(r'= [\[\]a-zA-Z0-9:|+& ]* =',
lambda x: x.group().replace('=','###', 1).strip('='),
page)
return page

View file

@ -50,7 +50,7 @@ media="screen" title="no title" charset="utf-8">
<main>
{{page_navigation}}
<h1> {{page_title}} </h1>
<div id='piles' style="float: right;">
<div id='piles' style="float: left;">
<table style="width:100%">
<tr>
{% set count = namespace(value=0) %}

View file

@ -3,8 +3,7 @@
{% endif %}
<ul class='listing'>
{% for entry in entries %}
<li>
<div style='overflow: hidden;'>
<div style='overflow: hidden; display:flex; justify-content: space-between;position:relative'>
<h3 style='float:left;'>
{% if title %}
<a href='{{entry['slug']}}'>{{entry["title"]}}</a>
@ -20,13 +19,12 @@
{% endif %}
{% endif %}
</h3>
<p style='float:right;'>{{entry['date']}}</p>
<p style='position:absolute;bottom:0;margin-left:21em'>{{entry['date']}}</p>
</div>
{% for page in entry['tags'].split(' ') %}
<a href="{{page}}_index.html">
{{page}}
</a>
{% endfor %}
</li>
{% endfor %}
</ul>

View file

@ -50,7 +50,7 @@ media="screen" title="no title" charset="utf-8">
<main>
{{ page_navigation }}
<h1> {{page_title}} </h1>
<div style='max-width:460px;'>
<div style='max-width:560px;'>
<article class="flow">
{% if page_tags %}
{% for page in page_tags %}

View file

@ -78,5 +78,5 @@ def getAllTags():
all_tags = makeDictFromTags(loadTagFile())
all_tags['untagged'] = getUntaggedFiles()
for tag in privateList:
all_tags.pop(tag)
all_tags.pop(tag, None)
return all_tags