Twitter iPhone pliant OnePlus 11 PS5 Disney+ Orange Livebox Windows 11

conversion ascii => texte formaté

6 réponses
Avatar
Gamotte
Bonjour,

J'ai un fichier ascii que je voudrais imprimer en rajoutant
quelques formatages pour am=E9liorer la lisibilit=E9. Par exemple,
je voudrais que les mots d=E9limit=E9s par deux * (ou autre marque
de formatage) soient mis en gras.
Je cherche donc une commande qui me permettrait de convertir
les fichiers textes en prenant en compte des tags simples de mise
en forme avec pour contrainte que la longueur des lignes et les
indentations soient strictement respect=E9es. Le format du fichier
final
importe peu.


Merci

6 réponses

Avatar
Stephane CHAZELAS
2008-07-3, 05:07(-07), Gamotte:
Bonjour,

J'ai un fichier ascii que je voudrais imprimer en rajoutant
quelques formatages pour améliorer la lisibilité. Par exemple,
je voudrais que les mots délimités par deux * (ou autre marque
de formatage) soient mis en gras.
Je cherche donc une commande qui me permettrait de convertir
les fichiers textes en prenant en compte des tags simples de mise
en forme avec pour contrainte que la longueur des lignes et les
indentations soient strictement respectées. Le format du fichier
final
importe peu.


[...]

$ echo 'ttest *foo* bar' | txt2html --preserve_indent
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<meta name="generator" content="HTML::TextToHTML v2.51"/>
</head>
<body>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;test <em>foo</em> bar</p>

</body>
</html>


~$ apt-cache show txt2html txt2tags txt2man
Package: txt2html
Priority: optional
Section: text
Installed-Size: 296
Maintainer: Varun Hiremath
Architecture: all
Version: 2.51-1
Depends: perl (>= 5.6.0-16), libgetopt-argvfile-perl, libyaml-syck-perl
Suggests: perl-doc
Filename: pool/main/t/txt2html/txt2html_2.51-1_all.deb
Size: 91494
MD5sum: b50cf92a3d3c0377c64b1f354f2cb6f7
SHA1: 89b9e40f48124f935e7bfb86b1a9508ced1a7b77
SHA256: 1adb754e5a9dbdeb95bec88776c81bb2e24350990b39b3fb672fe95a66d72e94
Description: Text to HTML converter
txt2html is a Perl program that converts plain text to HTML.
.
It supports headings, lists, simple character markup, and hyperlinking, and is
highly customizable. It recognizes some of the apparent structure of the
source document (mostly whitespace and typographic layout), and attempts to
mark that structure explicitly using HTML.
.
The purpose for this tool is to provide an easier way of converting existing
text documents to HTML format, giving something nicer than just whapping the
text into a big PRE block. txt2html can also be used to aid in writing new
HTML documents, but there are probably better ways of doing that.
Homepage: http://txt2html.sourceforge.net/
Tag: implemented-in::perl, interface::commandline, role::program, scope::utility, use::converting, works-with::text, works-with-format::html, works-with-format::plaintext

Package: txt2tags
Priority: optional
Section: text
Installed-Size: 1556
Maintainer: Christian Surchi
Architecture: all
Version: 2.3-1
Depends: python
Suggests: python-tk
Filename: pool/main/t/txt2tags/txt2tags_2.3-1_all.deb
Size: 901556
MD5sum: 422a322891420b86f5abbd6740aab066
SHA1: 41a954a6387ed8ae51527600e9500a1d2471f6b3
SHA256: 9050f44564a57c0c39f17b78337d42cd3c82797d83654b8dd86f532a92562502
Description: a conversion tool generating HTML/SGML/LaTeX/man/MoinMoin/mgp/PageMaker files
txt2tags is a format conversion tool written in Python that
generates HTML, SGML, LaTeX, man page, MoinMoin, Magic Point and
PageMaker documents from a plain text file with little marks.
.
Different from other conversion tools, it is generic, and not
target-specific (as a txt2html tool). This way, you can keep just
one source text file and one tool for all your formatting needs.
.
Supports header, title, bold/italic/underline, preformatted,
quote, link, lists, bar, image and table.
.
With txt2tags, you focuses your mind on the document CONTENT, and
forget about formatting. Just let the program do this dirty job.
Tag: implemented-in::python, interface::commandline, role::program, scope::utility, use::converting, use::text-formatting, works-with::text, works-with-format::html, works-with-format::sgml

