Linux - SoftwareThis forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
It is really simple to convert txt to html, since basically it needs to be added <br> at the end of line and also to
make sure that the special chars of html such as '<', '>', tab,... will be converted to be seen with the HTML document. https://www.w3schools.com/html/html_entities.asp
There is txt2html but it is still a large project, and it does not work always.
Would you know an efficent txt2html which would do the trick relatively simply?
I've never seen a text-to-HTML converter that keeps tabs. Special characters like > and < should work in text2html. However, I did spot this on the txt2html website:
Quote:
txt2html is not a program to convert wordprocessor files or other marked-up document formats.
This page about HTML indenting is an interesting read. The author summarizes that the best way to get tabs/indenting is using CSS. I presume using CSS is beyond the scope of what you're trying to achieve?
Then again I'm not a web developer lol. I'll have another look a bit later. If I find a converter that parses tabs and special characters I'll let you know.
I've never seen a text-to-HTML converter that keeps tabs. Special characters like > and < should work in text2html. However, I did spot this on the txt2html website:
This page about HTML indenting is an interesting read. The author summarizes that the best way to get tabs/indenting is using CSS. I presume using CSS is beyond the scope of what you're trying to achieve?
Then again I'm not a web developer lol. I'll have another look a bit later. If I find a converter that parses tabs and special characters I'll let you know.
Thank you !!
Perl is not possible, I would be glad to find it in C since it must have been done already in C.
HTML is since some time about 1985 so that must exist, I am sure.
Have you seen this thread? jschiwal proposed a solution using sed. Granted it's an ancient thread over a decade old, but it might be worth having a look.
Also if you want an indent/tab, apparently you can use   to achieve this. For example:
Code:
 Check out my awesome indented line of text!<br />
I wonder if it's possible to automate replacing tabs with   instead? Maybe a bash script or something?
The only other alternatives I can find are online-based text-to-HTML converters...but your mileage may vary.
Have you seen this thread? jschiwal proposed a solution using sed. Granted it's an ancient thread over a decade old, but it might be worth having a look.
Also if you want an indent/tab, apparently you can use   to achieve this. For example:
Code:
 Check out my awesome indented line of text!<br />
I wonder if it's possible to automate replacing tabs with   instead? Maybe a bash script or something?
The only other alternatives I can find are online-based text-to-HTML converters...but your mileage may vary.
1)) the HTML looks not easy to handle, man, so complicateed with all thsoe &&& and convertions
2)) I must believe that with simple fd and adaption it is much much efficient and better than an heavy bloat using Perl or bash pipes
simple fd will not influence the complexity of the text/html. Also perl is very good at text processing, and also it has a lot of libraries (already available) to handle html pages. Do not need to reinvent the wheel.
I have no idea how bash pipes are related to it?
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.