# pytex2html / Home

## Overview

The goal of this project is to develop tools to compile tex like source codes into html files to be embebed into blogs and another sites. The tex like language will be defined by the user on a external dictionary file.

I am still in the processes of learning python and because of this the code is not very optmized. I wrote a lot of comments in the sorce code, so it is very easy to read.

This is an ongoing effort. I am using this project to learn and practice a lot of concepts, from python programming to how to release an open souce software. And of cource practice my english too. As soon as I learn new concepts they will be incorporated on the project.

I am no pro and could use a lot of feedback. Fell free to report bugs, sugest new features or even say something not related to the code, but to the project.

Hope you enjoy the experience.

## How the project is organized

The project is organized into three stages, each one implements an independent part of the project. The compiler, the dictionary builder and an IDE.

The project is currently on Stage 1.

## Quick start

To install:

• unpack: tar -zxvf tex2htmlc-XX.tar.gz
• change to folder: cd tex2htmlc-XX
• type: sudo python setup.py install

To run:

• type: pt2hc your_text_file.tex

A file named output.html with the compliled text will be generated. An alternative way to run the program is: pt2hc your_text_file.tex -o your_output_file.html

OBS: Tested only on Ubuntu 10.10

### Stage 1

In that stage there going to be implemented the compiler and the dictionary file that is used by the compiler to translate the tex files into HTML.

Files created in this Stage:

• default.ini: File that stores all the data that will be used do compile the tex file into the html file.
• pytex2htmlc.py: The compiler module. It will be imported into another program.
• pt2hc: a script that will run the compiles module. It will be called using command line arguments.
• COPYING: A copy of the GPL license.

### Stage 2

In this Stage it will be created a program that will make possible to visualy edit the dictionary file. It will probably be build using Qt and PyQt.

Files that will be created on this Stage:

• tex2htmlbuilder.py

### Stage 3

In this stage it will be created an IDE that will be used to edit the tex and dict files and will have the capabilities to compile and show the preview.

Files that will be created on this Stage:

• tex2htmlide.py

## Quick reference on the Dictionary

The dictionary is simply an .ini like file. It is a set of pairs key=value separeted by [sections]. There is some comments on how to use it on the default.ini file. Basicaly there are at least 3 sections plus one for each LaTeX command implemented.

### Built-in functions

They are defined in the [built-in] section. They are separated cases and are treated a little diferent from the others. The built-in functions are:

$Example:$content$--> <img url='site:?content'/> $$Example:$$ content$\$

--> <p><img url='site:?content'/></p>

raw

Example:

\raw{content} --> content

TODO

Example:

\gt --> &gt;

### User Defined Command

TODO

Example: command 'cmd'

\cmd[a=b]{content}

or

\begin{cmd}[a=b] content \end{cmd}

--> <b>content</b>

## How to compile

To compile a .tex into HTML

1. Make sure you have python 2.7 installed and the path to the interpreter in the tex2htmlc.py file is correct.
2. Give the tex2htmlc.py permition to run. On Linux you may type:
chmod +x tex2htmlc.py

1. To compile a file type:
./tex2htmlc.py source_file -o output_file


• If you need help type:
./tex2htmlc.py -h

• You may ommit the output file. The default output is output.html:
./tex2htmlc.py source_file

• You may use another dictionary file:
./tex2htmlc.py source_file -d dictionary_file


Updated