nearly at the finish line, mostly got to tidy up kitaab some more. maybe fix up the header??
This commit is contained in:
parent
ef7a0c7812
commit
328fe29f4d
162
src/kitaab-public/asset/header.css
Normal file
162
src/kitaab-public/asset/header.css
Normal file
|
@ -0,0 +1,162 @@
|
|||
@define-mixin menu {
|
||||
position: absolute;
|
||||
background: var(--background);
|
||||
box-shadow: var(--shadow);
|
||||
color: white;
|
||||
border: 2px solid;
|
||||
margin: 0;
|
||||
padding: 10px;
|
||||
list-style: none;
|
||||
z-index: 99;
|
||||
}
|
||||
|
||||
.header {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
position: relative;
|
||||
|
||||
@media print {
|
||||
display: none;
|
||||
}
|
||||
|
||||
&__inner {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
&__logo {
|
||||
display: flex;
|
||||
flex: 1;
|
||||
|
||||
&:after {
|
||||
content: '';
|
||||
background: repeating-linear-gradient(90deg, var(--accent), var(--accent) 2px, transparent 0, transparent 10px);
|
||||
display: block;
|
||||
width: 100%;
|
||||
right: 10px;
|
||||
}
|
||||
|
||||
a {
|
||||
flex: 0 0 auto;
|
||||
max-width: 100%;
|
||||
text-decoration: none;
|
||||
}
|
||||
}
|
||||
|
||||
.menu {
|
||||
--shadow-color: color-mod(var(--background) a(80%));
|
||||
--shadow: 0 10px var(--shadow-color), -10px 10px var(--shadow-color), 10px 10px var(--shadow-color);
|
||||
margin: 20px 1px;
|
||||
|
||||
@media (--phone) {
|
||||
@mixin menu;
|
||||
top: 50px;
|
||||
right: 0;
|
||||
}
|
||||
|
||||
&__inner {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
list-style: none;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
|
||||
&--desktop {
|
||||
@media (--phone) {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
|
||||
&--mobile {
|
||||
display: none;
|
||||
|
||||
@media (--phone) {
|
||||
display: block;
|
||||
}
|
||||
}
|
||||
|
||||
li {
|
||||
&:not(:last-of-type) {
|
||||
margin-right: 20px;
|
||||
margin-bottom: 10px;
|
||||
flex: 0 0 auto;
|
||||
}
|
||||
}
|
||||
|
||||
@media (--phone) {
|
||||
flex-direction: column;
|
||||
align-items: flex-start;
|
||||
padding: 0;
|
||||
|
||||
li {
|
||||
margin: 0;
|
||||
padding: 5px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
&__sub-inner {
|
||||
position: relative;
|
||||
list-style: none;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
|
||||
&:not(:only-child) {
|
||||
margin-left: 20px;
|
||||
}
|
||||
|
||||
&-more {
|
||||
@mixin menu;
|
||||
top: 35px;
|
||||
left: 0;
|
||||
|
||||
&-trigger {
|
||||
color: var(--accent);
|
||||
user-select: none;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
li {
|
||||
margin: 0;
|
||||
padding: 5px;
|
||||
white-space: nowrap;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.spacer {
|
||||
flex-grow: 1;
|
||||
}
|
||||
|
||||
.language-selector {
|
||||
position: relative;
|
||||
list-style: none;
|
||||
margin: 0;
|
||||
|
||||
&-current {
|
||||
list-style-type: none;
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
color: var(--accent);
|
||||
cursor: pointer;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
&__more {
|
||||
@mixin menu;
|
||||
top: 35px;
|
||||
right: 0;
|
||||
}
|
||||
}
|
||||
|
||||
&-trigger {
|
||||
color: var(--accent);
|
||||
border: 2px solid;
|
||||
margin-left: 10px;
|
||||
height: 100%;
|
||||
padding: 3px 8px;
|
||||
position: relative;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -291,4 +291,4 @@ ul>*+* {
|
|||
--article-shadow: #333;
|
||||
--link: var(--purple-light-transparent);
|
||||
}
|
||||
} */
|
||||
} */
|
||||
|
|
|
@ -2,6 +2,7 @@ from jinja2 import Environment, FileSystemLoader
|
|||
import argparse
|
||||
import glob
|
||||
import os
|
||||
import random
|
||||
import platform
|
||||
import re
|
||||
import shutil
|
||||
|
@ -212,7 +213,7 @@ def fix_wiki_links(page, path):
|
|||
captured_group = match.group(groupNum + 1)
|
||||
link_elem = captured_group.split("|")
|
||||
if len(link_elem) > 1:
|
||||
full_url = "<a href='" + build_url + link_elem[0].strip() + ".html' >" + link_elem[0].strip() + "</a>"
|
||||
full_url = "<a href='" + build_url + link_elem[0].strip() + ".html' >" + link_elem[1].strip() + "</a>"
|
||||
else:
|
||||
if config.flat_build:
|
||||
full_url = "<a href='" + build_url + link_elem[0].strip() + ".html' >" + link_elem[0].strip() + "</a>"
|
||||
|
@ -253,15 +254,41 @@ def remove_date(page):
|
|||
return page
|
||||
|
||||
|
||||
def replacement_function(replace):
|
||||
replace = replace.group()
|
||||
replace = replace.strip('@<>')
|
||||
if replace == 'name-generation':
|
||||
# TODO gross hardcoded
|
||||
lines = []
|
||||
with open('raw/210124-0033.wiki') as f:
|
||||
lines = f.readlines()
|
||||
lines = lines[-2:]
|
||||
line1 = lines[0].split(',')
|
||||
line2 = lines[1].split(',')
|
||||
line1len = len(line1)
|
||||
line2len = len(line2)
|
||||
first = line1[random.randrange(line1len)]
|
||||
second = line2[random.randrange(line2len)]
|
||||
return first + ' ' + second
|
||||
|
||||
|
||||
def replace_generated(page):
|
||||
#try:
|
||||
page = re.sub(r'@<[A-Za-z- ]*>',
|
||||
replacement_function,
|
||||
page)
|
||||
return page
|
||||
#except Exception as e:
|
||||
# print(e)
|
||||
# print(f"Could not replace generated in {page}")
|
||||
# return page
|
||||
|
||||
|
||||
def get_date(page):
|
||||
try:
|
||||
textContent = page.splitlines()
|
||||
date = textContent[2]
|
||||
if '%date' in date:
|
||||
textContent.strip('%date')
|
||||
date = str(datetime.strptime(textContent, '%y%m%d-%H%M'))
|
||||
return date
|
||||
return None
|
||||
regex = r"%date [0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}"
|
||||
match = re.findall(regex, page)[0].strip('%date')
|
||||
return match
|
||||
except:
|
||||
#print(f"Could not parse date")
|
||||
return None
|
||||
|
@ -292,6 +319,7 @@ def create_entries(pages):
|
|||
|
||||
markdown_text = open(page, 'r').read()
|
||||
markdown_text = parse_headings(markdown_text)
|
||||
markdown_text = replace_generated(markdown_text)
|
||||
markdown_text = style_iframes(markdown_text)
|
||||
markdown_text = fix_images_urls(markdown_text)
|
||||
markdown_text = fix_wiki_links(markdown_text, path["folder"])
|
||||
|
@ -312,7 +340,7 @@ def create_entries(pages):
|
|||
if date:
|
||||
tempPage['date'] = date
|
||||
else:
|
||||
tempPage['date'] = path['iso_date']
|
||||
tempPage['date'] = path['iso_date'][:-3]
|
||||
tempPage['title'] = fix_amp(title)
|
||||
tempPage['pageContent'] = pageContent
|
||||
tempPage['tags'] = tags
|
||||
|
|
|
@ -7,16 +7,18 @@ from os import listdir, mkdir, path, remove
|
|||
import shutil
|
||||
import random
|
||||
import json
|
||||
import shared.TagHelper as TagHelper
|
||||
import convert
|
||||
from icecream import ic
|
||||
import sys
|
||||
sys.path.append("../")
|
||||
from shared.censor import privateList
|
||||
from shared import TagHelper
|
||||
|
||||
## TODO: generalize based on headings(?) in index.wiki
|
||||
|
||||
censor = privateList
|
||||
# TODO put this in config too...
|
||||
filter = ["dream", "gratitude", "review", "jrnl", "piracy", "work", "job", "debt", "people", "priv", "threatdefence"]
|
||||
filter = ["dream", "gratitude", "review", "jrnl", "work", "job", "debt", "people", "priv", "threatdefence", "info"]
|
||||
#TODO create = ...
|
||||
|
||||
def loadNetwork(path='network.json'):
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
{% endif %}
|
||||
{% endif %}
|
||||
</h3>
|
||||
<p style='position:absolute;bottom:0;margin-left:29em'>{{entry['date'].split(' ')[0]}}</p>
|
||||
<p style='position:absolute;bottom:0;margin-left:29em'>{{entry['date']}}</p>
|
||||
</div>
|
||||
{% for page in entry['tags'].split(' ') %}
|
||||
<a href="{{page}}_index.html">
|
||||
|
|
|
@ -45,7 +45,7 @@ media="screen" title="no title" charset="utf-8">
|
|||
|
||||
<body class="flow-large container">
|
||||
<header>
|
||||
<a href="home.html" aria-label="{{config.name_of_site}}">{{config.name_of_site}}</a>
|
||||
<a style='display:flex;padding-top:10px' href="home.html" aria-label="{{config.name_of_site}}">{{config.name_of_site}}</a>
|
||||
</header>
|
||||
<main>
|
||||
{{ page_navigation }}
|
||||
|
|
Loading…
Reference in a new issue