diff --git a/src/usr/bin/tyto b/src/usr/bin/tyto index 93791f1..c222220 100755 --- a/src/usr/bin/tyto +++ b/src/usr/bin/tyto @@ -59,6 +59,7 @@ target = args.set_target() import dom, status status.domain() + # Command start argument import check, form, html, new, publish, show, wip, infos actions = { diff --git a/src/var/lib/tyto/help/styles.css b/src/var/lib/tyto/help/styles.css new file mode 100644 index 0000000..4a202c8 --- /dev/null +++ b/src/var/lib/tyto/help/styles.css @@ -0,0 +1,138 @@ +/* + * All class / ID used by Tyto - Littérateur in a page + * DOMAIN MUST be changed by domain css set in configuration +*/ + +/* + * Header +*/ +header#header_page { +} + +div#site_logo { +} + +a#site_logo_link { +} + +img#site_logo_image { +} + +div#site_infos { +} + +a#site_link { +} + +h1#site_title { +} + +p#site_about { +} + + +/* + * navbar +*/ +nav#site_menu { +} + +ul#site_menu_items { +} + +li.site_menu_item { +} + +a.site_menu_link { +} + +/* + * article +*/ +article#article_main { +} + +h1#main_title { +} +h2.title_2 { +} +h3.title_3 { +} +h4.title_4 { +} +h5.title_5 { +} +h6.title_6 { +} + +/* Between every IF CONTENTS */ +div.contents { +} + +/* Default if not set in post */ +p.DOMAIN { +} + +br.DOMAIN { +} + +a.link { +} + +a.anchor_link { +} + +abbr.DOMAIN { +} + +img.DOMAIN_image { +} + +code.icode { +} + +ul.DOMAIN { +} +li.DOMAIN + +strong.strong { +} +b.bold { +} +em.em{ +} +i.italic { +} +del.del { +} +u.underline { +} +cite.cite { +} +span.custom { +} + + +/* section for author and date */ +section#article_infos { +} + +span#article_author { +} + +span#article_pub { +} + +span#article_code { +} + +a#article_code_link { +} + +/* + * sidebar +*/ + +/* + * footer +*/ diff --git a/src/var/lib/tyto/program/args.py b/src/var/lib/tyto/program/args.py index fd57bfb..39d0e77 100644 --- a/src/var/lib/tyto/program/args.py +++ b/src/var/lib/tyto/program/args.py @@ -33,7 +33,7 @@ #********************************************************************** -import sys +import os, sys import infos, logs @@ -123,11 +123,6 @@ try: target = sys.argv[2] except: target = '' -# Some conditions exiting -#if action == "check" and target == "newer": -# logs.out("11", '"%s" with "%s"'%(target, action), True) - - # Set action and target for binary def set_action(): return(action) diff --git a/src/var/lib/tyto/program/check.py b/src/var/lib/tyto/program/check.py index 6850050..09cccd7 100644 --- a/src/var/lib/tyto/program/check.py +++ b/src/var/lib/tyto/program/check.py @@ -40,7 +40,7 @@ from datetime import datetime from time import gmtime, strftime import args, dom, logs, status, db, form, tyto, langs -domain_dir = post_err = False +domain_dir = post_err = multi_chk = False #=========================# @@ -68,8 +68,8 @@ def manage(target): logs.out("1", db.uri_file, True) # Already check - elif db.exists \ - and not db.old_chk: + elif db.exists and not db.old_chk: + print(' ├─ [%s] > %s'%(db.title, db.uri_file)) logs.out("20", '%s > %s'%(db.date_chk, db.uri_file), False) answer = form.asking(' ├ %s%s '%( langs.site.check_a, langs.site.q @@ -112,13 +112,15 @@ def check_module(target): # but check only if article source has changed # #----------------------------------------------# def check_all(option): - global domain_dir + global multi_chk + multi_chk = True found = False - if option == "added": - os.chdir(dom.articles_d) - domain_dir = True - + # With [added], article must NOT have a DB + # Search every .tyto in domain from articles/ + # Then Do a check, and return + #----------------------------------------- + if option == "added": for root, dirs, files in os.walk(dom.articles_d[:-1]): for file in files: if (file.endswith('.tyto')): @@ -133,15 +135,18 @@ def check_all(option): check_process(args.target) print() return - - + + # With [updated], Article must have changed + # with [again], force check + # Article must have a DB + #------------------------------------------ for post_db in os.listdir(dom.articles_db_d): if post_db.endswith('.config'): # Load DB post_db = '%s%s'%(dom.articles_db_d, post_db) try: exec(open(post_db).read(),globals()) - args.target = post_src.rsplit('%s/'%db.in_dir)[1] + args.target = short_src importlib.reload(db) except: continue @@ -161,7 +166,8 @@ def check_all(option): # Check articles process # #------------------------# def check_process(target): - if not db.post: sys.exit(1) + if not db.post: + logs.out("1", db.post, True) global post_bottom, article_bottom global date_wip, hash_wip, date_www, hash_www, post_bottom @@ -964,5 +970,7 @@ def create_database(): #--------------- database = '%s\n%s\n%s'%(database, opt_tags, db_stats) tyto.set_file(db.config, 'New', database) - logs.out("21", db.uri_file, False) + + if not multi_chk: + logs.out("21", db.uri_file, False) diff --git a/src/var/lib/tyto/program/db.py b/src/var/lib/tyto/program/db.py index 4aa9fda..7cbf754 100644 --- a/src/var/lib/tyto/program/db.py +++ b/src/var/lib/tyto/program/db.py @@ -34,16 +34,12 @@ #********************************************************************** import os -import args, logs, dom, form, tyto, check +import args, logs, dom, form, tyto, check, publish remove = exists = post = corrupt = False -try: - # with check newer, use domain root directory - if check.domain_dir: - os.chdir(dom.articles_d) - in_dir = os.getcwd() -except: logs.out("13", '', True) +if dom.hole: + logs.out("13", '', True) # target needs db (file). @@ -55,8 +51,8 @@ if args.target \ # Domain must be valid if not dom.exists: logs.out("10", '', True) - - uri_file = '%s/%s'%(in_dir, args.target) + + uri_file = '%s%s'%(dom.articles_d, args.target) uri_id = tyto.get_filesum(uri_file, False) # Set DB file diff --git a/src/var/lib/tyto/program/dom.py b/src/var/lib/tyto/program/dom.py index 5b8ee6e..97f7a91 100644 --- a/src/var/lib/tyto/program/dom.py +++ b/src/var/lib/tyto/program/dom.py @@ -34,15 +34,21 @@ #********************************************************************** import os, sys, importlib, langs +import args lib = 'tyto_domain' exists = incomplete = active = ready = shortname = corrupt = False local_user = articles_db_d = False -hole = False +hole = False # Set current directory -try: in_dir = os.getcwd() -except: hole = True +try: + user_dir +except: + try: + user_dir = os.getcwd() + "/" + except: + hole = True # Settings for domain, check if db is not corrupted dom_values = \ @@ -133,12 +139,12 @@ if not hole: home_dir = os.path.expanduser('~') # Set configuration domain directory - folder = in_dir - if '/articles' in in_dir: - folder = in_dir.rsplit('/articles')[0] - + root_dir = user_dir + if '/articles' in user_dir: + root_dir = user_dir.rsplit('/articles')[0] + "/" + # Set configuration domain file - config = '%s/tyto_domain.py'%folder + config = '%styto_domain.py'%root_dir shortname = config # Set exists if configuration file @@ -146,9 +152,17 @@ if not hole: exists = True try: exec(open(config).read()) + try: + os.path.exists(articles_d) + user_uri_dir = user_dir.rsplit(articles_d)[1] + os.chdir(articles_d) + except: corrupt = True except: - corrupt = True + corrupt = True + if not args.target in args.pass_targets: + args.target = user_uri_dir + args.target + # For logs: show uri if not shortname known try: shortname except: pass diff --git a/src/var/lib/tyto/program/html.py b/src/var/lib/tyto/program/html.py index 943d800..020ad85 100644 --- a/src/var/lib/tyto/program/html.py +++ b/src/var/lib/tyto/program/html.py @@ -165,8 +165,8 @@ def create_main_page(target, article_bottom): ' \n' + \ '

%s

\n'%dom.about + \ ' \n' + \ - '\n' + \ ' \n' + \ + '\n' + \ '\n' + \ '
\n' + \ '

\n'%(6 * ' ') + \ - '%s