Giter Club home page Giter Club logo

text-to-html's Introduction

txt2html (text to html)

About

A program that accept a text (*.txt) file and convert it to html (*.html) file.

Requirement

An installation of MinGW is required to build, compile, and install this program in windows.

Note:
For those who are new to using MinGW, after installing it, please read this to set it properly.

How to build, compile, and install

To build, compile, and install txt2html in debug build, just run the following command:

$> make
...
$> make install

To build, compile, and install txt2html in release build, run the following command:

$> make release
...
$> make install

Installation note:
In linux, to use the program installed in this directory ~/local/bin, add the following to the .bashrc file.

export PATH=$PATH:~/local/bin

In windows, to use this program installed in similar directory (expecting that you installed the required MinGW), add the following to the Path environment variable.

C:\MinGW\msys\1.0\home\<your-user-name>\local\bin

How to use

To convert a text file to html file:

$> txt2html <filename of text file> --title "My Webpage"

Options:

  • --calibre-epub-xhtml = set txt2html to convert text files to xhtml format that can be use to create epub file using the calibre e-book management.
  • --title <title> = set the title tag of the html file.
  • --help = show some text that tells how to use the program.
  • --version = show the current version of the program.

Note:
If '--title' option is omitted, it will take a default title of 'My Webpage'.

Simple pattern to follow

To properly convert a text file to html, strictly follow this one very simple rule:

"Provide a single empty line between paragraph and provide two empty line after the last paragraph"

For a sample, copy & paste this three paragraph ramdom text I get somewhere out there, to any text editor and save it. And try to convert this to an html file.

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Velit scelerisque in dictum non consectetur a erat. Sit amet justo donec enim diam vulputate. Id aliquet lectus proin nibh nisl condimentum id venenatis a. Eget gravida cum sociis natoque penatibus et magnis dis. Habitant morbi tristique senectus et netus et. Interdum consectetur libero id faucibus nisl tincidunt eget nullam. Aliquam purus sit amet luctus. Fringilla ut morbi tincidunt augue interdum velit. Neque sodales ut etiam sit. Quam viverra orci sagittis eu volutpat odio facilisis mauris. Ornare suspendisse sed nisi lacus sed. Iaculis at erat pellentesque adipiscing commodo elit at imperdiet dui. Quam nulla porttitor massa id neque aliquam vestibulum morbi. Dignissim diam quis enim lobortis scelerisque fermentum dui faucibus. Turpis egestas integer eget aliquet.

In nisl nisi scelerisque eu ultrices vitae auctor eu. Dolor sit amet consectetur adipiscing elit duis. Tortor dignissim convallis aenean et tortor at. Iaculis at erat pellentesque adipiscing commodo. Viverra suspendisse potenti nullam ac tortor. Elementum nibh tellus molestie nunc non blandit massa enim. Ultricies integer quis auctor elit sed. Varius vel pharetra vel turpis nunc eget lorem dolor. Sit amet massa vitae tortor condimentum. Adipiscing elit ut aliquam purus sit amet luctus venenatis lectus. Nascetur ridiculus mus mauris vitae ultricies leo integer.

Urna nunc id cursus metus. Id leo in vitae turpis massa. Blandit turpis cursus in hac habitasse platea. Feugiat sed lectus vestibulum mattis ullamcorper. Diam sit amet nisl suscipit adipiscing bibendum est. Enim nunc faucibus a pellentesque sit amet porttitor eget dolor. Enim eu turpis egestas pretium aenean pharetra. Amet mattis vulputate enim nulla aliquet. Tristique et egestas quis ipsum suspendisse ultrices gravida dictum fusce. Risus commodo viverra maecenas accumsan lacus vel. Eu mi bibendum neque egestas congue quisque egestas diam in. Fermentum odio eu feugiat pretium nibh ipsum consequat.


Observe the empty lines between the paragraphs. It will be used by the program to identify where the opening <p> tag and closing </p> tag will be placed.


Issue

Based on the test run using the provided sample text file, a minimal issue on the resulting html file still exist.

The issue is, two blocks of a paragraph are put together in a single opening and closing paragraph tag that should be two separate paragraphs.

But overall, the result has achieved the goal of producing a basic html file.


About

This program is free and open-source with the license of GNU General Public License Version 2. Please see COPYING for details.

text-to-html's People

Contributors

radoq10288 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.