CORE/docs/references/Preprocessor.md
JeremyStarTM 99703cf03e CORE rewrite (#1)
Reviewed-on: StarOpenSource/core#1

Rewrote CORE and improved the startup process and startup time significantly. The documentation has been beefed up too and is now much better. Existing projects may need major refactoring however.
Co-authored-by: JeremyStarTM <jeremystartm@staropensource.de>
Co-committed-by: JeremyStarTM <jeremystartm@staropensource.de>
2023-08-25 14:34:57 +02:00

2.6 KiB

hide
navigation

Preprocessor (/root/CORE/Preprocessor)

The Preprocessor parses tags and is responsible for formatting text.

Tags (these can be used in log messages too!)

All tags can be escaped by adding esc_ before the tag name, if you want to do that. Example:

Raw: <esc_up><esc_np></esc_lo>
Output: <up><np></lo>

No process <np>

  • end tag no
  • description Disables preprocessing completely. Doesn't even display the prefix.
  • example:
Raw: <up>This is a</up><pa>test</pa><np> MESS<lo>age</lo>.
Output: <up>This is a</up><pa>test</pa> MESS<lo>age</lo>.

Newline <nl>

  • end tag no
  • description Makes a newline while respecting the prefix. Is much recommended over "\n".
  • example (with prefix prefix_):
Raw: Very nice message!<nl>Here's another message :)
Output:
prefix_Very nice message!
       Here's another message :)

Lowercase <lo></lo>

  • end tag yes
  • description Makes your text lowercase.
  • example:
Raw: Did <lo>you FiNd THA</lo>T funny?
Output: Did you find thaT funny?

Uppercase <up></up>

  • end tag yes
  • description Makes your text uppercase.
  • example:
Raw: ThiS Te<up>XT should be UPPer</up>caSED
Output: ThiS TeXT SHOULD BE UPPERcaSED

Camelcase <ca></ca>

  • end tag yes
  • description Makes your text camelcase.
  • example:
Raw: This <ca>text should be CamelCa</ca>sed.
Output: This textShouldBeCamelCased.

Pascalcase <pa></pa>

  • end tag yes
  • description Makes your text pascalcase.
  • example:
Raw: This <pa>text should be PascelCa</pa>sed.
Output: This TextShouldBePascelCased.

Snakecase <sn></sn>

  • end tag yes
  • description Makes your text snakecase.
  • example:
Raw: This <sn>text should be SnakeCa</sn>sed.
Output: This text_should_be_snake_cased.

Methods

process()

  • returns String
  • description Formats a message
    • argument msg
      • type String
      • mandatory yes
      • description The message used for processing
    • argument prefix
      • type String
      • mandatory yes
      • description The prefix used for newlines
    • argument pre_msg
      • type String
      • mandatory no, default value is ""
      • description Inserted before the message
    • argument post_msg
      • type String
      • mandatory no, default value is ""
      • description Inserted after the message
    • argument exclusion_filter
      • type Array
      • mandatory no, default value is []
      • description Removes specific Strings from the prefix (used in calculating spaces when using <nl>)