internal package Foswiki::Plugins::BeautifierPlugin

See PublishedAPI for packages intended to be used by Plugin and Contrib authors, or browse all packages.
See also Developing plugins, Developer's Bible, Technical Overview

internal package BeautifierPlugin

Implements the %CODE% and %ENDCODE% macros to display code fragments with formatting and syntax highlighting for improved readbility in wiki topics.

Plugin Version: $Rev: 7136 (2010-04-09) $

initPlugin( $topic, $web, $user, $installWeb ) → $boolean

Verifies compatibility with the current version of the Foswiki Plugin API and returns. All real initialization takes place in handleCode if/when the %CODE% macro is actually invoked in a topic.

  • $topic - the name of the topic in the current CGI query
  • $web - the name of the web in the current CGI query
  • $user - the login name of the user
  • $installWeb - the name of the web the plugin topic is in

Returns: 1 on success, 0 on failure

commonTagsHandler($text, $topic, $web, $included, $meta )

Replace any %CODE%...%ENDCODE% blocks in the topic text with beautified HTML. The topic text is modified in place.

  • $text - text to be processed
  • $topic - the name of the topic in the current CGI query
  • $web - the name of the web in the current CGI query
  • $included - Boolean flag indicating whether the handler has been invoked from an included topic
  • $meta - meta-data object for the topic MAY BE undef

handleCode( $args, $text, $topic ) → $string

Initializes the plugin, loads required submodules, beautifies and returns the given text according to the specified language syntax

  • $args - macro argument string (the text between the curly braces in the macro invocation)
  • $text - text to be processed (the text between the %CODE% and %ENDCODE% macros
  • $topic - the web.topic being processed

Returns: the supplied text with HTML markup for formatting and syntax highlights.

_warning( $topic, $msg )

Log a warning and debug message. The topic is prepended to the message.

  • $topic - the web.topic being processed
  • $msg - the message text to write to the warning and debug logs

_debugEntryPoint( $topic, $func, $args )

Write a function entry message to the debug log if debug logging is enabled. The topic is prepended to the message.

  • $topic - the web.topic being processed
  • $func - the name of the function being logged
  • $args - a reference to a hash containing the arguments passed to $func

_debug( $topic, $msg )

Write the supplied message to the debug log if debug logging is enabled. The Perl package name and topic are prepended to the message.

  • $topic - the web.topic being processed
  • $msg - the message text to write to the debug log

Topic revision: r1 - 27 Feb 2018, UnknownUser
This site is powered by FoswikiCopyright © by the contributing authors. All material on this site is the property of the contributing authors.
Ideas, requests, problems regarding Foswiki? Send feedback