Skip to main content
Warning You are using TestPyPI – a separate instance of the Python Package Index that allows you to try distribution tools and processes without affecting the real index.

Tiller is a command line interface for transforming text and markdown files into HTML files.

Project description

Tiller

Tiller is a command line interface for transforming text and markdown files into HTML files. Samples can be found here!. The project can be found on PyPI here.

Features

  • Transform text files into HTML files
  • Transform markdown files into HTML files (Markdown heading1 will be transformed into html <h1>)
  • Easily transform multiple files at once
  • Customizable output directory
  • Language support for generated HTML file
  • TOML config file support

Insntallation

Please note that Tiller requires Python 3.11 or higher to run due to the use of TOMLib.

pip install -i https://test.pypi.org/simple/ namatuzio-tiller

Options:

--version, -v  Print the current version of Tiller.
--help, -h     Print the help message.
--config, -c   Specify the path to a TOML config file to be used.
--output, -o   Change the output directory of the .html files.
--lang, -l    Specify the language of the generated HTML file.

Package Usage:

tiller [OPTIONS] DIR

Local Usage:

.\main.py [OPTIONS] DIR
> note this must be ran from src/namatuzio_tiller_package

Local Examples:

Transform a file through a relative path:

.\main.py .\example.txt
Converted example.txt to example.html
.\example.txt

Hello

World\\

How are you?
.\til\example.html
<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="UTF-8">
        <title>Hello</title>
        <meta name="viewport" content="width=device-width, initial-scale=1">
    </head>
    <h1>Hello</h1>
    <body>
        <p>Hello</p>
		<p>World</p>
		<p>How are you?</p>
    </body>
</html>

Transform all files in the current directory and output them to the output directory:

.\main.py --output output .
Converted example.txt to example.html
Converted example2.txt to example2.html
.\example.txt

Hello

World

How are you?
.\example2.txt

Hi

* How
* Are
* You
* ?
.\output\example.html
<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="UTF-8">
        <title>example</title>
        <meta name="viewport" content="width=device-width, initial-scale=1">
    </head>
    <h1>example</h1>
    <body>
        <p>Hello</p>
		<p>World</p>
		<p>How are you?</p>
    </body>
</html>
.\output\example2.html
<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="UTF-8">
        <title>example2</title>
        <meta name="viewport" content="width=device-width, initial-scale=1">
    </head>
    <h1>example2</h1>
    <body>
        <p>Hi</p>
		<ul>
		<li>How</li>
		<li>Are</li>
		<li>You</li>
		<li>?</li>
		</ul>
    </body>
</html>

Transform a markdown file:

.\main.py .\example3.md
# Heading



Lorem ipsum dolor sit amet. Aut unde eligendi ut labore laboriosam et nihil commodi ut dolorem dolor qui tempora exercitationem qui quis error eum unde quaerat! Eum autem quam ut quae voluptates quo veritatis porro.

---

Ut nihil impedit in galisum assumenda cum incidunt nihil rem dolorem distinctio et doloremque maiores id labore ipsum quo suscipit saepe. Sed veniam debitis in natus repudiandae rem excepturi accusamus sit dolorem quia aut magni voluptatem id incidunt Quis aut voluptatibus quibusdam.

---

Eum quos harum est rerum necessitatibus aut quae architecto. Non deleniti tempore aut consectetur maiores in corrupti inventore eum veniam aliquam.
<!DOCTYPE html>
<html lang="en-CA">
    <style>
    body {
        background-color: rgb(0, 116, 145);
        text-align: center;
        color: white;
        font-family: Arial, Helvetica, sans-serif;
        font-size: xx-large;
    }
    </style>
    <head>
        <meta charset="UTF-8">
        <title>example3</title>
        <meta name="viewport" content="width=device-width, initial-scale=1">
    </head>
    <h1>Heading</h1>
    <body>
        <p>Lorem ipsum dolor sit amet. Aut unde eligendi ut labore laboriosam et nihil commodi ut dolorem dolor qui tempora exercitationem qui quis error eum unde quaerat! Eum autem quam ut quae voluptates quo veritatis porro.</p>
		<hr />
		
		<p>Ut nihil impedit in galisum assumenda cum incidunt nihil rem dolorem distinctio et doloremque maiores id labore ipsum quo suscipit saepe. Sed veniam debitis in natus repudiandae rem excepturi accusamus sit dolorem quia aut magni voluptatem id incidunt Quis aut voluptatibus quibusdam.</p>
		<hr />
		
		<p>Eum quos harum est rerum necessitatibus aut quae architecto. Non deleniti tempore aut consectetur maiores in corrupti inventore eum veniam aliquam.</p>
    </body>
</html>

Generate HTML file with a different language:

.\main.py --lang fr .\example.txt

Converted example.txt to example.html
.\example.txt

Hello

World

How are you?
.\til\example.html
<!DOCTYPE html>
<html lang="fr">
    <style>
    body {
        background-color: rgb(0, 116, 145);
        text-align: center;
        color: white;
        font-family: Arial, Helvetica, sans-serif;
        font-size: xx-large;
    }
    </style>
    <head>
        <meta charset="UTF-8">
        <title>example</title>
        <meta name="viewport" content="width=device-width, initial-scale=1">
    </head>
    <h1>example</h1>
    <body>
        <p>Hello</p>
		<p>World</p>
		<p>How are you?</p>
    </body>
</html>

Transform file(s) using a TOML config file

.\main.py --config (or -c) .\examples\TOMLExample.toml .\examples

Converted example.txt to example.html
Converted example2.txt to example2.html
Converted example3.md to example3.html
example4.html is not a .txt file or a .md file. Skipping...

TOMLExample.toml is not a .txt file or a .md file. Skipping...

Display the help message:

.\main.py --help (or -h)

Usage: main.py [OPTIONS] DIR 
  Convert .txt or .md files to .html files.
Arguments:
  DIR  [required]\n
Options:
  --version, -v  Print the current version of Tiller.
  --help, -h     Show this message and exit.
  --output, -o   Change the output directory of the .html files.

Display the current version of Tiller:

.\main.py --version (or -v)

Tiller Version: 1.1.0 

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

namatuzio_tiller-1.1.0.tar.gz (12.8 kB view hashes)

Uploaded source

Built Distribution

namatuzio_tiller-1.1.0-py3-none-any.whl (6.3 kB view hashes)

Uploaded py3

Supported by

Python Software Foundation Python Software Foundation PSF Sponsor