ce9c806274
- menu is now coming from settings - content block is emptied in base - removed unused SVG icons
168 lines
4.3 KiB
Python
168 lines
4.3 KiB
Python
__author__ = "Peter Molnar"
|
|
__copyright__ = "Copyright 2017-2019, Peter Molnar"
|
|
__license__ = "apache-2.0"
|
|
__maintainer__ = "Peter Molnar"
|
|
__email__ = "mail@petermolnar.net"
|
|
|
|
import os
|
|
import re
|
|
import argparse
|
|
import logging
|
|
|
|
base = os.path.abspath(os.path.expanduser('~/Projects/petermolnar.net'))
|
|
syncserver = 'liveserver:/web/petermolnar.net'
|
|
|
|
site = {
|
|
'title': 'Peter Molnar',
|
|
'url': 'https://petermolnar.net',
|
|
'domain': 'petermolnar.net',
|
|
'pagination': 42,
|
|
'on_front': [
|
|
'article',
|
|
'photo',
|
|
'journal'
|
|
],
|
|
'licence': 'CC-BY-NC-ND-4.0',
|
|
'search': 'https://petermolnar.net/search.php',
|
|
'favicon': 'https://petermolnar.net/favicon.ico'
|
|
}
|
|
|
|
menu = {
|
|
'home': {
|
|
'url': '%s/' % site['url'],
|
|
'text': 'home',
|
|
},
|
|
'photo': {
|
|
'url': '%s/category/photo/' % site['url'],
|
|
'text': 'photos',
|
|
},
|
|
'journal': {
|
|
'url': '%s/category/journal/' % site['url'],
|
|
'text': 'journal',
|
|
},
|
|
'article': {
|
|
'url': '%s/category/article/' % site['url'],
|
|
'text': 'IT',
|
|
},
|
|
'note': {
|
|
'url': '%s/category/note/' % site['url'],
|
|
'text': 'notes'
|
|
},
|
|
'follow': {
|
|
'url': '%s/follow/' % site['url'],
|
|
'text': 'follow'
|
|
}
|
|
}
|
|
|
|
categorydisplay = {
|
|
'article': 'flat',
|
|
'journal': 'flat',
|
|
}
|
|
|
|
licence = {
|
|
'article': 'CC-BY-4.0',
|
|
'journal': 'CC-BY-NC-4.0',
|
|
}
|
|
|
|
meta = {
|
|
'webmention': 'https://webmention.io/petermolnar.net/webmention',
|
|
'pingback': 'https://webmention.io/petermolnar.net/xmlrpc',
|
|
'hub': 'https://petermolnar.superfeedr.com/',
|
|
'authorization_endpoint': 'https://indieauth.com/auth',
|
|
'token_endpoint': 'https://tokens.indieauth.com/token',
|
|
'micropub': 'https://petermolnar.net/micropub.php',
|
|
'microsub': 'https://aperture.p3k.io/microsub/83'
|
|
}
|
|
|
|
author = {
|
|
'name': 'Peter Molnar',
|
|
'email': 'mail@petermolnar.net',
|
|
'url': 'https://petermolnar.net/',
|
|
'avatar': 'https://petermolnar.net/molnar_peter_avatar.jpg',
|
|
'gpg': 'https://petermolnar.net/pgp.asc',
|
|
'cv': 'https://petermolnar.net/cv.html',
|
|
'github': 'https://github.com/petermolnar',
|
|
'about': 'https://petermolnar.net/about/',
|
|
'following': 'https://petermolnar.net/following.opml',
|
|
'tips': {
|
|
'monzo': {
|
|
'text': 'Monzo (only in the UK or via Google Pay)',
|
|
'url': 'https://monzo.me/petermolnar/3'
|
|
},
|
|
'paypal': {
|
|
'text': 'Paypal',
|
|
'url': 'https://paypal.me/petermolnar/3GBP'
|
|
}
|
|
}
|
|
}
|
|
|
|
paths = {
|
|
'content': os.path.join(base, 'content'),
|
|
'tmpl': os.path.join(base, 'nasg', 'templates'),
|
|
'watermark': os.path.join(base, 'nasg', 'templates', 'watermark.png'),
|
|
'build': os.path.join(base, 'www'),
|
|
'queue': os.path.join(base, 'queue'),
|
|
'remotewww': 'web',
|
|
'remotequeue': 'queue',
|
|
'micropub': os.path.join(base, 'content', 'note'),
|
|
'tmp': os.path.join(base, 'tmp'),
|
|
'home': os.path.join(base, 'content', 'home', 'index.md'),
|
|
}
|
|
|
|
photo = {
|
|
're_author': re.compile(r'(?:P[eé]ter Moln[aá]r)|(?:Moln[aá]r P[eé]ter)|(?:petermolnar\.(?:eu|net))'),
|
|
'default': 720,
|
|
'sizes': {
|
|
#90 = s
|
|
#360 = m
|
|
720: '',
|
|
1280: '_b',
|
|
},
|
|
}
|
|
|
|
tips = {
|
|
'paypal': 'https://paypal.me/petermolnar/3GBP',
|
|
'monzo': 'https://monzo.me/petermolnar/3',
|
|
}
|
|
|
|
dateformat = {
|
|
'iso': 'YYYY-MM-DDTHH:mm:ssZZ',
|
|
'display': 'YYYY-MM-DD HH:mm',
|
|
'fname': 'YYYYMMDDHHmmssZ',
|
|
}
|
|
|
|
_parser = argparse.ArgumentParser(description='Parameters for NASG')
|
|
_booleanparams = {
|
|
'regenerate': 'force downsizing images',
|
|
'force': 'force rendering HTML',
|
|
'nosync': 'skip sync to live server',
|
|
'debug': 'set logging to debug level',
|
|
'quiet': 'show only errors'
|
|
}
|
|
|
|
for k, v in _booleanparams.items():
|
|
_parser.add_argument(
|
|
'--%s' % (k),
|
|
action='store_true',
|
|
default=False,
|
|
help=v
|
|
)
|
|
|
|
args = vars(_parser.parse_args())
|
|
|
|
if args.get('debug', False):
|
|
loglevel = 10
|
|
elif args.get('quiet', False):
|
|
loglevel = 40
|
|
else:
|
|
loglevel = 20
|
|
|
|
logger = logging.getLogger('NASG')
|
|
logger.setLevel(loglevel)
|
|
|
|
console_handler = logging.StreamHandler()
|
|
formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s')
|
|
console_handler.setFormatter(formatter)
|
|
logger.addHandler(console_handler)
|
|
|
|
logging.getLogger('asyncio').setLevel(loglevel)
|