Skip to content
This repository has been archived by the owner on Aug 14, 2023. It is now read-only.
/ shell_pipe Public archive

Pelican plugin for piping output from shell processes into site content.

Notifications You must be signed in to change notification settings

rwev/shell_pipe

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

shell_pipe

Pelican plugin for piping shell output (stdout) into site content (articles and pages), unlocking the versatility and flexibility of the shell for automated content generation and updates.

warning

shell_pipe relies on shell=True flag within Python's [subprocess] library, and this comes with risks.

Make sure you control the source of commands to avoid shell injection and arbitrary command execution.

usage

Add shell_pipe to PLUGINS list:

PLUGIN_PATHS = ["pelican-plugins"]
PLUGINS = [
    # ...
    "shell_pipe",
    # ...
]

Then, specify shell commands in-line in post & article sources:

Title: My Post

...

<!-- SHELL_BEGIN -->my-shell-command<!-- SHELL_END --> 

example

See this example.

A budget-balance report was produced by hledger, a command-line plaintext accounting program and written to the article's content.

In the post's source markdown:

<pre><!-- SHELL_BEGIN -->hledger bal -f ./.ledger/bus | head -n -2 | sed -z 's/\n/<br>/g'<!-- SHELL_END --></pre>

The post is updated to reflect the latest ledger each time the site is built: the hledger command is executed with the latest input file ./ledger/bus.

About

Pelican plugin for piping output from shell processes into site content.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages