NAME§

Quilter - quilt.Quilter

FILE§

/Users/timothydavenport/GitHub/quilt/quilt

DESCRIPTION§

Object to stitch a page based on quilt

  1. use quilt file to create quilt
  2. replace all patch files by matching patch#id tags in quilt with a patch/id.html file
  3. parses page file using the following format:
    1. key: value page variable header (optional)
      • key = [A-Za-z0-9_-]+ until :, value = a string per line (mulitlines become array) until next key
      • page variable section ends with first empty (whitespace-only) line
    2. html or markdown page content
    3. <script> page script (optional)
  4. set page variables, overriding default site variables
  5. add page content to quilt (auto processing markdown page if file ends with .md or .markdown)
  6. add page script to the end of quilt
  7. replace all brace variables, {{.*}}, in content with page or site variables
  8. if page is under posts/ directory, tags and categories variables are linked and appended to page content
  9. fill in blank alt attributes for <a> and <img> tags

project : 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 :

MODULES§

bs4, copy, json, math, os, shutil, time

FUNCTIONS§

def add_suffix(filepath='', suffix='''):

add suffix to file name

def parse_pagevars(var_str='''):

parse page var string

CLASSES§

builtin.object
Quilter

class Quilter§

description§


page quilter object

descriptors§


write
write it out

write
write it out

methods§


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

DATA§

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>.*)
markdown