IDLTagExtension

From OpenOffice.org Wiki

Jump to: navigation, search
PAGE_TITLE: SURMVGFnRXh0ZW5zaW9u

The IDLTagExtension was written to manage the IDL links in the OpenOffice.org Developer's Guide. The extension converts Java paths to links back to the online IDL documentation.

Syntax

The Wiki syntax for this extension is:

  • for standard IDL links
<idl>com.sun.star.module.Property</idl>
This will create a link to Property in the IDL documentation, and be shown in the Wiki text as: com.sun.star.module.Property
  • for short IDL links
<idls>com.sun.star.module.Property</idls>
This will create a link to Property in the IDL documentation, and be shown in the Wiki text as: Property
  • for IDL Method/Member links
<idlm>com.sun.star.module.Property:member</idlm>
  • for IDL Method/Member links (long format)
<idlml>com.sun.star.module.Property:member</idlml>
This will create a link to member in the IDL documentation, and be shown in the Wiki text as com.sun.star.module.Property:member
  • for IDL modules
<idlmodule>com.sun.star.module</idlmodule>
This will create a link to module in the IDL documentation, and be shown in the Wiki text as com.sun.star.module
  • for IDL topics
<idltopic>com.sun.star.module.Property</idltopic>
Used for the cross references only. This should be used to mark chapters where this type is described in detail.

An example

To create a link to the IDL documentation for the property XPropertySet, the Wiki syntax is:

<idl>com.sun.star.beans.XPropertySet</idl>

and the result looks like this: com.sun.star.beans.XPropertySet

Extension source code

<?php
 
$wgExtensionFunctions[] = "oooIDLTags";
 
function efWonderfulHook( $text, $args, &$parser ) {
   $output = $parser->recursiveTagParse( $text );
      return '<div class="wonderful">' . $output . '</div>';
      }
 
 
function oooIDLTags() {
global $wgParser;
$wgParser->setHook( "idl", "renderIDL" );
$wgParser->setHook( "idlm", "renderIDLM" );
$wgParser->setHook( "idls", "renderIDLS" );
$wgParser->setHook( "idlmodule", "renderIDLMODULE" );
$wgParser->setHook( "idltopic", "renderIDLTOPIC" );
}
 
function renderIDL( $input, $args, $parser ) {
  $parser->disableCache();
  $output = $parser->recursiveTagParse( $input );
  $output = '<a href="http://api.openoffice.org/docs/common/ref/'.ereg_replace ('\.','/',$output).'.html" class="external text">'.$output.'</a>';
  return $output;
}
 
function renderIDLM( $input, $args, $parser ) {
  $parser->disableCache();
  $output = $parser->recursiveTagParse( $input );
  $page = ereg_replace ('\.','/',$output);
  $anchor = ereg_replace (':','.html#',$page);
  $function = ereg_replace ('^.*:','',$page);
  $output = '<a href="http://api.openoffice.org/docs/common/ref/'.$anchor.'" class="external text">'.$function.'</a>';
  return $output;
}
 
function renderIDLS( $input, $args, $parser ) {
  $parser->disableCache();
  $output = $parser->recursiveTagParse( $input );
  $function = ereg_replace ('^.*\.','',$output);
  $output = '<a href="http://api.openoffice.org/docs/common/ref/'.ereg_replace ('\.','/',$output).'.html" class="external text">'.$function.'</a>';
  return $output;
}
 
function renderIDLMODULE( $input, $args, $parser ) {
  $parser->disableCache();
  $output = $parser->recursiveTagParse( $input );
  $function = ereg_replace ('^.*\.','',$output);
  $output = '<a href="http://api.openoffice.org/docs/common/ref/'.ereg_replace ('\.','/',$output).'/module-ix.html" class="external text">'.$output.'</a>';
  return $output;
}
 
function renderIDLTOPIC( $input, $args, $parser ) {
  $parser->disableCache();
  return '';
}
 
?>
Personal tools