Welcome to Appie’s documentation!¶
Appie is a simple static generator for dynamic websites. Dynamic websites? Yes! Although Appie can generate HTML files its focus is on providing all information of files residing in your website’s directory. As a HTML file can not see what’s available on your webserver Appie will provide a JSON file containing exactly this. From this the HTML file, using javascript, can figure things out. By matching to certain filenames the JSON file can be filled with specific data. For example a file with the .textile extension is parsed into HTML. Same holds for files ending with a .md extension.
Installation¶
Use pip to install Appie:
Appie is developed for Python3!
Contents:
Appie module reference¶
Appie main class¶
-
class
appie.
Appie
(*args, **kwargs)[source]¶ -
add_directory_parser
(inst)¶ Adds a parser instance to match on directory names
Parameters: inst (instance) – parser instance
-
add_file_parser
(inst)¶ Adds a parser instance to match on filenames
Parameters: inst (instance) – parser instance
-
parse
()¶ Parse the full directory tree in self._buildroot
-
parse_file
(d, wd='')¶ Parse a dictionary leaf
Parameters: - d (dict) – the dictionary to parse
- wd (string) – string containing the target directory
-
save_dict
(d, filepath)¶ Save dictionary to json file
Parameters: - d (dict) – the dictionary to save
- filepath (string) – string containing the full target filepath
-
Appie Base Parsers¶
-
class
appie.
AppieBaseParser
[source]¶ The default parser, does nothing but load files prepended with ‘_’ (underscore)
-
parse
(match_key, d, wd, *args, **kwargs)¶ Parses the dictionary d if match_key matches something it wants. Raises StopParsing if it doesn’t allow for for further parsing of its tree.
Parameters: - match_key (str) – filename to match on
- d (dict) – dictionary belonging to match_key
- wd (list) – current working directory as a list
-
-
class
appie.
AppieTextileParser
[source]¶ Simple textile file to html parser
-
parse
(match_key, d, wd, *args, **kwargs)[source]¶ Parses textile files (match_key) with .textile extension to html. Raises AppieExceptStopParsing when a file is matched and parsed.
Parameters: - match_key (str) – filename to match on
- d (dict) – dictionary belonging to match_key
- wd (list) – current working directory as a list
-
Appie Extensions¶
-
class
appie.extensions.
AppieJPGParser
(*args, **kwargs)[source]¶ PNG parser converting JPGs to progressive JPG and a JPG thumb if they are larger than the ‘jpg_size’ setting.
Note: to not parse JPG images and just copy them to the build root use a captital extension (.JPG). The parsers are case sensitive!