I have created my first version of a truly open-source program called Textml. It is a Python program that converts text files to basic HTML files.
To use the program you provide either a text file or a folder containing text files to be converted to HTML. They will then be saved to a default directory textml/ for use.
Features
- Provide custom output directory
- Creates new directory if output directory doesn't exist
- Title parsing from text files (First line followed by 2 newlines only)
The project is located on my GitHub at https://github.com/ijacobs-cpa/textml
Instructions
To run this program you first need to clone the repository from GitHub and open the repository locally.
$ git clone https://github.com/ijacobs-cpa/textml.git
$ cd textml/
To run make sure that you have Python installed on your system:
$ python --version
Once installed you can then run the Python script:
$ python textml.py [file/directory] <commands> [command argument]
or
$ python textml.py <options>
Options
Command | Description |
---|---|
-v, --version | Displays version of the program |
-h, --help | Displays a help message |
-o, --output | Specifies the location to save converted files, creates a new folder if location doesn't exist, defaults to textml/ |
Examples
Converting a file:
$ python textml.py myfile.txt
Converting all files in a directory:
$ python textml.py mydirectory/
Running Commands:
$ python textml.py -v
Specifying Output Directory:
$ python textml.py myFile.txt -o newDir/
Results
Here is an example of a text file being converted:
command:
$ python textml.py examples/liveTest/index.txt -o examples/liveTest/
Today I learned
Documenting some information I've learned today
Here is some information:
6502 Assembly Notes (KEY_terms):
#{number} adds a nuber
${hex} adds a hexadecimal
LDA = Load the accumulator
LDY = Load the Y register
LDX = Load the X register
STA = Store the accumulator
STY = Store the Y register
STX = Store the X register
CPX = compare THE x register
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Today I learned</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body>
<h1>Today I learned</h1>
<br />
<p>Documenting some information I've learned today</p>
<br />
<p>Here is some information:</p>
<br />
<p>6502 Assembly Notes (KEY_terms):</p>
<br />
<p>#{number} adds a nuber</p>
<p>${hex} adds a hexadecimal</p>
<br />
<p>LDA = Load the accumulator</p>
<br />
<p>LDY = Load the Y register</p>
<p>LDX = Load the X register</p>
<br />
<p>STA = Store the accumulator</p>
<p>STY = Store the Y register</p>
<p>STX = Store the X register</p>
<br />
<p>CPX = compare THE x register</p>
<br />
</body>
</html>
Static site: https://ijacobs-cpa.github.io/textml/examples/liveTest/index.html
Top comments (0)