Пример #1
0
def new(categories):
    """Create a new entry"""
    output_directory = utils.get_properties().get('output_directory', '.')
    source_directory = utils.get_properties().get('source_directory', None)
    media_directory = utils.get_properties().get('media_directory', None)
    author = utils.get_properties().get('default_author', None)
    cats = "_".join([category.lower() for category in categories])
    filename = cats + '_' + datetime.now().strftime("%Y-%m-%d")
    path_to_file = create_entry(source_directory, filename=filename,
                                categories=categories, name=author)
    edit(path_to_file)
Пример #2
0
def new(categories):
    """Create a new entry"""
    output_directory = utils.get_properties().get('output_directory', '.')
    source_directory = utils.get_properties().get('source_directory', None)
    media_directory = utils.get_properties().get('media_directory', None)
    author = utils.get_properties().get('default_author', None)
    cats = "_".join([category.lower() for category in categories])
    filename = cats + '_' + datetime.now().strftime("%Y-%m-%d")
    path_to_file = create_entry(source_directory,
                                filename=filename,
                                categories=categories,
                                name=author)
    edit(path_to_file)
Пример #3
0
def edit(path_to_file):
    texteditor = utils.get_properties().get('text_editor', None)
    if texteditor is None:
        print("No texteditor set in properties file: {}\nRun '{} {}' manually"
              .format(utils.DEFAULT_PROPERTIES_FILE, texteditor, path_to_file))
    else:
        Popen([texteditor, path_to_file])
Пример #4
0
def edit(path_to_file):
    texteditor = utils.get_properties().get('text_editor', None)
    if texteditor is None:
        print("No texteditor set in properties file: {}\nRun '{} {}' manually".
              format(utils.DEFAULT_PROPERTIES_FILE, texteditor, path_to_file))
    else:
        Popen([texteditor, path_to_file])
Пример #5
0
def make(categories):
    """Generate website"""
    # TODO: pass in category arg so only builds for one or more categories
    # TODO: Include the ability to selectively publish or exclude certain
    # categories, i.e. ./scripts/generate_website.py --only=Blog
    # or ./scripts/generate_website.py --exclude=Work, Personal
    if categories:
        raise NotImplementedError(
            "Generating only selected categories is not implemented yet!")
    time_now = arrow.now().strftime('%d-%b-%y %H:%M:%S')
    print("{}: Generating pages".format(time_now))
    properties = utils.get_properties()
    generate_pages(properties=properties)
Пример #6
0
def make(categories):
    """Generate website"""
    # TODO: pass in category arg so only builds for one or more categories
    # TODO: Include the ability to selectively publish or exclude certain
    # categories, i.e. ./scripts/generate_website.py --only=Blog
    # or ./scripts/generate_website.py --exclude=Work, Personal
    if categories:
        raise NotImplementedError(
            "Generating only selected categories is not implemented yet!")
    time_now = arrow.now().strftime('%d-%b-%y %H:%M:%S')
    print("{}: Generating pages".format(time_now))
    properties = utils.get_properties()
    generate_pages(properties=properties)
Пример #7
0
def properties():
    """View properties"""
    # TODO: replace this with get and set
    print("Contents of {}:".format(utils.DEFAULT_PROPERTIES_FILE))
    pprint(utils.get_properties())
Пример #8
0
def view():
    """Open locally generated html in browser"""
    browser = utils.get_properties().get('default_browser', None)
    output_directory = utils.get_properties().get('output_directory', None)
    Popen([browser, output_directory + "index.html"])
Пример #9
0
def properties():
    """View properties"""
    # TODO: replace this with get and set
    print("Contents of {}:".format(utils.DEFAULT_PROPERTIES_FILE))
    pprint(utils.get_properties())
Пример #10
0
def view():
    """Open locally generated html in browser"""
    browser = utils.get_properties().get('default_browser', None)
    output_directory = utils.get_properties().get('output_directory', None)
    Popen([browser, output_directory + "index.html"])