Text formatting tools

classic Classic list List threaded Threaded
11 messages Options
Reply | Threaded
Open this post in threaded view
|

Text formatting tools

Carsten Agger-2

I've been using vim to write articles and recently started using it for
a book as well.

I prefer to write everything as a text file w. textwidth=80 and have
written this very simple script which uses the "txt2html" tool to
generate an HTML file which can later be used to paste the formatted
article into, eg., OpenOffice:

------------ BEGIN ------------
#!/bin/bash
#view text document in HTML page


BASEDIR=~/Work

FN=${USER}_$1

txt2html --xhtml --append_head $BASEDIR/html/txthead.html
--escape_HTML_chars --titlefirst --eight_bit_clean $1.txt
>  /tmp/$FN.html

firefox /tmp/$FN.html &
------------  END  ------------

This script allows simple formatting like *italics* and _underline_, but
I'd like something a but more "shiny", which would e.g. also recognize
chapter and section headings and maybe even generate a TOC.

Does anybody have any recommendations? There's txt2tags, which I just
found (http://txt2tags.sourceforge.net/writing-book.html), and I suppose
one could write something similar to easily convert a text file to a
LaTex file, but as I said - do anyone have any experience using such
tools?

Till now, I've been happy with my small "view as HTML" script, but with
the more elaborate structure needed in a book I'm beginning to feel its
limitations.

Thanks in advance for any response,

Carsten




--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Reply | Threaded
Open this post in threaded view
|

Re: Text formatting tools

Raúl Núñez de Arenas Coronado-2

Saluton Carsten :)

Carsten Agger <[hidden email]> dixit:
> This script allows simple formatting like *italics* and _underline_, but
> I'd like something a but more "shiny", which would e.g. also recognize
> chapter and section headings and maybe even generate a TOC.

Don't know about the TOC, but a time ago I heard from a tool called
"otl" that does more or less what you want.

Anyway, if your plan is to publish the book as HTML, I would use some
almost-plain-text format that already had some kind of powerful HTML
converter/generator. Like, for example, POD (maybe a bit limited for
what you want) or the Python tools (Docutils, reStructuredText and
Sphinx).

I have no big experience with those tools, though, and myself I would
write directly using HTML and will generate the TOC with a hand made
script, probably. Nonetheless Sphinx sounds promising for your needs, or
even otl.

--
Raúl "DervishD" Núñez de Arenas Coronado
Linux Registered User 88736 | http://www.dervishd.net
It's my PC and I'll cry if I want to... RAmen!

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Reply | Threaded
Open this post in threaded view
|

Re: Text formatting tools

Stahlman Family
In reply to this post by Carsten Agger-2



Carsten Agger wrote:
> I've been using vim to write articles and recently started using it for
> a book as well.
>
> I prefer to write everything as a text file w. textwidth=80 and have
> written this very simple script which uses the "txt2html" tool to
> generate an HTML file which can later be used to paste the formatted
> article into, eg., OpenOffice:
>
...snip...
>
> This script allows simple formatting like *italics* and _underline_, but
> I'd like something a but more "shiny", which would e.g. also recognize
> chapter and section headings and maybe even generate a TOC.

Carsten,
It doesn't do table of contents or chapter/section headings, but the
Txtfmt plugin provides bold, underline, italic (and if you enable the
option, standout, reverse and undercurl) attributes, as well as 8
configurable foreground text colors. I'm about to release version 2.0,
which will additionally support up to 8 configurable background colors.
I noticed that another user mentioned OTL (TVO - The Vim Outliner)...
Txtfmt highlighting regions can be nested inside other regions with the
appropriate option setting, so you could, for example, create Txtfmt
highlighting regions within TVO's indentation regions.

http://www.vim.org/scripts/script.php?script_id=2208

Hope it helps...
Brett Stahlman

...snip...

>
> Thanks in advance for any response,
>
> Carsten
>
>
>
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Reply | Threaded
Open this post in threaded view
|

Re: Text formatting tools

J.A.J. Pater
Carsten Agger wrote:
...snip...
  
This script allows simple formatting like *italics* and _underline_, but
I'd like something a but more "shiny", which would e.g. also recognize
chapter and section headings and maybe even generate a TOC.
    
