Summary: Talk page for $CustomSyntax.
Maintainer: Petko
Users: +1 (View / Edit)

This space is for User-contributed commentary and notes. Please include your name and a date along with your comment.

I've got PmSyntax working pretty much for a recipe, see here, with the following

# set custom format
    \SDVA($CustomSyntax, array(
        CHORDPRONAME . ',00'   => '<bullet    tag      /(?:\\|\\|:|:\\|\\|)/g', # ||: or :||
        # see
        CHORDPRONAME . ',02'   => '<punct     punct    /\[[A-G](?:b|#)?\]/g', # [A] or [Bb] or [C#]
        # see
        CHORDPRONAME . ',04'   => '<pagevar   comment  /\{comment(?:|_italic|_box)\:(?:.*?)\}/gi', # {comment: } directive,
        # see
        CHORDPRONAME . ',06'   => '<pagevar   meta     /\{(?:[a-z_]+)(?:\:(?:[a-z -_0-9])+)?\}/gi', # {directive} or {directive: text}
        # see
        CHORDPRONAME . ',08'   => '>joinline  comment  /^#(?:.*)$/m' # # comment line
        # see

But I'd like to know how to disable, or otherwise handle, to make disappear:

  • ---- (horizontal rule)
  • whitespace at the beginning of a line

I'm quite impressed with this, although it took me a while to figure the best "when", and of course my regex!

Some of the markup I have 'overrides' PmWiki markup, I'm trying to think of ways to restrict it to when the recipe is active on a page, other than by a config file.


It looks like your markup is of the variety Markup with "start", custom "middle" patterns, and "end". This case will also help prevent overriding, or being overridden by other markup. See one such possible solution here: Test.PmSyntax-ChordPro. My notes, in addition to what is in the documentation would be

  1. find and consume the real comments before other text since you can have disabled markup like [G#] in comments,
  2. {comment:...} is like other directives since it is printed, so use the same 'meta' semantics, not the faded-out one,
  3. have a pattern for empty directives (easier) before the ones with content,
  4. highlight the start and end of the directives with '=meta', and
  5. instead of 'meta', use 'meta_nobg' to differentiate from the core meta directives (same blue-greenish color, without the light-blue background).

These are only suggestions, there are many ways to do it. Since software is legally "literature", it is an art form, so the authors can have creative freedom to do it differently. :-) --Petko

Really appreciate your suggestions, as a writer, I'm always trying to improve. simon

There are many more chords (minor, 7 ... see my chord program) than those defined in the patterns, let me know if you need help with these. --Petko

wow, that's excellent, I'd so much like to be able to generate chors in Chordpro. I'm using ChordPro chords for the list of chords I have to allow. simon

Talk page for the $CustomSyntax recipe (users).