Skip to content

Commit

Permalink
Rename application to Ark
Browse files Browse the repository at this point in the history
  • Loading branch information
dmulholl committed Apr 29, 2023
1 parent 495ba74 commit 8ce67f2
Show file tree
Hide file tree
Showing 99 changed files with 551 additions and 711 deletions.
16 changes: 8 additions & 8 deletions ivy/__init__.py → ark/__init__.py
@@ -1,12 +1,12 @@
# ------------------------------------------------------------------------------
# Ivy: a static website generator.
# Ark: a static website generator.
# ------------------------------------------------------------------------------

__version__ = '6.5.1'
__version__ = '7.0.0'

import sys
if sys.version_info < (3, 10):
sys.exit('Error: Ivy requires Python 3.10 or later.')
sys.exit('Error: Ark requires Python 3.10 or later.')


# On Windows, use the 'colorama' package if it's available to support ANSI
Expand All @@ -20,9 +20,9 @@
colorama.init()


# We import the package's modules so users can access 'ivy.foo' via a simple
# 'import ivy' statement. Otherwise the user would have to import each module
# individually as 'import ivy.foo'.
# We import the package's modules so users can access 'ark.foo' via a simple
# 'import ark' statement. Otherwise the user would have to import each module
# individually as 'import ark.foo'.
from . import cli
from . import extensions
from . import hashes
Expand All @@ -35,14 +35,14 @@


# Application entry point. Calling main() initializes the site model, loads
# the site's plugins, then fires a sequence of event hooks. All of Ivy's
# the site's plugins, then fires a sequence of event hooks. All of Ark's
# functionality is handled by callbacks registered on these hooks.
def main():

# Initialize the site model.
site.init()

# Load plugins bundled with Ivy itself, then any plugins listed in the
# Load plugins bundled with Ark itself, then any plugins listed in the
# site's config.py file, then any plugins in the site's 'ext' directory.
extensions.load_bundled_extensions()
extensions.load_installed_extensions()
Expand Down
16 changes: 8 additions & 8 deletions ivy/__main__.py → ark/__main__.py
@@ -1,21 +1,21 @@
# ------------------------------------------------------------------------------
# This module makes the `ivy` package directly executable. To run an `ivy`
# This module makes the `ark` package directly executable. To run an `ark`
# package located on Python's import search path use:
#
# $ python -m ivy
# $ python -m ark
#
# To run an arbitrary `ivy` package use:
# To run an arbitrary `ark` package use:
#
# $ python /path/to/ivy/package
# $ python /path/to/ark/package
# ------------------------------------------------------------------------------

import os
import sys

# We need to manually add the package's parent directory to the module search
# path before we can `import ivy`.
# We need to manually add the package's parent directory to the module search
# path before we can `import ark`.
sys.path.insert(0, os.path.dirname(os.path.dirname(__file__)))
import ivy
import ark
sys.path.pop(0)

ivy.main()
ark.main()
File renamed without changes.
File renamed without changes.
6 changes: 6 additions & 0 deletions ark/bundle/lib/debug/readme.md
@@ -0,0 +1,6 @@
# Ark Debug Theme

[1]: https://github.com/dmulholl/ark

This [Ark][1] theme is designed as a debugging tool, useful when building themes or plugins.
It displays all the page data available for use in template files.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -1,9 +1,9 @@
# Graphite

[1]: https://github.com/dmulholl/ivy
[1]: https://github.com/dmulholl/ark
[2]: https://fonts.google.com/specimen/Crimson+Text

A simple [Ivy][1] theme designed for generating project documentation.
A simple [Ark][1] theme designed for generating project documentation.

This theme will display the following attributes from the site's configuration
file in the site header:
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion ivy/bundle/site.py → ark/bundle/site.py
Expand Up @@ -13,4 +13,4 @@
title = "Site Title"

# Site tagline.
tagline = "Just another Ivy site."
tagline = "Just another Ark site."
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
16 changes: 8 additions & 8 deletions ivy/cli/__init__.py → ark/cli/__init__.py
Expand Up @@ -2,7 +2,7 @@
# This package processes the application's command-line arguments.
# ------------------------------------------------------------------------------

import ivy
import ark
import sys
import argslib

Expand All @@ -18,15 +18,15 @@


