You are not logged in Log in Join
You are here: Home » Members » jim » StructuredTextWiki » TightParagraphStructuredText

Log in
Name

Password

 
 
FrontPage » StructuredTextNG » NGRuleProposals »

TightParagraphStructuredText

One thing I've never liked about STX is the way it spaces out list items. I like my lists compact, without <p> tags and whitespace inbetween. I also do not normally separate bulleted lists in plain text with newlines.

I'd like to be able to have "bullet paragraphs" split as bullets appear. So I might write text like this:

    Here is a structured text document. This is the first
    paragraph of the document. the document is split up
    into paragraphs by the appearrance of blank lines,
    changes in indent, or the appearrance of a bullet.

    This is the second paragraph. We'll now have some bullets
    as an example of how I prefer to smush them together.
      - This is the first bullet
      - And here is the second.
      - Here is a third
      - And here is a fourth.

    This is the third paragraph. This whole document looks
    pretty good, in my opinion.

And here's how the document would render. Notice the lack of whitespace between the bullets.

Here is a structured text document. This is the first paragraph of the document. the document is split up into paragraphs by the appearrance of blank lines, changes in indent, or the appearrance of a bullet.

This is the second paragraph. We'll now have some bullets as an example of how I prefer to smush them together.

  • This is the first bullet
  • And here is the second.
  • Here is a third
  • And here is a fourth.

This is the third paragraph. This whole document looks pretty good, in my opinion.

I wish I could lose the whitespace between the paragraph and the first bullet, too.

Along the same lines, it might be conveinient to develop a way to smush paragraphs together too, at least in the plain text source. This, of course, goes completely against classic structured text rules, but those who prefer it (me) could implement it by installing a hotfix or building a product which inherits from a functionality-changing mixin class capable of parsing this style of text.

I would like to be able to break apart paragraphs as "book text": the paragraphs would be split by changes in indent of the first line only; the level would be determined by the indent of the second and following lines of the paragraph. Here's the source of the example above with this rule applying:

      Here is a structured text document. This is
    the first paragraph of the document. the document
    is split up into paragraphs by the appearrance
    of blank lines, changes in indent, or the
    appearrance of a bullet.
      This is the second paragraph. We'll now have some
    bullets as an example of how I prefer to smush them
    together.
        - This is the first bullet
        - And here is the second.
        - Here is a third
        - And here is a fourth.
      This is the third paragraph. This whole document
    looks pretty good, in my opinion.

Well, no, that looks rather nasty. But using longer paragraphs, as in common in books, I think it would look okay.

This issue actually encompasses two distinct things:

  1. The way that the STX Document Processor splits up bullet items from an STX string. It currently breaks them apart into paragraphs based on blank lines. I don't like to put blank lines between my bullet items in plain text, and I think STX should also split them up by recognizing the bullet characters.
  2. The way that the STX HTML outputter renders list items. It currently outputs <li><p>, which I do not like (and I think may be incorrect HTML). I would prefer to see <li> with no <p>, using CSS to add whitespace between the <li> tags if desired.

Oct 4, 2001: mwr on #zope pointed out the culprit code in the HTML class definition (This is Zope 2.3, StructuredText.py):

    1:    def ul(self, before, p, after):
    2:        if p: p="<p>%s</p>" % strip(ctag(p))
    3:        return ('%s<ul><li>%s\n%s\n</li></ul>\n'
    4:            % (before,p,after))

Line 2 strips off, than re-adds <p> tags from the paragraph which then gets wrapped in <li> tags on line 3. By commenting out line 2 you get output that looks like mwr's example at http://www.cae.tntech.edu/help/unix/x11/. (Thanks mwr!!)

I'd prefer to implement this functionality with a hotfix or other Zope Product, but I can't yet seem to make it work. :-( I've done this, and it works well. I will post it when it's cleaned up. Email me if you want it sooner.

Comments? -datagrok

Examples

HTML Outputter Patch

But you shouldn't need to. This "look" should be default, and padding should be added with CSS, not taken away using a negative value. View source to see the action:

Here's a test.
  • One
  • Two
  • Three


datagrok (Nov 2, 2001 11:46 am; Comment #1)
You can implement this with a CSS hack, too.