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 re
import shutil import shutil
from datetime import datetime from datetime import datetime
import importlib # TODO flith
# TODO import from shared import sys
TagHelper = importlib.load_module('shared.TagHelper') sys.path.append("./")
from shared import TagHelper, config
# Default encoding # Default encoding
encoding = 'utf-8' encoding = 'utf-8'
# Import local files # Import local files
mistune = __import__('mistune') mistune = __import__('mistune')
# TODO import from shared
config = __import__('shared.config')
# Activating the renderer # Activating the renderer
renderer = mistune.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) template = env.get_template(template)
if len(entry['tags']) > 1: if len(entry['tags']) > 1:
entry['tags'] = entry['tags'].split(' ') 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 # Checking if content folder exists
folderExists = os.path.exists(site_folder+entry['folder']) folderExists = os.path.exists(site_folder+entry['folder'])
@ -270,7 +268,7 @@ def get_date(page):
def parse_headings(page): def parse_headings(page):
try: try:
page = re.sub(r'= [\[\]a-zA-Z0-9:|+ ]* =', page = re.sub(r'= [\[\]a-zA-Z0-9:|+& ]* =',
lambda x: x.group().replace('=','###', 1).strip('='), lambda x: x.group().replace('=','###', 1).strip('='),
page) page)
return page return page

View file

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

View file

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

View file

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

View file

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