Almost Free Outliner (VO2 ?)

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

Almost Free Outliner (VO2 ?)

David J Patrick-2
It has recently become clear to me, that I have been on a single-minded
quest for many years; I yearn to find, or create, an environment where I
can write quickly, creating text content, (outlining is essential) and
then very simply process that content through a number of templates to
create decent .html and/or .pdf.

It sounds easy enough, and vimoutliner stands tall as the outlining text
creation bit, but getting ready html or print-ready output from VO is
easier said than done. Yes, otl2htm and otl2docbook solutions exist (and
they work) but the process carries with it almost no markup, and the end
results are never satisfying.

A good model of lightweight markup resulting in solid html or LateX is
aft (Almost Free Text, http://www.maplefish.com/todd/aft.html) and I
have used it in the past successfully, BUT while working on an aft
formatted text document, the vital outlining is not available.
Recently, I have come to imagine a solution;

afo.vim, a vim plug-in that
* highlights aft syntax
* offers folding (and associated familiar keybindings) based on aft
sections and nested lists, behaving much like VO.
* allows "hoisting" parts of the "outline" to a temp buffer.
* features built-in, customizable commands for various output types.

The desired outcome is a text-based outliner with a lightweight, but
comprehensive markup, and a painless path to acceptable print and/or web
format. In other words; to apply much of the good things we have learned
from VO to an established and mature post-processing tool-chain.

Now I don't expect that all VO fans will share the same itch, and for
this to happen, I will most likely have to do most of the slogging, and
I'm still at the lower part of the learning curve, but I wanted to put
this out there to see if anyone else thinks this is worth some effort.

There is an aft.vim syntax file (attached) and that's a good place to
start. The hardest part (as I see it) is reworking outline-style
folding, based on the section style and the nesting list styles of aft.
Unlike VO, aft uses blank lines to delimit paragraph styles, uses tabs
for nested lists (looking very much like VO) and also uses a single
leading tab for some formatting, which has nothing to do with outline
levels. It's different, but still perfectly doable.

Even with folding on aft section syntax alone, I think it would be quite
usable. Does anyone else think this is a nifty idea ?
Would anyone with vim-fu greater that mine (which is quite small)
consider offering guidance along this path ?

I do feel that if an aft formatted text document could be outlined as
effortlessly as VO, that we would finally have a pure text environment
that allowed nearly effortless professional-looking output.

It could form the basis of a vimoutlinerII, greatly extending the
feature set while maintaining backward compatibility with existing .otl
files (which would behave as aft nested list styles)

call me crazy,
but call me,
djp

_______________________________________________
VimOutliner mailing list
[hidden email]
http://www.lists.vimoutliner.org/mailman/listinfo/vimoutliner

vim-aft-scripts.tar.gz (7K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Almost Free Outliner (VO2 ?)

Herbert Sitz
David J Patrick-2 wrote
It sounds easy enough, and vimoutliner stands tall as the outlining text
creation bit, but getting ready html or print-ready output from VO is
easier said than done. Yes, otl2htm and otl2docbook solutions exist (and
they work) but the process carries with it almost no markup, and the end
results are never satisfying.
Seems to me like it would be relatively simple matter to modify those scripts to add, modify, or delete whatever markup you want.

David J Patrick-2 wrote
A good model of lightweight markup resulting in solid html or LateX is
aft (Almost Free Text, http://www.maplefish.com/todd/aft.html) and I
have used it in the past successfully, BUT while working on an aft
formatted text document, the vital outlining is not available.
Recently, I have come to imagine a solution;

afo.vim, a vim plug-in that
* highlights aft syntax
* offers folding (and associated familiar keybindings) based on aft
sections and nested lists, behaving much like VO.
* allows "hoisting" parts of the "outline" to a temp buffer.
* features built-in, customizable commands for various output types.
I would probably choose reStructuredText markup (http://en.wikipedia.org/wiki/ReStructuredText) instead of AFT, but unless I'm missing somethiing in either case it seems like better solution would be to just stick with VO, include markup within your outline, and write translator scripts to:

(1)  translate the outline indenting in a VO outline to use whatever markup you need in reStructuredText or AFT, and also convert the indented and text-character-prepended textlines into regular lines of text.
(2)  resulting file from step 1 should be pure reStructureText or AFT doc, so just send it through the appropriate converter/renderer.

The translation of VO-structured text to other formats is relatively simple, no need to reinvent the wheel with a whole different outliner.

-- Herb
Reply | Threaded
Open this post in threaded view
|

Re: Almost Free Outliner (VO2 ?)

David J Patrick-2
hsitz wrote:
>
> David J Patrick-2 wrote:
>> It sounds easy enough, and vimoutliner stands tall as the outlining text
>> creation bit, but getting ready html or print-ready output from VO is
>> easier said than done. Yes, otl2htm and otl2docbook solutions exist (and
>> they work) but the process carries with it almost no markup, and the end
>> results are never satisfying.
> Seems to me like it would be relatively simple matter to modify those
> scripts to add, modify, or delete whatever markup you want.
What might be relatively simple for you, might be relatively impossible
for me.

>
> David J Patrick-2 wrote:
>> A good model of lightweight markup resulting in solid html or LateX is
>> aft (Almost Free Text, http://www.maplefish.com/todd/aft.html) and I
>> have used it in the past successfully, BUT while working on an aft
>> formatted text document, the vital outlining is not available.
>> Recently, I have come to imagine a solution;
>>
>> afo.vim, a vim plug-in that
>> * highlights aft syntax
>> * offers folding (and associated familiar keybindings) based on aft
>> sections and nested lists, behaving much like VO.
>> * allows "hoisting" parts of the "outline" to a temp buffer.
>> * features built-in, customizable commands for various output types.
Since posting this "solution", and getting no response from the list
(not knowing it was down) I contacted the author of aft and proposed a
completely different means to the same end; solid hardcopy. I surmized
correctly that Todd's newest software (knit; a code-to-aft documentation
post processor) might be capable of converting an .otl file, complete
with vimoutliner AND aft markup, might be converted to an aft file.
And he proved me correct by creating such a converter.


>>
> I would probably choose reStructuredText markup
I'm quite familiar with ReStructured text. About two years ago, I tried
to do this very sort of thing, using it text and a perl script written
by our sysadmin. It _almost_ worked. In my (couldn't really program my
way out of a paper bag) experience, the most successful lunges at text
to both print AND htm conversion, has been using aft, and this is before
Todd's latest gem.
>
> (1)  translate the outline indenting in a VO outline to use whatever markup
> you need in reStructuredText or AFT, and also convert the indented and
> text-character-prepended textlines into regular lines of text.
> (2)  resulting file from step 1 should be pure reStructureText or AFT doc,
> so just send it through the appropriate converter/renderer.

done, just waiting for permission to release.
>
> The translation of VO-structured text to other formats is relatively simple,
> no need to reinvent the wheel with a whole different outliner.
In retrospect, I agree.
djp
_______________________________________________
VimOutliner mailing list
[hidden email]
http://www.lists.vimoutliner.org/mailman/listinfo
Reply | Threaded
Open this post in threaded view
|

first release of otl2aft.awk (was Re: Almost Free Outliner (VO2 ?))

David J Patrick-2
David J Patrick wrote:
> Since posting this "solution", and getting no response from the list
> (not knowing it was down) I contacted the author of aft and proposed a
> completely different means to the same end; solid hardcopy. I surmized
> correctly that Todd's newest software (knit; a code-to-aft documentation
> post processor) might be capable of converting an .otl file, complete
> with vimoutliner AND aft markup, might be converted to an aft file.
> And he proved me correct by creating such a converter.
>
> done, just waiting for permission to release.

and permission granted, check it out !

(this one needs gawk, the next one just awk)
$ gawk -f otl2aft.awk myfile.otl >myfile.aft  && aft myfile.aft

this isn't final, and upcoming aft enhancements will only make it better.
enjoy,
djp

#!/bin/gawk -f
BEGIN {
  VERSION="v1.2 8/27/09";
  getline; # expect title
  print "#---SET-CONTROL tableparser=new"
  print "*Title: " $0;
  getline; # expect author
  print "*Author: " $0;
  print "\n*TOC\n"
}


/^[\t]+:/ { # Handle ":" (wrapping body text)
  if (!list_level) reset();
  gsub(/\t/,"");
  sub(/[ ]*:/, "");
  print $0; next;
}

function handle_list() {
  if (!list_level) {
    list_indent = length(indent) + 1;
  }
  list_level = list_indent - length(indent);

  if ($0 ~ /[ ]*#/) {
    # Convert " #" into numbered lists.
    #
    for (i=0; i < list_level; i++)
      printf("\t");
    gsub(/[ ]*\#/,"#.");
  } else if ($0 ~ /[ ]*\*/) {
    # Convert " *" into bullet lists.
    #
    for (i=0; i < list_level; i++)
      printf("\t");
    gsub(/[ ]*\*/,"*");
  } else if (list_level) {
    for (i=0; i < list_level; i++)
      printf("\t");
  }
}

/^[\t]+>/ { # Handle ">" (user defined wrapping text)
  if (!list_level) reset();
  gsub(/\t/,"");
  sub(/>/, "");

  if (list_level || $0 ~ /[ ]*[#*]/) {
    handle_list();
  }
  print $0; next;
}

/^[\t]+[;<]/ { # Handle ";" and "<" (preformated text)
  if (!list_level) reset();
  in_preform = 1;
  gsub(/\t/,"");
  sub(/[;<]/, "");

  # Convert "< #" into numbered lists.
  #
  if (list_level || $0 ~ /[ ]*#/) {
    handle_list();
  }
  print $0;
  next;
}

/^[\t]+\|/ { # Handle "|" (table)
  if (!in_table) reset();
  in_table = 1
  gsub(/\t/,"");
  if ($1 ~ /\|\|/) {
    print "\t!   _      !";
    print "\t!----------!"
  }
  gsub(/\|\|/,"!");
  gsub(/\|/,"!");
  print "\t"$0
  print "\t!----------!"
  next;
}

{ match($0,/^[\t]+/); indent = RLENGTH; if (indent == -1) indent = 0; }

indent < 7 { gsub(/\t/,"*"); $0 = "*"$0; print "";}

indent > 6 {
  gsub(/\t\t\t/, "");
  match($0,/^[\t]+/);
  remtabs = substr($0,RSTART,RLENGTH);
  text = substr($0,RSTART+RLENGTH);
  $0 = remtabs"* "text;
  print "";
}
{ print $0 }

function reset() {
  if (list_level) {
    print "  ";
    list_level = 0;
  }
  if (in_preform) {
    print "  ";
    in_preform = 0;
  }
  if (in_table) {
    print "\t!----------!\n"
    in_table = 0;
  }
}

_______________________________________________
VimOutliner mailing list
[hidden email]
http://www.lists.vimoutliner.org/mailman/listinfo
Reply | Threaded
Open this post in threaded view
|

Re: first release of otl2aft.awk (was Re: Almost Free Outliner (VO2 ?))

Herbert Sitz
David J Patrick-2 wrote
(this one needs gawk, the next one just awk)
$ gawk -f otl2aft.awk myfile.otl >myfile.aft  && aft myfile.aft

this isn't final, and upcoming aft enhancements will only make it better.
enjoy,
djp
Thanks, that's some nice code to have.  I know some out there have rolled their own mini-markups for VO, but it could make sense to have single markup choice used as a standard.  Even if not, that awk code gives good starting framework for anyone wanting to do same thing for a different markup method.  I use awk myself in some stuff I do with VO and it's a really useful tool.