helptext = f"""
Ivy v{ivy.__version__}
Ark v{ark.__version__}
Ivy is a static website generator. It transforms a directory of text files
Ark is a static website generator. It transforms a directory of text files
into a self-contained website.
Usage:
ivy <flag>
ivy <command>
ivy help <command>
ark <flag>
ark <command>
ark help <command>
Flags:
-h, --help Print the application's help text and exit.
Expand All @@ -49,13 +49,13 @@


# We store the root ArgParser instance globally so it's available to plugins.
argparser = argslib.ArgParser(helptext, ivy.__version__)
argparser = argslib.ArgParser(helptext, ark.__version__)


# Parse the application's command-line arguments. Plugins can use the `CLI`
# event to register their own custom commands.
def parse_args():
ivy.events.fire(ivy.events.Event.CLI, argparser)
ark.events.fire(ark.events.Event.CLI, argparser)
argparser.parse()

if argparser.command_name is None:
Expand Down
2 changes: 1 addition & 1 deletion ivy/cli/add.py → ark/cli/add.py
Expand Up @@ -12,7 +12,7 @@


helptext = """
Usage: ivy add <filename>
Usage: ark add <filename>
This convenience command creates a new node file in the 'src' directory.
The filename should be specified relative to the 'src' directory.
Expand Down
4 changes: 2 additions & 2 deletions ivy/cli/build.py → ark/cli/build.py
Expand Up @@ -15,7 +15,7 @@


helptext = """
Usage: ivy build
Usage: ark build
Build the current site. This command can be run from the site directory or
any of its subdirectories.
Expand Down Expand Up @@ -75,7 +75,7 @@ def build_site():

# Callback to handle individual nodes. The `build_node` filter can be used
# as a switch to decide if a node should be written to disk. A `disable`
# flag in a node's metadata header will also prevent Ivy from producing an
# flag in a node's metadata header will also prevent Ark from producing an
# output HTML page for a node.
def build_node(node):
if filters.apply('build_node', True, node) and not node.get('disable'):
Expand Down
2 changes: 1 addition & 1 deletion ivy/cli/clear.py → ark/cli/clear.py
Expand Up @@ -12,7 +12,7 @@


helptext = """
Usage: ivy clear
Usage: ark clear
Clear the output directory.
Expand Down
2 changes: 1 addition & 1 deletion ivy/cli/deploy.py → ark/cli/deploy.py
Expand Up @@ -10,7 +10,7 @@


helptext = """
Usage: ivy deploy
Usage: ark deploy
This command fires an 'Event.DEPLOY' event hook which plugins can use to
run site deployment scripts.
Expand Down
6 changes: 3 additions & 3 deletions ivy/cli/init.py → ark/cli/init.py
Expand Up @@ -10,7 +10,7 @@


helptext = """
Usage: ivy init [directory]
Usage: ark init [directory]
Initialize a new site directory. If a directory path is specified, that
directory will be created and initialized. Otherwise, the current directory
Expand All @@ -30,8 +30,8 @@ def register_command(argparser):


def cmd_callback(cmd_name, cmd_parser):
ivy_dir = os.path.dirname(os.path.dirname(__file__))
src_dir = os.path.join(ivy_dir, 'bundle')
pkg_dir = os.path.dirname(os.path.dirname(__file__))
src_dir = os.path.join(pkg_dir, 'bundle')
dst_dir = cmd_parser.args[0] if cmd_parser.args else '.'

os.makedirs(dst_dir, exist_ok=True)
Expand Down
12 changes: 6 additions & 6 deletions ivy/cli/open.py → ark/cli/open.py
Expand Up @@ -2,15 +2,15 @@
# This module contains the logic for the 'open' command.
# ------------------------------------------------------------------------------

import ivy
import ark
import sys
import webbrowser
import os

from .. import events

helptext = """
Usage: ivy open [url]
Usage: ark open [url]
This command opens the output file corresponding to the specified @root/ url
directly in the default web browser. If no url has been specified it defaults
Expand All @@ -24,20 +24,20 @@
"""


@ivy.events.register(events.Event.CLI)
@ark.events.register(events.Event.CLI)
def register_command(argparser):
argparser.command("open", helptext, cmd_callback)


def cmd_callback(cmd_name, cmd_parser):
if not ivy.site.home():
if not ark.site.home():
sys.exit("Error: cannot locate the site's home directory.")

if not os.path.isdir(ivy.site.out()):
if not os.path.isdir(ark.site.out()):
sys.exit("Error: cannot locate the site's output directory.")

arg = cmd_parser.args[0] if cmd_parser.args else "@root/"
if (node := ivy.nodes.node(arg)):
if (node := ark.nodes.node(arg)):
url = "file://" + node.get_output_filepath()
webbrowser.open(url)
else:
Expand Down
2 changes: 1 addition & 1 deletion ivy/cli/serve.py → ark/cli/serve.py
Expand Up @@ -13,7 +13,7 @@


