Re: Advice needed: Text editor with tags.
From: Neil Madden (nem_at_cs.nott.ac.uk)
Date: 03/10/04
- Next message: Ed Suominen: "Apache TCL"
- Previous message: Svenn Are Bjerkem: "text widget: select color on text with background"
- In reply to: Svenn Are Bjerkem: "Advice needed: Text editor with tags."
- Next in thread: Bob Techentin: "Re: Advice needed: Text editor with tags."
- Reply: Bob Techentin: "Re: Advice needed: Text editor with tags."
- Reply: Svenn Are Bjerkem: "Re: Advice needed: Text editor with tags."
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Wed, 10 Mar 2004 19:36:17 +0000
In article <spam-04A062.19562809032004@news.t-online.com>,
Svenn Are Bjerkem <spam@bjerkem.de> wrote:
<snip>
>
> Now I will write technical documentation that will have to be formatted
> on the printer (or in PDF). When writing the text I do not care what the
> formatting looks like. (WYSIWYG is unwanted) I type a section of text,
> then I select parts of it and assigns a tag from a menu. The text is
> then given a foreground and a background as specified in the tag
> settings. When I save the text to file, the tags will be saved, say as
> xml. One formatter that I know fairly well is LaTex. Problem with
> writing in LaTex is that in technical documentation the well of LaTex
> commands override the content.
>
> I have been searching for latex editors for tcl, but most of them are
> focusing on tags and syntax highlighting. I want to put the formatting
> information into the color of foreground and background of the text. At
> export time, the real latex commands will be inserted.
>
> Does anybody know if such an editor has already been written? It should
> preferrably be pure tcl/tk.
>
Well, on first reading, it sounds like you are after something like
Docbook. With Docbook, theoretically, you are writing purely the
content. You add tags to say what different parts of the text *are*, but
you don't specify in the document how this should be presented in the
output format. Now, in the world of XML (and Docbookx), you can use an
editor which recognizes CSS (Cascading Style Sheets) to format the data
as you type. One such editor I know of is XMLMind
(http://www.xmlmind.com is the URL, IIRC). It's written in Java, and is
dog slow, as well as slightly clumsy to use. You get a reasonably nicely
formatted document as you work (title is in big, centred font, that kind
of thing), and you concentrate just on the content. You can't change the
way the document looks in the editor - this is handled by a separate
style***. You could change the DocBook style*** to display
everything in fixed width fonts, and just alter the colours, if you
want, although writing a complete style*** for DocBook would be a
moderately sized undertaking.
When you want to create the output (such as PDF), you can run the XML
through an xsl processor (such as FOP). The problem here is that most of
the xsl processors don't seem too mature (well, of the free ones I've
tried), and the resultant PDF is not great quality (especially when
compared with the output of TeX). Writing an XSL style*** to produce
your desired formatting is quite a mammoth undertaking, as well. I
expect that this will improve as time goes on, but at the moment, I
don't think it's quite there yet. You could, of course, write a
converter to translate docbook -> latex. Shouldn't be too tricky,
provided you're not using equations and such (MathML to Latex would be a
useful tool, but probably quite time consuming to write).
As for Tcl/Tk in this context. I don't believe anyone has written such
an editor. I am working on such a beast, currently entitled ArTcl. At
present, though, it's not much more than a snappy title, and minimal
code. I add bits here and there, but with the current lack of free time
I have to devote to it, it's not going to be ready any time soon. I am
developing a CSS parser in pure Tcl, with a view to creating a
text-widget drop-in replacement which could be used for editing DOM
trees (e.g. XML documents) with CSS formatting. At present, this has got
as far as a scanner, which is mostly complete, but has a few bugs left
to be worked out, and a few bits could do with being refactored for
neatness and speed. I can email you that code, if you want something to
work on, and would like to go in this direction.
Currently, though, I'd say that LaTeX is perhaps your best bet, if you
are looking for quality printed output (I'm no expert though). You can
write LaTeX separating content from formatting, but it's a bit more of a
pain, and so most LaTeX files contain tons of formatting commands. If
you go this route, you might want to google for LyX, and maybe also
TkDVI.
Another possibility would be to use some simple markup language, and
hand-roll a script which renders it into the Tk canvas widget. From
there, you can go to PostScript via Tk's built in capabilities. This
could actually be a feasible way to go. Check out
http://wiki.tcl.tk/2741 for some experiments I did in this direction a
while ago.
Hope this helps you out. Maybe some other Tclers with document
preparation/processing experience will speak up with more advice.
Cheers,
Neil.
- Next message: Ed Suominen: "Apache TCL"
- Previous message: Svenn Are Bjerkem: "text widget: select color on text with background"
- In reply to: Svenn Are Bjerkem: "Advice needed: Text editor with tags."
- Next in thread: Bob Techentin: "Re: Advice needed: Text editor with tags."
- Reply: Bob Techentin: "Re: Advice needed: Text editor with tags."
- Reply: Svenn Are Bjerkem: "Re: Advice needed: Text editor with tags."
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]