You could try (multi) markdown (extended): http://en.wikipedia.org/wiki/Markdown

Relatively simple syntax (I use it, though I don't really like the syntax) and convertible to a lot of formats (pdf, html, rtf, latex) with pandoc:
http://johnmacfarlane.net/pandoc/

See http://en.wikipedia.org/wiki/Category:Lightweight_markup_languages for an overview of lightweight markup languages.
See http://sange.fi/~atehwa/cgi-bin/piki.cgi/stx2any for some discussion.

Hope this helps.

Adriaan


--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Reply | Threaded
Open this post in threaded view
|

Re: Text formatting tools

Carsten Agger-2

On Thu, 2009-07-09 at 15:21 +0200, J.A.J. Pater wrote:

> Carsten Agger wrote:
> > ...snip...
> >  
> > > This script allows simple formatting like *italics* and _underline_, but
> > > I'd like something a but more "shiny", which would e.g. also recognize
> > > chapter and section headings and maybe even generate a TOC.
> > >    
> You could try (multi) markdown (extended):
> http://en.wikipedia.org/wiki/Markdown
>
> Relatively simple syntax (I use it, though I don't really like the
> syntax) and convertible to a lot of formats (pdf, html, rtf, latex)
> with pandoc:
> http://johnmacfarlane.net/pandoc/
>
> See http://en.wikipedia.org/wiki/Category:Lightweight_markup_languages
> for an overview of lightweight markup languages.
> See http://sange.fi/~atehwa/cgi-bin/piki.cgi/stx2any for some
> discussion.

Thanks for all the tips - I'll check all of your suggestions out! It
seems there are quite a few ways of doing this. :-)



--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Reply | Threaded
Open this post in threaded view
|

Re: Text formatting tools

Xavier de Gaye-2
In reply to this post by Carsten Agger-2

On Thu, Jul 9, 2009 at 11:17 AM, Carsten Agger wrote:

> ...
> This script allows simple formatting like *italics* and _underline_, but
> I'd like something a but more "shiny", which would e.g. also recognize
> chapter and section headings and maybe even generate a TOC.
>
> Does anybody have any recommendations? There's txt2tags, which I just
> found (http://txt2tags.sourceforge.net/writing-book.html), and I suppose
> one could write something similar to easily convert a text file to a
> LaTex file, but as I said - do anyone have any experience using such
> tools?


You may want to have a look at docutils, http://docutils.sourceforge.net/

"Docutils is an open-source text processing system for processing
plaintext documentation into useful formats, such as HTML or LaTeX. It
includes reStructuredText, the easy to read, easy to use,
what-you-see-is-what-you-get plaintext markup language."

reStructuredText handles TOC, headings, lists, tables. The markup
is such that the original text can be easily read as a plain text.

reStructuredText is used for the Python documentation.

I am using docutils and reStructuredText in a moinmoin wiki and find
it very useful.


Xavier

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Reply | Threaded
Open this post in threaded view
|

Re: Text formatting tools

Stahlman Family
In reply to this post by Stahlman Family



On Jul 9, 6:40 am, Stahlman Family <[hidden email]> wrote:
> Carsten Agger wrote:
> > I've been using vim to write articles and recently started using it for
> > a book as well.
>
...snip...

>
> Carsten,
> It doesn't do table of contents or chapter/section headings, but the
> Txtfmt plugin provides bold, underline, italic (and if you enable the
> option, standout, reverse and undercurl) attributes, as well as 8
> configurable foreground text colors. I'm about to release version 2.0,
> which will additionally support up to 8 configurable background colors.
> I noticed that another user mentioned OTL (TVO - The Vim Outliner)...
> Txtfmt highlighting regions can be nested inside other regions with the
> appropriate option setting, so you could, for example, create Txtfmt
> highlighting regions within TVO's indentation regions.
>
> http://www.vim.org/scripts/script.php?script_id=2208

I may not have made it clear in my original post, but Txtfmt permits
not just bold, underline, italic, etc..., but also all the
permutations thereof. So, for example, you could create a red, bold-
underline-italic region. Also, one of the things that distinguishes
Txtmft from a traditional markup language is that it is WYSIWYG: i.e.,
you see the text highlighted the way you want it as you type it within
Vim, and you don't see the markup tokens. Txtfmt version 2.0 (soon to
be released) can be made to be even more WYSIWIG, as it can use Vince
Negri's "conceal" patch (when it's applied) to conceal the
highlighting tokens completely. (Currently, Txtfmt simply makes each
highlighting token appear as a single space, which is fine for most
applications, but is less than optimal when you want to put several
tokens back to back (e.g., a red fg color token followed by a bold-
underline-italic format token).

Brett S.

...snip...

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Reply | Threaded
Open this post in threaded view
|

Re: Text formatting tools

Matt Wozniski-2
In reply to this post by Xavier de Gaye-2

On Thu, Jul 9, 2009 at 12:19 PM, Xavier de Gaye wrote:

>
> On Thu, Jul 9, 2009 at 11:17 AM, Carsten Agger wrote:
>> ...
>> This script allows simple formatting like *italics* and _underline_, but
>> I'd like something a but more "shiny", which would e.g. also recognize
>> chapter and section headings and maybe even generate a TOC.
>>
>> Does anybody have any recommendations? There's txt2tags, which I just
>> found (http://txt2tags.sourceforge.net/writing-book.html), and I suppose
>> one could write something similar to easily convert a text file to a
>> LaTex file, but as I said - do anyone have any experience using such
>> tools?
>
>
> You may want to have a look at docutils, http://docutils.sourceforge.net/
>
> "Docutils is an open-source text processing system for processing
> plaintext documentation into useful formats, such as HTML or LaTeX. It
> includes reStructuredText, the easy to read, easy to use,
> what-you-see-is-what-you-get plaintext markup language."
>
> reStructuredText handles TOC, headings, lists, tables. The markup
> is such that the original text can be easily read as a plain text.
>
> reStructuredText is used for the Python documentation.
>
> I am using docutils and reStructuredText in a moinmoin wiki and find
> it very useful.

+1 for reStructuredText.  Easy to write, readable in source form, and
looks good both in html and as latex converted to pdf.

~Matt

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Reply | Threaded
Open this post in threaded view
|

Re: Text formatting tools

Michael Henry-5
In reply to this post by Xavier de Gaye-2
On 07/09/2009 12:19 PM, Xavier de Gaye wrote:
> On Thu, Jul 9, 2009 at 11:17 AM, Carsten Agger wrote:
>> ...
>> This script allows simple formatting like *italics* and _underline_, but
>> I'd like something a but more "shiny", which would e.g. also recognize
>> chapter and section headings and maybe even generate a TOC.
>
> You may want to have a look at docutils, http://docutils.sourceforge.net/
>
> "Docutils is an open-source text processing system for processing
> plaintext documentation into useful formats, such as HTML or LaTeX. It
> includes reStructuredText, the easy to read, easy to use,
> what-you-see-is-what-you-get plaintext markup language."
>
> reStructuredText handles TOC, headings, lists, tables. The markup
> is such that the original text can be easily read as a plain text.
>
> reStructuredText is used for the Python documentation.


I'm fond of reStructuredText as well.  The Python project
uses Sphinx (http://sphinx.pocoo.org/):

"Sphinx uses reStructuredText  as its markup language, and many
of its strengths come from the power and straightforwardness of
reStructuredText and its parsing and translating suite, the
Docutils."

The web page lists these features:

    - Output formats: HTML (including Windows HTML Help) and
      LaTeX, for printable PDF versions

    - Extensive cross-references: semantic markup and automatic
      links for functions, classes, glossary terms and similar
      pieces of information

    - Hierarchical structure: easy definition of a document
      tree, with automatic links to siblings, parents and
      children

    - Automatic indices: general index as well as a module index

    - Code handling: automatic highlighting using the Pygments
      highlighter

    - Extensions: automatic testing of code snippets, inclusion
      of docstrings from Python modules, and more

Sphinx is based on Docutils (the tools for processing
reStructuredText).  The main benefit over raw Docutils for my
purposes is the ability to link between multiple text files.

Michael Henry


--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Reply | Threaded
Open this post in threaded view
|

Re: Text formatting tools

Simon Ruderich-2
In reply to this post by Carsten Agger-2

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

On Thu, Jul 09, 2009 at 11:17:36AM +0200, Carsten Agger wrote:
> [snip]
>
> Till now, I've been happy with my small "view as HTML" script, but with
> the more elaborate structure needed in a book I'm beginning to feel its
> limitations.
>
> Thanks in advance for any response,
>
> Carsten

Hi Carsten,

Another good almost-plain-text format is AsciiDoc [1] which I
really like. It's similar to reStructuredText and is easy to
read/write and very readable. It also has a good Vim syntax
hilighting.

It can be easily converted to HTML and through DocBook to many
other formats like LaTeX, PDF, etc. (It's also useful to create
man pages.)

Simon

[1]: http://methods.co.nz/asciidoc/
- --
+ privacy is necessary
+ using http://gnupg.org
+ public key id: 0x92FEFDB7E44C32F9
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)

iQIcBAEBCAAGBQJKV3PhAAoJEJL+/bfkTDL5qiUQALDGG+FWxRC6W8CazuzxIpAJ
20/1SPAUllYv+ZDxj0APVSM3L6mwlBZeX1Pn/n3TZy1zbglsWNqAK1ogNdArH2gh
yGy7vVGT7F8M46n4ANo+NiCru86UdVqgN+/FoQ6+syqFQD9Zgtf5STQjyw6eHbe2
PtaYM3GWo0lMWlojjPfBFLqHbw1c1BZWQA6sUFE8hI7r/u3FjF/xj6k/BUJFVIHR
WMQnDYXGq7WQ44Y6zwhOvO3hkQDJlVIhZmgHGZqErTrX7nVitNdT8/VMX17TVj40
NM6/SO9bW7BQMbJn75v7f4bzGzLwocmNGbY1pdIG994tbDji8GEHkjy+JDfO1LIN
StaNSH+nM/BG0OJydzi0CDYYd+xCUeWHzmETPSYFPpfgsjU66ADlCatAd5lF1YR0
5byL8SIjFj2MQ4BP3bn3E2m7azK/qaJZKKLZgpgQqGpJvd67vZ19nCYaoVkhmLfW
ihwNI7mYjIXi74gDlRPXvJCF3tg7WwjDgoUwiB+zSte/XXC3gBg5itlxmstJlTfM
rww258pdBqpcFRYdqCrfJEpKWmpLfIXo7cprpDPV5OKH3Ux5O4OKwI+ALyyS1tps
J9D7Vh3flvs177S+8c0CKnpoeaO563Q3eZ0V4iH2r0WEy1ObXPkqKubBJw/+2GKn
mu8GO18ibm6YQBthhXvs
=md7y
-----END PGP SIGNATURE-----

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Reply | Threaded
Open this post in threaded view
|

Re: Text formatting tools

Charlie Kester

On Fri 10 Jul 2009 at 10:01:21 PDT Simon Ruderich wrote:

>
>-----BEGIN PGP SIGNED MESSAGE-----
>Hash: SHA256
>
>On Thu, Jul 09, 2009 at 11:17:36AM +0200, Carsten Agger wrote:
>> [snip]
>>
>> Till now, I've been happy with my small "view as HTML" script, but with
>> the more elaborate structure needed in a book I'm beginning to feel its
>> limitations.
>>
>> Thanks in advance for any response,
>>
>> Carsten
>
>Hi Carsten,
>
>Another good almost-plain-text format is AsciiDoc [1] which I
>really like. It's similar to reStructuredText and is easy to
>read/write and very readable. It also has a good Vim syntax
>hilighting.
>
>It can be easily converted to HTML and through DocBook to many
>other formats like LaTeX, PDF, etc. (It's also useful to create man
>pages.)

Call me old-school -- heh, I'm a *vi* user for crying out loud! -- but I
use groff with the mdoc or the newer mom macros.  I figure that if
you're already committed to the idea of marking up plain test, you might
as well go with the traditional solution.  It's not really any harder to
learn than any of the newer markup tools.

I'm also very fond of the supplementary "little languages" like pic, eqn
and tbl.  Being able to use them in my documents is a plus.

Of course, groff can output to PDF or HTML too, so no one needs to know
you used a dinosaur app to create the documents you circulate.  ;-)



--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---