Package: txt2man
Priority: optional
Section: text
Installed-Size: 88
Maintainer: Fredrik Steen
Architecture: all
Version: 1.5.5-1.1
Depends: gawk
Filename: pool/main/t/txt2man/txt2man_1.5.5-1.1_all.deb
Size: 15412
MD5sum: f833e2a611bccf3f81cda2f0a27d3ee0
SHA1: ab8521e96887caf3a580e5bcc9abe24d04529f26
SHA256: 381919b4d8e2b01abb20cd150e49828abd8089c0b82a256221136468e90e8ccd
Description: Converts flat ASCII text to man page format
It is a shell script using gnu awk, that should run
on any Unix-like system. The syntax of the ASCII text
is very straightforward and looks very much like the
output of the man(1) program.
Homepage: http://mvertes.free.fr/download/
Tag: interface::commandline, role::program, scope::utility, use::converting, works-with::text, works-with-format::man, works-with-format::plaintext

--
Stéphane
Avatar
ykuhry
On 3 juil, 14:39, Stephane CHAZELAS
wrote:

$ echo 'ttest *foo* bar' | txt2html --preserve_indent


[...]

~$ apt-cache show txt2html txt2tags txt2man



Cool, merci.
Avatar
Matthieu Moy
"" writes:

On 3 juil, 14:39, Stephane CHAZELAS
wrote:

$ echo 'ttest *foo* bar' | txt2html --preserve_indent


[...]

~$ apt-cache show txt2html txt2tags txt2man



Cool, merci.



Y'a aussi asciidoc, rst2html, ...

Sinon, a2ps fait du pretty-print, peut-être que l'un de ses modes te
conviendrait.

Bref, l'embaras du choix ;-).

--
Matthieu
Avatar
Stephane CHAZELAS
2008-07-03, 18:27(+02), Matthieu Moy:
[...]
~$ apt-cache show txt2html txt2tags txt2man






[...]
Y'a aussi asciidoc, rst2html, ...

Sinon, a2ps fait du pretty-print, peut-être que l'un de ses modes te
conviendrait.



Voir aussi les wiki engines, dont l'input est quasi du texte et
qui generent de l'HTML.

Bref, l'embaras du choix ;-).



--
Stéphane
Avatar
Freddy DISSAUX
Le Thu, 3 Jul 2008 16:57:19 +0000 (UTC), Stephane écrivait:
2008-07-03, 18:27(+02), Matthieu Moy:
[...]
~$ apt-cache show txt2html txt2tags txt2man






[...]
Y'a aussi asciidoc, rst2html, ...

Sinon, a2ps fait du pretty-print, peut-être que l'un de ses modes te
conviendrait.



Voir aussi les wiki engines, dont l'input est quasi du texte et
qui generent de l'HTML.

Bref, l'embaras du choix ;-).





Pour ajouter ma pierre à l'édifice:

markdown-1.0.1 A text-to-HTML conversion tool for web writers

scritp perl utilisé par nanoblogger





--
freddy <point> dsx <arobase> free <point> fr
Avatar
Jean-Marc Bourguet
Matthieu Moy writes:

"" writes:

On 3 juil, 14:39, Stephane CHAZELAS
wrote:

$ echo 'ttest *foo* bar' | txt2html --preserve_indent


[...]

~$ apt-cache show txt2html txt2tags txt2man



Cool, merci.



Y'a aussi asciidoc, rst2html, ...

Sinon, a2ps fait du pretty-print, peut-être que l'un de ses modes te
conviendrait.



(La)TeX, troff, nroff

Bref, l'embaras du choix ;-).



Plus se faire qqch (directement ou basé sur certains des machins cités)
n'est pas très difficile.

A+

--
Jean-Marc
Site de usenet-fr: http://www.usenet-fr.news.eu.org