Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OpenGraph card image generation #45

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,9 @@ jobs:
- name: Install the package and requirements
run: python -m pip install `ls dist/*.whl`[jupyter]

- name: Install the documentation requirements
run: python -m pip install env/requirements-docs.txt

- name: List installed packages
run: python -m pip freeze

Expand Down
26 changes: 22 additions & 4 deletions doc/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,28 @@
# Distributed under the terms of the MIT License.
# SPDX-License-Identifier: MIT
"""Trying out the API to build the site with a script instead of the CLI."""
import functools
import sys

from PIL import Image, ImageDraw, ImageFont
import nene

if __name__ == "__main__":

def build(config_file, verbose=True):
"""
Build the website from the sources
"""
# Create a Rich Console for printing status updates. To omit the messages,
# don't pass the console and style to the functions below.
console, style = nene.printing.make_console(verbose=True)
console, style = nene.printing.make_console(verbose=verbose)
# So we know that we're using this script and not the "nene" app.
console.rule()
console.print(":snake: Building from the 'build.py' Python script.", style=style)
console.rule()

# Generate the website structure based on the YAML configuration file.
site, source_files, config, build = nene.build(
"config.yml", console=console, style=style
config_file, console=console, style=style
)
# Render the HTML for the website.
nene.render(site, config, build, console=console, style=style)
Expand All @@ -26,7 +32,19 @@
nene.export(
site, source_files["copy"], config["output_dir"], console=console, style=style
)
return config, source_files


if __name__ == "__main__":
config, source_files = build("config.yml", verbose=True)
console, style = nene.printing.make_console(verbose=True)
# If the script is called with the "-s" command line option, serve the
# website and open it in a browser.
if "-s" in sys.argv:
nene.serve(config, source_files, console=console, style=style)
nene.serve(
config,
source_files,
console=console,
style=style,
rebuild=functools.partial(build, verbose=False),
)
197 changes: 197 additions & 0 deletions doc/images/thumbnail/og_background.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions env/requirements-docs.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
pillow==10.3.*
1 change: 1 addition & 0 deletions environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ dependencies:
- make
- pip:
- -r env/requirements-build.txt
- -r env/requirements-docs.txt
- -r env/requirements-style.txt
- -r env/requirements-test.txt
- -e .[jupyter]
Loading
Loading