working clean build
This commit is contained in:
parent
85b2750204
commit
e787a657a7
|
@ -101,6 +101,7 @@ def generate_table_index(template=config.template_index, template_nav=config.tem
|
|||
page_navigation=generate_navigation(
|
||||
template_nav),
|
||||
page_title='Piles',
|
||||
head=generate_head(),
|
||||
config=config)
|
||||
slugfile = config.build_folder + 'tag_index.html'
|
||||
with open(slugfile, 'w', encoding=encoding) as fobj:
|
||||
|
@ -121,6 +122,7 @@ def generate_html_pages(site_folder, entries, template, sub_pages_list, template
|
|||
if len(entry['tags']) > 1:
|
||||
entry['tags'] = entry['tags'].split(' ')
|
||||
page_template = template.render(
|
||||
head=generate_head(page_title=entry['title']),
|
||||
page_body=entry['pageContent'],
|
||||
page_date="<date>%s</date>" % entry['date'],
|
||||
page_tags=entry['tags'],
|
||||
|
@ -283,7 +285,6 @@ def remove_date(page):
|
|||
page = re.sub(regex, '', page)
|
||||
return page
|
||||
except Exception as e:
|
||||
print(e)
|
||||
print(f'Unexpected error in removing date in {page}')
|
||||
return page
|
||||
|
||||
|
@ -417,7 +418,7 @@ def clean_path(path):
|
|||
"slug": None,
|
||||
"date": None,
|
||||
"folder": items[0],
|
||||
"file": items[1]
|
||||
"file": items[len(items) - 1]
|
||||
}
|
||||
|
||||
# xx-xx-xxxx = xx-xx-xxxx.html
|
||||
|
@ -499,10 +500,11 @@ def generate_sub_pages(entries, num, folder, title, title_name=""):
|
|||
# Create the list
|
||||
file_loader = FileSystemLoader('')
|
||||
env = Environment(loader=file_loader)
|
||||
# TODO maybe not hardcode
|
||||
template = env.get_template(config.template_list)
|
||||
sub_page_list = template.render(
|
||||
entries=selected_entries, title_name=title_name, title=title)
|
||||
entries=selected_entries,
|
||||
title_name=title_name,
|
||||
title=title)
|
||||
|
||||
return sub_page_list
|
||||
|
||||
|
@ -533,8 +535,8 @@ def create_rss_feed(rss_entries, rss_template, rss_item_template, site_folder):
|
|||
entry_template = itemTemplate
|
||||
entry_template = entry_template.replace(
|
||||
'rssItemTitle', rss_entry["title"])
|
||||
entry_template = entry_template.replace('rssItemUrl', build_url
|
||||
+ rss_entry["slug"])
|
||||
entry_template = entry_template.replace('rssItemUrl', build_url +
|
||||
rss_entry["slug"])
|
||||
entry_template = entry_template.replace(
|
||||
'rssItemDate', rss_entry["iso_date"])
|
||||
entry_template = entry_template.replace(
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>{{page_title}} | {{config.name_of_site}}</title>
|
||||
<meta property="og:title" content="{{page_title}} | {{config.name_of_site}}">
|
||||
<title>{{page_title}} | {{name_of_site}}</title>
|
||||
<meta property="og:title" content="{{page_title}} | {{name_of_site}}">
|
||||
<meta property="og:type" content="website">
|
||||
<meta property="og:description"
|
||||
content="config.site_meta_description">
|
||||
<meta property="og:site_name" content="{{config.name_of_site}}">
|
||||
content="site_meta_description">
|
||||
<meta property="og:site_name" content="{{name_of_site}}">
|
||||
<meta property="og:url" content="{{build_url}}">
|
||||
<meta property="og:image" content="assets/social.png">
|
||||
<meta property="og:image:height" content="300">
|
||||
|
|
|
@ -52,30 +52,35 @@ def makeSetFromTags(tagFile, key='file'):
|
|||
def makeDictFromTags(tagFile, key='name', value='file'):
|
||||
entry = TagEntry()
|
||||
tag = tagFile.next(entry)
|
||||
allFiles = getAllFiles()
|
||||
ret = {}
|
||||
while tag:
|
||||
# Not sure why they're being read as bytes now?
|
||||
strKey = entry[key].decode()
|
||||
strValue = entry[value].decode()
|
||||
if strKey not in ret.keys():
|
||||
ret[strKey] = set()
|
||||
ret[strKey].add(strValue)
|
||||
if strValue in allFiles:
|
||||
if strKey not in ret.keys():
|
||||
ret[strKey] = set()
|
||||
ret[strKey].add(strValue)
|
||||
else:
|
||||
ret[strKey].add(strValue)
|
||||
else:
|
||||
ret[strKey].add(strValue)
|
||||
print(f"found only tag {strValue}")
|
||||
tag = tagFile.next(entry)
|
||||
return ret
|
||||
|
||||
|
||||
def getAllFilesWithTags():
|
||||
# Returns a set containing all the files we wish to make public
|
||||
return makeSetFromTags(loadTagFile())
|
||||
ret = makeSetFromTags(loadTagFile())
|
||||
allFiles = getAllFiles()
|
||||
onlyTags = ret - allFiles
|
||||
return ret - onlyTags
|
||||
|
||||
|
||||
def getUntaggedFiles():
|
||||
allFiles = getAllFiles()
|
||||
allTags = getAllFilesWithTags()
|
||||
print("All tags from untagged")
|
||||
print(allTags)
|
||||
return allFiles - allTags
|
||||
|
||||
|
||||
|
@ -84,5 +89,6 @@ def getAllTags():
|
|||
# - key as tag titles
|
||||
# - values as files that have the key in their tags
|
||||
all_tags = makeDictFromTags(loadTagFile())
|
||||
print(f"untagged: {getUntaggedFiles()}")
|
||||
all_tags['untagged'] = getUntaggedFiles()
|
||||
return all_tags
|
||||
|
|
|
@ -50,11 +50,11 @@
|
|||
"nixpkgs": "nixpkgs_2"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1649938384,
|
||||
"narHash": "sha256-VZUS7k1NFszRpvvpZKgswF3dlv72DvkRyNrir7RLlus=",
|
||||
"lastModified": 1649943612,
|
||||
"narHash": "sha256-SDpQSBgNkfpBCIFnwH7gtDi+Ip0/3QdlGmiumM6W5xA=",
|
||||
"ref": "main",
|
||||
"rev": "b96c3ee8a8d1b9b83b2a27e6fc6100f3c2cf8bcc",
|
||||
"revCount": 304,
|
||||
"rev": "c18b26c49ece10fbd770d8422661c34363ecc199",
|
||||
"revCount": 308,
|
||||
"type": "git",
|
||||
"url": "ssh://gitea@git.sealight.xyz/aynish/kitaab"
|
||||
},
|
||||
|
|
Loading…
Reference in a new issue