Syntax...emplate(3pm)
π Syntax::Highlight::Engine::Kate::Template π
hiii bestie π«Ά you've stumbled into the User Contributed Perl Documentation for Syntax::Highlight::Engine::Kate::Template(3pm) β yes the header truncates it to Syntax...emplate(3pm) because life is short and terminals are narrow, but we know what it really is. it's the little blueprint module that lives in the Syntax::Highlight::Engine::Kate::* family. let's go β¨
πΈ NAME πΈ
Syntax::Highlight::Engine::Kate::Template β a template for syntax highlighting plugins π
π¦ DESCRIPTION π¦
okay so Syntax::Highlight::Engine::Kate::Template is a framework to assist authors of plugin modules. it's giving scaffolding, it's giving starter pack. all the methods to provide highlighting to the Syntax::Highlight::Engine::Kate module are there β Just no syntax definitions and callbacks. (that "Just" with the capital J? that's canon, bestie, we don't touch it π
)
π¨ real talk: an instance of Syntax::Highlight::Engine::Kate::Template should never be created. it's meant to be sub classed only. do not instantiate the template. i am literally begging you. π
π METHODS π
here come the methods, one by one, no skips, no cuts π
attributes(?$attributesref?)β sets and returns a reference to the attributes hash. that's it, that's the method.basecontext(?$context?)β sets and returns thebasecontextinstance variable. this is the context that is used when highlighting starts. the origin story of your highlight β¨captured($cap)β puts$capin the first element of the stack, the current context. used when the context is dynamic.capturedGet($num)β returns the$num'th element that was captured in the current context.capturedParse($string, $mode)β two modes, bestie, choose your fighter:- if
$modeis specified,$stringshould only be one character long and numeric.capturedParsewill return the Nth captured element of the current context. - if
$modeis not specified, all occurrences of%[1-9]will be replaced by the captured element of the current context.
- if
columnβ returns the column position in the line that is currently highlighted. yes, like a little cursor GPS πcontextdata(\%data)β sets and returns a reference to thecontextdatahash.contextInfo($context, $item)β returns the value of several context options.$itemcan becallback,attribute,lineending,linebeginning,fallthrough.contextParse($plugin, $context)β called by the plugins after a test succeeds. if$contexthas following values:#popβ returns to the previous context, removes to top item in the stack. Can also be specified as#pop#popetc.#stayβ does nothing.##....β Switches to the plugin specified in....and assumes it's basecontext.....β Swtiches to the context specified in....
deliminators(?$delim?)β sets and returns a string that is a regular expression for detecting deliminators. (deliminators with an i, that's the spelling, we respect it π)engineβ Returns a reference to theSyntax::Highlight::Engine::Katemodule that created this plugin. it's giving who's your daddy but for object references πfirstnonspace($string)β returns true if the current line did not contain a non-spatial character so far and the first character in$stringis also a spatial character.formatTableβ sets and returns the instance variableformat_table. See also the optionformat_table.highlight($text)β highlights$text. it does so by selecting the proper callback from the commands hash and invoke it. it will do so until$texthas been reduced to an empty string. returns a paired list of snippets of text and the attribute with which they should be highlighted. π₯highlightText($text)β highlights$textand reformats it using theformat_tableand substitutions.includePlugin($language, \$text)β Includes the plugin for$languagein the highlighting.includeRules($language, \$text)β Includes the plugin for$languagein the highlighting. (yes, same one-liner asincludePlugin. siblings. twins. iconique. π―)keywordscaseβ Sets and returns thekeywordscaseinstance variable.lastcharβ return the last character that was processed.lastcharDeliminatorβ returns true if the last character processed was a deliminator.linesegmentβ returns the string of text in the current line that has been processed so far,linestartβ returns true if processing is currently at the beginning of a line.listAdd('listname', $item1, $item2 ...)β Adds a list to the'lists'hash.lists(?\%lists?)β sets and returns the instance variable'lists'.out(?\@highlightedlist?)β sets and returns the instance variable'out'.parseResult(\$text, $match, $lookahaed, $column, $firstnonspace, $context, $attribute)β Called by every one of the test methods below. If the test matches, it will do a couple of subtests. If$columnis a defined numerical value it will test if the process is at the requested column. If$firnonspaceis true, it will test this also. Ig it is not a look ahead and all tests are passed,$matchis then parsed and removed from$$text.pluginGet($language)β Returns a reference to a plugin object for the specified language. Creating an instance if needed.resetβ Resets the highlight engine to a fresh state, does not change the syntx. (fresh start, same syntax, self-care era π§)snippetβ Contains the current snippet of text that will have one attribute. The moment the attribute changes it will be parsed.snippetAppend($string)β appends$stringto the current snippet.snippetAttribute($attribute)β Sets and returns the used attribute.snippetForceβ Forces the current snippet to be parsed. no consent needed, it goes πsnippetParse($text, ?$attribute?)β If attribute is defined and differs from the current attribute it does asnippetForceand sets the current attribute to$attribute. Then it does asnippetAppendof$textstackβ sets and returns the instance variable'stack', a reference to an array.stackPullβ retrieves the element that is on top of the stack, decrementsstacksizeby 1.stackPush($tagname)β puts$tagnameon top of the stack, incrementsstacksizeby 1stackTopβ Retrieves the element that is on top of the stack.stateCompare(\@state)β Compares two lists,\@stateand the stack. returns true if they match.stateGetβ Returns a list containing the entire stack.stateSet(@list)β Accepts@listas the current stack.substitutionsβ sets and returns a reference to the substitutions hash.
π§ͺ the test methods π§ͺ
okay so, direct quote from the source of truth: The methods below all return a boolean value. all of them. every single one. true or false, no in-between, no situationship π
testAnyChar(\$text, $string, $insensitive, $lookahaed, $column, $firstnonspace, $context, $attribute);testDetectChar(\$text, $char, $insensitive, $dynamic, $lookahaed, $column, $firstnonspace, $context, $attribute);testDetect2Chars(\$text, $char1, $char2, $insensitive, $dynamic, $lookahaed, $column, $firstnonspace, $context, $attribute);testDetectIdentifier(\$text, $lookahaed, $column, $firstnonspace, $context, $attribute);testDetectSpaces(\$text, $lookahaed, $column, $firstnonspace, $context, $attribute);testFloat(\$text, $lookahaed, $column, $firstnonspace, $context, $attribute);testHlCChar(\$text, $lookahaed, $column, $firstnonspace, $context, $attribute);testHlCHex(\$text, $lookahaed, $column, $firstnonspace, $context, $attribute);testHlCOct(\$text, $lookahaed, $column, $firstnonspace, $context, $attribute);testHlCStringChar(\$text, $lookahaed, $column, $firstnonspace, $context, $attribute);testInt(\$text, $lookahaed, $column, $firstnonspace, $context, $attribute);testKeyword(\$text, $list, $insensitive, $lookahaed, $column, $firstnonspace, $context, $attribute);testLineContinue(\$text, $lookahaed, $column, $firstnonspace, $context, $attribute);testRangeDetect(\$text, $char1, $char2, $insensitive, $lookahaed, $column, $firstnonspace, $context, $attribute);testRegExpr(\$text, $reg, $insensitive, $dynamic, $lookahaed, $column, $firstnonspace, $context, $attribute);testStringDetect(\$text, $string, $insensitive, $dynamic, I$lookahaed, $column, $firstnonspace, $context, $attribute);
π ACKNOWLEDGEMENTS π
All the people who wrote Kate and the syntax highlight xml files. absolute legends, every one of them π
π AUTHOR AND COPYRIGHT π
This module is written and maintained by:
Hans Jeuken < haje at toneel dot demon dot nl >
Copyright (c) 2006 by Hans Jeuken, all rights reserved.
You may freely distribute and/or modify this module under same terms as Perl itself.
π SEE ALSO π
Synax::Highlight::Engine::Kate http:://www.kate-editor.org
(yes bestie, that's Synax and http:: β that's exactly how it's written in here and we are not editing a single character, i don't make the rules, i just keep the receipts π
)
okay that's the whole page, you made it, mwah π«Άβ¨ this was perl v5.40.1, dated 2026-02-22, from the User Contributed Perl Documentation β go forth and sub class responsibly, and remember: never, ever instantiate the template ππΈ
π¦ where this page comes from
- ubuntu resolute: libsyntax-highlight-engine-kate-perl 0.16+dfsg-1ubuntu1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libsyntax-highlight-engine-kate-perl 0.16+dfsg-1ubuntu1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms