By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,766 Members | 1,435 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,766 IT Pros & Developers. It's quick & easy.

Simple text markup (-> HTML)

P: n/a
:::Title::: A simple text markup utility :::/Title:::

:::Section Introduction :::

I'm looking for something to help developers wirte documentation for
bits of software they are writing. The main (initially only)
presentation format will be HTML. The idea is to allow the author to
write a plain text file containing the text he wishes to present,
annotated with minimally intrusive markup which describes the
:::emph::: meaning :::/emph::: of parts of the text. The author should
not concern himself with how the output will look; he should trust the
rendering process to Do The Right Thing.

For example, the author might want to communicate that some portion of
text represents source code, or commands to be issued, or output given
by a program.

:::Example:::

A recursive implementation of the Fibonacci function might look like this

:::Source:::
def fib(n):
if n<2: return 1
return fib(n-1) + fib(n-2)
:::/Source:::

And it works like this

:::Input::: fib(8) :::/Input:::
:::Output::: 34 :::/Output:::

:::/Example::: :::/Section:::
:::Section Why not XML ? :::

The idea is that the utility should be minimally intrusive to the
author. Given that the author is likely to want to paste source code,
having to substitite all occurances of "<" with &lt and so on is
completely unacceptable.

As you can see, I have been using triple colons in this presentation
as a sufficiently unlikely character combination, to replace XML's "<"
and ">". Clearly this is not ideal. Maybe allowing the author to
specify how the markup should be identified is a solution ... for
example an instruction such as :::SetMarkup ||::: could be used to
change the markup identification sequence to two vertical bars (taking
effect only in "leafward" parts of the parse tree.
||/Section||
||Section Why not LaTeX ? ||

Yes, LaTeX pretty much reifies the idea I am trying to express, and I
could use something in the LateX2HTML genre as a
backend. Unfortunately LaTeX it not politically acceptable in my
environment.

(If the markup is sufficiently simple, then something based on s-exprs
could pass through the political correctness filters ... as long as
implemented in C(++) or Python.)

||Section Automation||

Ideally, I'd like to be able to execute arbitrary Python code within
the document source, in order to "suck in" information from elsewhere.

||Source||
||Macro||
for line in open("example1.cpp",'r'):
print line
||/Macro||
||/Source||

Given the fragment above, the source code in the file "example1.cpp"
would be inserted into the document.

||Section Inclusion||

Also, I'd like to be able to inline other sources of the same document
format:

||Include ~/docs/fubar.baz||

||/Section||
||Section Summary||

Of course, I am not looking for anything that looks exactly like what
I have shown. What I have presented here merely serves to illustrate
what sort of functionality I am looking for.

Neither am I looking for something of industrial strength, but
something that would solve more problems than it creates. The bottom
line is that I want authors to write something that looks mostly like
plain text, and be able to communicate a few key items of
meta-information via markup.

Any suggestions ?

||/Section||
Jul 18 '05 #1
Share this Question
Share on Google+
7 Replies


P: n/a
Jacek Generowicz wrote:
I'm looking for something to help developers wirte documentation for
bits of software they are writing.


reStructredText. Bigtime.

--
__ Erik Max Francis && ma*@alcyone.com && http://www.alcyone.com/max/
/ \ San Jose, CA, USA && 37 20 N 121 53 W && AIM erikmaxfrancis
\__/ Everybody's playing the game / But nobody's rules are the same
-- Florence, _Chess_
Jul 18 '05 #2

P: n/a
Erik Max Francis <ma*@alcyone.com> writes:
Jacek Generowicz wrote:
I'm looking for something to help developers wirte documentation for
bits of software they are writing.


reStructredText. Bigtime.


Way cool !

I am rather shocked that this (or its ancestors) has not registered on
my radar before now.

Thanks !
Jul 18 '05 #3

P: n/a
Jacek Generowicz wrote:
Erik Max Francis <ma*@alcyone.com> writes:
reStructredText. Bigtime.


Way cool !

I am rather shocked that this (or its ancestors) has not registered on
my radar before now.


It's ancestors, at least in the "Structured Text" world, weren't
up to the task.

But they didn't have David Goodger behind them...

-Peter
Jul 18 '05 #4

P: n/a
Please don't invent yet another markup language. It gets incredibly
difficult to keep them all straight. There's some standard being
developed for Wiki markup. Why don't you use that. The stuff in your
example already looks pretty similar to wikipedia markup. Another
idea is use Texinfo.
Jul 18 '05 #5

P: n/a
In article <ty*************@pcepsft001.cern.ch>,
Jacek Generowicz <ja**************@cern.ch> wrote:
Erik Max Francis <ma*@alcyone.com> writes:
Jacek Generowicz wrote:

I'm looking for something to help developers wirte documentation for
bits of software they are writing.


reStructredText. Bigtime.


Way cool !

I am rather shocked that this (or its ancestors) has not registered on
my radar before now.


You should be shocked. ;-) It's been discussed lots. The really neat
thing about reST is that it scales upward fairly well -- I'm writing a
book with it, and so is at least one other person.
--
Aahz (aa**@pythoncraft.com) <*> http://www.pythoncraft.com/

"usenet imitates usenet" --Darkhawk
Jul 18 '05 #6

P: n/a
Paul Rubin <http://ph****@nospam.invalid> wrote:
Please don't invent yet another markup language. It gets incredibly
difficult to keep them all straight.


Seconded. At least, try to use whitespace as markup tags... you'll be
surprised.

--
William Park, Open Geometry Consulting, <op**********@yahoo.ca>
Linux solution for data processing and document management.
Jul 18 '05 #7

P: n/a
Jacek Generowicz <ja**************@cern.ch> wrote in message news:<ty*************@pcepsft001.cern.ch>...
<snip>

I write everything in rst format and then convert to HTML,Latex,PS, PDF, etc.
For what concerns the documentation, I write snippets and examples inside
it, then I execute the text file using (a minor hack to) doctest and I
get (additional) tests for free. Finally, I write the documentation (call
it implementation proposal if you wish) before writing the actual code,
so I get Documentation Driven Development ;)

Way cool: it is something between literate programming and TDD. Most
importantly it works. I have yet to implement the second step: the idea
is to convert the documentation in HTML, put it on the Web and let
the customer run the tests with a click on the browser as soon as he reads
the documentation (or proposal of implementation) and see if he/she likes it.
It is not difficult to implement though.

I think you get the picture. doctest is still largely unexplored but it
has enourmous potentiality in terms of easy of use and convenience.
Think only to the fact that you get always updated documentation by definition.
Michele Simionato
Jul 18 '05 #8

This discussion thread is closed

Replies have been disabled for this discussion.