Quilter - quilt.Quilter
/Users/timothydavenport/GitHub/quilt/quilt
Object to stitch a page based on quilt
patch#id
tags in quilt with a patch/id.html
filekey: value
page variable header (optional)[A-Za-z0-9_-]+
until :
, value = a string per line (mulitlines become array) until next keyhtml
or markdown
page content<script>
page script (optional)markdown
page if file ends with .md
or .markdown
){{.*}}
, in content with page or site variablesposts/
directory, tags
and categories
variables are linked and appended to page contentalt
attributes for <a>
and <img>
tagsproject : quilt
version : 0.1.1
status : development
modifydate : 2015-05-13 07:09:00 -0700
createdate : 2015-04-28 06:02:00 -0700
website : https://github.com/tmthydvnprt/quilt
author : tmthydvnprt
email : tmthydvnprt@users.noreply.github.com
maintainer : tmthydvnprt
license : MIT
copyright : Copyright 2015, quilt
credits :
bs4, copy, json, math, os, shutil, time
def add_suffix(filepath='', suffix='''):
add suffix to file name
def parse_pagevars(var_str='''):
parse page var string
builtin.object
Quilter
description§
page quilter object
descriptors§
write
write it outwrite
write it outmethods§
def add_page_comments(self'):
create a page key value pair
def clean_html(self'):
clean html, post process html
def parse_page(self, page'):
parses page into vars, html, and scripts7.487 s
def remove_empty(self'):
remove empty tags
def replace_patches(self'):
replace all patches in quilt with patch files
def replace_variables(self'):
replace not found page variables (re based replacement)
def stitch(self'):
generate the page
def write(self, pretty=False'):
write it out
BODY_STRAINER
body|{}
DEBUG_FILE
DOTSTAR_RE
.*
ESCAPED_PAGEVAR_RE
{{(.*?)}}
FIRST_EMPTY_LINE_RE
\n\s*\n
FIRST_KEY_RE
[A-Za-z0-9_-]+[ \t]*:
HEAD_STRAINER
head|{}
JS_HTML_PATTERN_RE
(>tpircs/<.*>tpircs<)?(.*)
KEY_VALUE_RE
^[ ]{0,3}(?P<key>[A-Za-z0-9_-]+)[ \t]*:\s*(?P<value>.*)
MD
<markdown.Markdown object at 0x109b98d90>
NO_EMPTY_TAGS
['section', 'article', 'header', 'footer', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'hgroup', 'nav', 'aside', 'div', 'main', 'p', 'pre', 'bockquote', 'ol', 'ul', 'li', 'a', 'abbr', 'cite', 'code', 'b', 'strong', 'em', 's', 'q', 'small', 'samp', 'u', 'time', 'var', 'sup', 'sub', 'kdb', 'mark', 'dl', 'dt', 'dd', 'table', 'thead', 'td', 'tr', 'th', 'tbody', 'tfooter']
PAGEOBJ
<script> pagevars = %s; </script>
PAGEVARS_TO_PRINT
['author', 'categories', 'copydate', 'copyrighter', 'date', 'description', 'directory', 'disable_last', 'disable_next', 'domain', 'email', 'keywords', 'last_post', 'last_title', 'latestpostlink', 'markdownlink', 'name', 'next_post', 'next_title', 'page_path', 'relativepath', 'tags', 'title', 'url', 'post-length', 'post-characters', 'post-lines', 'post-words', 'post-symbols', 'post-numbers', 'post-diversity', 'post-sentences', 'post-questions', 'post-extlinks', 'post-intlinks', 'post-anchors', 'post-images', 'post-headers']
PAGEVAR_RE
not found
PATCHCOMMENT
quilted %s patch
QUILTCOMMENT
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Page stitched together with quilt: quilt : %s url : %s quilted on : %s source branch : %s source hash : %s stitching took : %s s%s ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
TRUE_RE
[Tt]rue
VALUE_RE
^[ ]{4,}(?P<value>.*)