User:Alien333/poemise

From Wikisource
Jump to navigation Jump to search

Documentation for Poemise in my commons.js.

Puts lines < 4 characters at the end of the preceding line for punctuation, and lines starting by a lowercase for hard wrap.

Applies an indent pattern given with *[pattern].

A pattern can be, by growing priority:

  • a string of digits and periods meaning respectively that many : and a stanza break
  • ! [multiple-digit indent] (will continue till end of substring)
  • ,[number] shorthand for [number]*0;.
  • :[number] shorthand for [number]*01;.
  • [number]*[pattern], multiplies the pattern by the number, e.g. 3*01 -> 010101
  • [pattern];[patttern], divides into smaller substrings
  • (pattern), keeps priority.

For example, 2*(00!11);. -> 2*(00!11) and . -> 2*(0, 0, 11) and . -> 0, 0, 11, 0, 0, 11, .

Multiple-stanza patterns work, such as :3/,2 for 0 1 0 1 0 1 . 0 0 .

You can start at a specific index in your indent pattern with /[number].

The zone to be poemised is assumed to start at the beginning and to end at EOF.

The start can be put somewhere else with + and the end with - (at beginning of line).

When an edge (start/end) is not limited, it will try to fill in with the * and the /.

For a last page of a poem, $ on its own line keeps it from adding an |end=.

I am aware that my effort to compress this can lead to hard to read things, such as +$*2*56!10;,4, but eh, not going to be saved in page history