What would YOU like to see in a txt to html converter?

News123 news123 at free.fr
Thu May 7 14:56:13 EDT 2009


Florian Wollenschein wrote:
> As you might have mentioned I'm just working on a txt to html converter
> called "thc". This project is intended for me to learn Python and now
> pyQT4 to which I changed a few days ago (started with Tkinter).
> 
> I have implemented the following features so far:
> 
> - Giving a title for the html
> - Choose whether it's Transitional or Strict Doctype
> - Select a background color
> - Show the converted file with the standard browser
> - Working on a font size slider
> 
> I don't really know if this is of any use for anybody but it's just a
> fun project by a beginner :-)
> 
> Now I'd like to know what kind of features you'd like to see in version
> 0.3 of thc!?
> 
> Please post them...
> 
> Have fun!
> Listick
> http://www.lictick.org

I would first think about your personal requirements / use cases.
What kind of texts do you want to convert?

I think there's already quite some text to html converters, which you
could take as inspiration.
Most of them were written for a specific purpose though and started from
text files with some 'formatting syntax'

Exanples:
man2html   converts man pages to html
pod2html   covnerts perl online documentation to html

There's also converters from certain wiki formats to html.

There's also source code formatters for certain programming languages
or log file to html converters which color certain message types


If it is just for plain text with no special formattings,
then you need probably only:
- escape all characters, which have to be escap for html. (but there is
probably already a function for it.
)
- seperate paragraphs (at double new lines or at single new lines. This
could be an option)

- additionally you could allow to specify a html prefix (before the
converted text) and a html post fix after the converted text.

- I would handle settings lik color / font size etc with style sheets
and not within the generated html. If you want you could autgenerate
style sheets from some function arguments. They could contain Font color
/ background color / font formatting . . . .

- you could add a configuration, that automatically tags certain words
with certain tags, to allow simle keyword hihglighting.


It all depends on your use case.








More information about the Python-list mailing list