<commit_before>Functions
=========

libsass allow registration of custom functions. These functions are equivalent to ``@function`` functions in the sass
language. jsass automatically maps methods from any java object to libsass and internally converts java values to
libsass values and vise versa for you.

First you must write an object with public methods.

.. code-block:: java
   :linenos:

    import io.bit3.jsass.annotation.Name;

    public class MyFunctions {
        public String hello(@Name("name") String name) {
            return "Hello " + name;
        }
    }

Then register the object instance to the options.

.. code-block:: java

    options.getFunctionProviders().add(new MyFunctions());

jsass will map the method ``MyFunctions::hello(name)`` to libsass as ``hello($name)``.

What methods are registered?
----------------------------

All directly declared public methods are registered as libsass functions.
Non-public and inherited methods are not registered.

Function signature
------------------

The function signature is build from the method name and the parameter annotation ``@Name``.<commit_msg>Add documentation for @warn, @error, @debug special functions<commit_after>Functions
=========

libsass allow registration of custom functions. These functions are equivalent to ``@function`` functions in the sass
language. jsass automatically maps methods from any java object to libsass and internally converts java values to
libsass values and vise versa for you.

First you must write an object with public methods.

.. code-block:: java
   :linenos:

    import io.bit3.jsass.annotation.Name;

    public class MyFunctions {
        public String hello(@Name("name") String name) {
            return "Hello " + name;
        }
    }

Then register the object instance to the options.

.. code-block:: java

    options.getFunctionProviders().add(new MyFunctions());

jsass will map the method ``MyFunctions::hello(name)`` to libsass as ``hello($name)``.

What methods are registered?
----------------------------

All directly declared public methods are registered as libsass functions.
Non-public and inherited methods are not registered.

Special functions ``@warn``, ``@error``, ``@debug``
---------------------------------------------------

Libsass allow to overwrite the ``@warn``, ``@error`` and ``@debug`` functions.
Simply mark the designated method with annotations, like this:

.. code-block:: java

   @WarnFunction
   public void warn(String message) {
     logger.warn(message);
   }

   @ErrorFunction
   public void error(String message) {
     logger.error(message);
   }

   @DebugFunction
   public void debug(String message) {
     logger.debug(message);
   }

Function signature
------------------

The function signature is build from the method name and the parameter annotation ``@Name``.
{'fraction_non_alphanumeric': 0.13824561403508773, 'fraction_numerical': 0.0007017543859649122, 'mean_word_length': 3.1199421965317917, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7168438', 'n_tokens_mistral': 724, 'n_tokens_neox': 694, 'n_words': 300}