Skip to content

Parser Functions

nricciar edited this page Jan 30, 2011 · 3 revisions

Currently the following parser functions are implemented in WikiCloth.

  • #if
  • #switch
  • #expr
  • #ifeq
  • #len
  • #sub
  • #pad
  • #iferror
  • #capture
  • lc
  • uc
  • ucfirst
  • lcfirst
  • plural
* See Parser functions @ MedaWiki.org for additional documentation on the usage and syntax.

Extending WikiCloth

Additional parser functions can be added by extending WikiCloth::Parser.

  class WikiParser < WikiCloth::Parser
    function do |name,params|
      case name
      when "date"
        Time.now
      end
    end
  end

Now {{date}} will return the current date.

Clone this wiki locally