CodeTe...mplate(3pm)

πŸ“¦
version 0.3.4 Β· 2 versions
, in debian trixie, ubuntu resolute, ubuntu stonking

πŸ’– NAME πŸ’–

Tk::CodeText::Template β€” a whole template for syntax highlighting plugins, bestie ✨


πŸ“œ SYNOPSIS πŸ“œ

okay so… this section is literally empty. Not a single line. No cap, there is nothing here to show you 🫢


🌸 DESCRIPTION 🌸

Tk::CodeText::Template is a framework that's here to help out all the girlies (gn) who write plugin modules πŸŽ€ Every single method you'd need to bring syntax highlighting to life inside a Tk::CodeText widget? It's all right there. The only things missing are the syntax definitions and the callbacks, which is lowkey the whole point β€” you bring those.

🚨 bestie listen: you should never create an instance of Tk::CodeText::Template. Never ever. It is meant to be sub classed only. It's giving "abstract base class, do not touch," and we respect that πŸ’…

✨ METHODS ✨

  • callbacks({'Tagname' => \&callback, ...}) β€” sets and returns the instance variable 'callbacks' πŸ¦‹
  • highlight($text) β€” highlights $text. It does this by picking the right callback out of the commands hash and invoking it. And it keeps on doing that, over and over, until $text has been reduced all the way down to an empty string. Iconic loop behavior, fr fr πŸ”₯
  • 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' 🌈
  • parserError('text') β€” the error trapping method. It tries to escape the current mode. If that's not possible, it will parse the text with the default tag instead. On top of all that, it complains about being called at all 😭 which is honestly so valid of it. This one is useful for debugging when you're writing a new plugin πŸ”
  • rules(?\@rules?) β€” sets and returns a reference to a list of tagnames and options. By default it is set to [] ⭐
  • snippetAppend($string) β€” appends $string to the current snippet βœ‚οΈ
  • snippetParse(?$text?, ?$tagname?) β€” parses $text into the 'out' list, and assigns $tagname to it. If $tagname isn't specified, it will go looking for the tagname by calling stackTop. And if $text isn't specified either, it will go looking for text by calling snippet πŸ‘‘
  • stack β€” sets and returns the instance variable 'stack', which is a reference to an array πŸ₯ž
  • stackPull β€” retrieves the element that's sitting on top of the stack, and decrements stacksize by 1 πŸ“‰
  • stackPush($tagname) β€” puts $tagname on top of the stack, and increments stacksize by 1 πŸ“ˆ
  • stackTop β€” retrieves the element on top of the stack πŸ‘€
  • stateCompare(\@state); β€” compares two lists, \@state and the stack. Returns true if they match πŸ’š
  • stateGet β€” returns a list containing the entire stack πŸ—‚οΈ
  • stateSet(@list) β€” accepts @list as the current stack πŸ”„
  • tokenParse('Tagname'); β€” parses the currently built snippet and tags it with 'Tagname' 🏷️
  • tokenTest($value, 'Listname'); β€” returns true if $value is an element of 'Listname' in the 'lists' hash βœ…

πŸ‘‘ AUTHOR πŸ‘‘

Hans Jeuken (haje@toneel.demon.nl) β€” shoutout to the legend 🫢


πŸ’€ BUGS πŸ’€

Unknown. (Which is either slay or terrifying, and honestly? Both 😭)


mwah, that's the whole page bestie πŸ’– this lovely little doc shipped with perl v5.40.1 and it's dated 2025-05-04, under User Contributed Perl Documentation β€” go forth and subclass responsibly 🧚✨

πŸ“¦ where this page comes from