helptext = """
Usage: ivy serve
Usage: ark serve
Serve the site's output directory using Python's builtin web server. The
default web browser is automatically launched to view the site.
Expand Down
6 changes: 3 additions & 3 deletions ivy/cli/tree.py → ark/cli/tree.py
Expand Up @@ -12,18 +12,18 @@


helptext = """
Usage: ivy tree
Usage: ark tree
This command prints the site's node tree. The root node to use as the
starting point can be specifed using the --root option:
$ ivy tree --root @root/foo/bar//
$ ark tree --root @root/foo/bar//
The tree displays urls by default. Use the --slugs flag to print slugs
instead. Use the --attr option to append the value of an arbitrary metadata
attribute, e.g.
$ ivy tree --attr title --attr date
$ ark tree --attr title --attr date
Options:
-a, --attr <name> Display the named metadata attribute.
Expand Down
8 changes: 4 additions & 4 deletions ivy/cli/watch.py → ark/cli/watch.py
Expand Up @@ -15,7 +15,7 @@


helptext = """
Usage: ivy watch
Usage: ark watch
Monitor the site directory and automatically rebuild the site when file
changes are detected.
Expand Down Expand Up @@ -47,10 +47,10 @@ def cmd_callback(cmd_name, cmd_parser):
if not home:
sys.exit("Error: cannot locate the site's home directory.")

# We want to reinvoke the currently active Ivy package when we call the
# We want to reinvoke the currently active Ark package when we call the
# build command. This package may have been invoked in one of three ways:
# 1. Directly: `python /path/to/ivy/directory`.
# 2. As an installed package on the import path: `python -m ivy`.
# 1. Directly: `python /path/to/ark/directory`.
# 2. As an installed package on the import path: `python -m ark`.
# 3. Via an entry script or Windows executable.
if os.path.isdir(sys.argv[0]):
base = ['python3', sys.argv[0]]
Expand Down
2 changes: 1 addition & 1 deletion ivy/events.py → ark/events.py
Expand Up @@ -13,7 +13,7 @@
# compatibility.
@unique
class Event(Enum):
"""All events that Ivy understands are listed here."""
"""All events are listed here."""
CLI = "cli"
DEPLOY = "deploy"
EXIT = "exit"
Expand Down
6 changes: 3 additions & 3 deletions ivy/extensions.py → ark/extensions.py
@@ -1,6 +1,6 @@
# ------------------------------------------------------------------------------
# This module loads extensions, i.e. Python modules and packages which use
# Ivy's plugin architecture to extend its functionality.
# This module loads extensions, i.e. Python modules and packages which use Ark's
# plugin architecture to extend its functionality.
# ------------------------------------------------------------------------------

import os
Expand Down Expand Up @@ -30,7 +30,7 @@ def load_directory(dirpath: str):
load_module(dirpath, name)


# Load Ivy's default set of bundled extensions.
# Load the default set of bundled extensions.
def load_bundled_extensions():
load_directory(os.path.join(os.path.dirname(__file__), 'extensions'))

Expand Down
Expand Up @@ -14,15 +14,15 @@
# set to 'draft' or 'private' it will be excluded from the menu.
##

import ivy
import ark


# We generate the menu once and cache it for future use.
cached_menu = None


# Register a callback to add an 'automenu' attribute to each page-data dictionary.
@ivy.events.register(ivy.events.Event.RENDER_PAGE)
@ark.events.register(ark.events.Event.RENDER_PAGE)
def add_automenu(page_data):
global cached_menu
if cached_menu is None:
Expand All @@ -37,7 +37,7 @@ def add_automenu(page_data):
# This determines the ordering of nodes and subnodes in the memu.
def make_menu(include_func=None, sort_func=None):
menu = ['<ul>\n']
root = ivy.nodes.root()
root = ark.nodes.root()
title = root.get('menu_title') or root.get('title') or 'Home'
menu.append(f'<li><a href="@root/">{title}</a></li>\n')
for node in sorted_children(root, include_func, sort_func):
Expand Down
12 changes: 5 additions & 7 deletions ivy/extensions/ivy_ibis.py → ark/extensions/ark_ibis.py
@@ -1,20 +1,18 @@
##
## Add support for Ibis template files with a `.ibis` extension.
##
# Add support for Ibis template files with a `.ibis` extension.

import ivy
import ark

try:
import ibis
except ImportError:
ibis = None

if ibis:
@ivy.events.register(ivy.events.Event.INIT)
@ark.events.register(ark.events.Event.INIT)
def initalize_template_loader():
ibis.loader = ibis.loaders.FileLoader(ivy.site.theme('templates'))
ibis.loader = ibis.loaders.FileLoader(ark.site.theme('templates'))

@ivy.templates.register('ibis')
@ark.templates.register('ibis')
def render_page(page_data, template_filename):
template = ibis.loader(template_filename)
return template.render(page_data)

0 comments on commit 8ce67f2

Please sign in to comment.