Skip to content

Commit

Permalink
Fix installation.
Browse files Browse the repository at this point in the history
  • Loading branch information
hlef committed Apr 28, 2017
1 parent 3a47d96 commit 7ef7dee
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 48 deletions.
45 changes: 0 additions & 45 deletions juliet.py

This file was deleted.

4 changes: 2 additions & 2 deletions juliet/FileParser.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from pygments.formatters import HtmlFormatter

def _processPygments(splittedBody):
""" Parse and replace highlight blocks in passed body."""
""" Parse and replace highlight blocks in passed body. """

HIGHLIGHT = re.compile("{%\s*?highlight (\w+)\s*?%}")
ENDHIGHLIGHT = re.compile("{%\s*?endhighlight\s*?%}")
Expand Down Expand Up @@ -64,7 +64,7 @@ def _processBody(splittedBody, baseurl):

def _getHeaderLimit(splittedFile):
""" Return the position of header limiter "---". Return -1 if there's no
header, None if passed file is bad formatted."""
header, None if passed file is bad formatted. """

if(not splittedFile or splittedFile[0] != "---"):
# File is empty or doesn't start by a header limiter
Expand Down
40 changes: 40 additions & 0 deletions juliet/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import argparse
from juliet import Configurator, Builder, Loader

def main():
""" Parse command line arguments and execute passed subcommands. """

# Parse subcommand
parser = argparse.ArgumentParser(description='The lightweight static website generator')
subparsers = parser.add_subparsers(dest="sp", help="sub-command to be executed")

parser_build = subparsers.add_parser('build', help="Build static site from local directory to the directory specified in config.yml")

args = parser.parse_args()

# Execute passed sub-command or return error
if(args.sp == "build"):
build(args)

def build(args):
""" Build website to configured location. """

# Parse configuration
config = {"site": Configurator.getConfig()}

# Load articles and pages from the files
config["posts"] = Loader.getFromFolder("posts/", config)
config["pages"] = Loader.getFromFolder("pages/", config)

# Configure Jinja2 environment
jinjaEnv = Configurator.configureJinja(config["site"])

# Build statics
Builder.buildStatics(config, jinjaEnv)

# Build posts and pages
Builder.buildPosts(config, jinjaEnv)
Builder.buildPages(config, jinjaEnv)

# Install remaining data
Builder.installData(config)
8 changes: 7 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,13 @@
author_email='hle@owl.eu.com',
license='MIT',
packages=['juliet'],
scripts=['juliet.py'],
entry_points={
'console_scripts': [
'juliet = juliet:main'
]
},
zip_safe=False,
install_requires = ['jinja2', 'pygments', 'pyyaml', 'markdown',
'python-slugify'],
test_suite='nose.collector',
tests_require=['nose'])

0 comments on commit 7ef7dee

Please sign in to comment.