mirror of
https://github.com/pierre42100/comunic
synced 2024-12-30 15:39:00 +00:00
27 lines
9.3 KiB
HTML
Executable File
27 lines
9.3 KiB
HTML
Executable File
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
|
<title>Luminous Syntax Highlighter</title>
|
|
<link rel='stylesheet' type='text/css' href='style/luminous.css'>
|
|
<link rel='stylesheet' type='text/css' href='style/geonyx.css'>
|
|
<style>
|
|
h1{font-size: x-large;}
|
|
h2{font-size: large; }
|
|
h3{font-size: medium;}
|
|
body{ margin:1em; font-family: sans-serif; font-size:12pt;}
|
|
.luminous { border: 1px solid #bbb; }
|
|
span.inline-code {
|
|
background-color: #E7E7E7;
|
|
padding: 1px 0.25em;
|
|
font-family: monospace;
|
|
font-weight: bold;
|
|
color: #323232;
|
|
border: 1px solid #888;
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
# parent: index<br><h1 id='id_44b325b08041f32d1e5078d7cf27cc5a' ><span>User's API reference</span></h1><div class='toc' style='margin-left:1em'><span class="header">Contents:</span><div class='toc_line' style='padding-left:0em;'><a href='#id_0b79795d3efc95b9976c7c5b933afce2'>Introduction</a></div><div class='toc_line' style='padding-left:0em;'><a href='#id_2386c9a1f1785edee33f374dd2db9b3d'>Basic Functions</a></div><div class='toc_line' style='padding-left:0em;'><a href='#id_83915d1254927f41241e8630890bec6e'>Themes</a></div><div class='toc_line' style='padding-left:0em;'><a href='#id_f4f70727dc34561dfde1a3c529b6205c'>Settings</a></div><div class='toc_line' style='padding-left:1em;'><a href='#id_fe7f01083bc9554f5b913342cafaf5ab'>List of observed settings</a></div><div class='toc_line' style='padding-left:2em;'><a href='#id_ab0cf104f39708eabd07b8cb67e149ba'>Cache</a></div><div class='toc_line' style='padding-left:2em;'><a href='#id_74248c725e00bf9fe04df4e35b249a19'>Misc</a></div><div class='toc_line' style='padding-left:2em;'><a href='#id_b46031bc6e1da09bf56aa837c0596a35'>Formatter</a></div></div><p><h2 id='id_0b79795d3efc95b9976c7c5b933afce2' ><span>Introduction</span></h2>This document gives a relatively high level overview of the user's API. For full API documentation, see the Doxygen HTML files in your distribution.<p>The entirety of the public API is contained within a class called <span class='inline-code'>luminous</span>. This is used as a namespace, the methods within are static, which means you can call them directly without instantiating the class. For those unfamiliar with the syntax or terminology, this just means that you call the functions as normal but place <span class='inline-code'>luminous::</span> in front of it. This is as it is shown on this page.<p>The functions in this namespace interact with a theoretically private singleton object called $luminous_. You should be aware of this if only to avoid overwriting it.<p><h2 id='id_2386c9a1f1785edee33f374dd2db9b3d' ><span>Basic Functions</span></h2>The two main highlighting functions are:<blockquote><span class='inline-code'>luminous::highlight($language, $source, $options=array())</span></blockquote><blockquote><span class='inline-code'>luminous::highlight_file($language, $path, $options=array())</span></blockquote>Note: in versions prior to 0.7, the third parameter was a boolean flag to switch on/off caching. This behaviour is preserved in 0.7 - you can still use a boolean flag instead of the options array. For options, keep reading this page.<p>$language can be a language code (open supported.php in a browser to see a list of what you have available), or your own instance of LuminousScanner.<p>Since 0.6.2 you can ask Luminous to guess the language of a piece of source code with the function:<blockquote><span class='inline-code'>luminous::guess_language($src, $confidence=0.05, $default='plain')</span></blockquote>This will return a valid language code for the most-probable language. $confidence and $default are related: if no scanner is willing to say with above 0.05 (5%) certainty that it owns the source code, then $default is returned. It's probably best to leave this at 0.05.<p><strong>warning:</strong> For obvious reasons, laguage guessing is inherently unreliable. Luminous will try to latch on to unique parts of the language, but this is difficult in languages like C, C# and Java, which are syntactically very similar.<blockquote><span class='inline-code'>luminous::head_html()</span></blockquote>This will output several link and script tags. It tries to determine the correct path to the luminous/ directory relative to the document root, but may fail. In this case, you can override it to set it manually. The settings: 'theme', 'relative-root', 'include-javascript' and 'include-jquery' affect this.<p>Since 0.6.6:<blockquote><span class='inline-code'>luminous::cache_errors()</span></blockquote>Returns a list of cache errors encountered for the most recent highlight, or <span class='inline-code'>FALSE</span> if the cache was not enabled. See the <a href='cache'>cache</a> page.<p><h2 id='id_83915d1254927f41241e8630890bec6e' ><span>Themes</span></h2><blockquote><span class='inline-code'>luminous::themes()</span></blockquote><blockquote><span class='inline-code'>luminous::theme_exists($theme_name)</span></blockquote>themes() returns a list of themes present in the style/ directory. Use this if you're building a theme selector.<p>theme_exists() returns true if a theme exists in the style/ directory, else false.<p><h2 id='id_f4f70727dc34561dfde1a3c529b6205c' ><span>Settings</span></h2><blockquote><span class='inline-code'>luminous::set($name, $value)</span></blockquote>Sets an internal setting to the given value. An exception is raised if the setting is unrecognised.<p>Since 0.6.2, you can set the first argument as an array of $name => $value, and omit the second argument.<blockquote><span class='inline-code'>luminous::setting($name)</span></blockquote>Returns the value currently set for the given setting. An exception is raised if the setting is unrecognised.<p><h3 id='id_fe7f01083bc9554f5b913342cafaf5ab' ><span>List of observed settings</span></h3><strong>Note:</strong> What's listed here might not reflect your version. A definitive list of settings can be found in Doxygen (the LuminousOptions class) as of 0.6.2.<p>As with php, setting an integer setting to 0 or -1 will disable it. As of 0.6.2 some validation is applied to these options and exceptions will be thrown if you try to do something nonsensical.<p><h4 id='id_ab0cf104f39708eabd07b8cb67e149ba' ><span>Cache</span></h4><ul><li> cache (bool): Whether to use the built-in cache (default: <span class='inline-code'>TRUE</span>)<li> cache-age (int): age (seconds) at which to remove cached files (age is determined by mtime -- cache hits trigger a 'touch', so this setting removes cached files which have not been accessed for the given time.), 0 or -1 to disable. (default: 777600 : 90 days)<li> sql-function: See the <a href='cache'>cache</a> page.</li></ul><h4 id='id_74248c725e00bf9fe04df4e35b249a19' ><span>Misc</span></h4><ul><li> include-javascript (bool): controls whether luminous::head_html() outputs the javascript 'extras'.<li> include-jquery (bool): controls whether luminous::head_html() outputs jquery; this is ignored if include-javascript is false. You do not need this if your page already has jQuery!<li> relative-root (str): luminous::head_html() has to know the location of the luminous directory relative to the location of the document root. It tries to figure this out, but may fail if you are using symlinks. You may override it here.<li> theme: Sets the internal theme. The LaTeX and html-full formatters read this, and luminous::head_html observes this.<li> verbose (bool): Since 0.6.6. If <span class='inline-code'>TRUE</span>, Luminous generates PHP warnings on problems (currently only cache problems which require attention from the caller). (default: <span class='inline-code'>TRUE</span>)</li></ul><h4 id='id_b46031bc6e1da09bf56aa837c0596a35' ><span>Formatter</span></h4>Formatting options relate to the display of highlighted output.<ul><li> auto-link (bool): if the formatter supports hyperlinking, URIs will be linked<li> html-strict (bool): Luminous uses the 'target' attribute of <a> tags. This is not valid for X/HTML4 strict, therefore it may be disabled. Note that this is purely academic: browsers don't care. Luminous produces valid HTML5 and HTML4 transitional output regardless.<li> line-numbers (bool): If the formatter supports line numbering, lines are numbered. (default: true)<li> start-line (int): If the formatter supports line numbering, lines start from this number. (default: 1)<li> max-height (int): if the formatter can control its height, it will constrain itself to this many pixels (you may specify this as a string with units) (default: 500)<li> format (string): Controls the output format:<ol><li> 'html' (default): HTML. The HTML is contained in a <div> element. CSS must be included on the same page.<li> 'html-full': A full HTML page. The page is a valid and self-contained HTML document and includes all necessary CSS.<li> 'html-inline': This is a small variation on the HTML formatter which styles output for inline (in-text) display. The output is in an inline-block element, with line numbers and height constraints disabled. You probably want HTML.<li> 'latex': LaTeX.<li> 'none', null: the 'identity' formatter, i.e. no formatting is applied. The result is basically an XML fragment, the way Luminous embeds highlighting data in the string internally. This is implemented for debugging.</li></ol></li></ul>
|
|
</body>
|
|
</html> |