Built-in modules#
aspell#
This module defines the connection between LaTeXBuddy and GNU Aspell.
- class latexbuddy.modules.aspell.Aspell#
- static find_languages()#
Returns all languages supported by the current aspell installation. Omits specific language variations like ‘en-variant_0’.
- format_errors(out, line_number, file)#
Parses Aspell errors and returns list of Problems.
- run_checks(config, file)#
Runs the Aspell checks on a file and returns the results as a list.
Requires Aspell to be set up.
- Parameters
config (ConfigLoader) – the configuration options of the calling LaTeXBuddy instance
file (TexFile) – LaTeX file to be checked (with built-in detex option)
- Return type
BibTeX#
- class latexbuddy.modules.bib_checkers.BibtexDuplicates#
- run_checks(config, file)#
Runs the checks and returns a list of discovered problems.
- Parameters
config (ConfigLoader) – the configuration options of the calling LaTeXBuddy instance
file (TexFile) – LaTeX file to be checked (with built-in detex option)
- Return type
- class latexbuddy.modules.bib_checkers.NewerPublications#
- run_checks(config, file)#
Runs the checks and returns a list of discovered problems.
- Parameters
config (ConfigLoader) – the configuration options of the calling LaTeXBuddy instance
file (TexFile) – LaTeX file to be checked (with built-in detex option)
- Return type
- latexbuddy.modules.bib_checkers.get_bibfile(file)#
Checks the given file text for a ibliography{} command and returns the full path of the input BibTeX file. For now only works with a single BibTeX file.
- Parameters
file (TexFile) – TexFile object of the LaTeX file to check
- Returns
- Return type
pathlib.Path | None
ChkTeX#
This module defines the connection between LaTeXBuddy and ChkTeX.
ChkTeX Documentation: https://www.nongnu.org/chktex/ChkTeX.pdf
Diction#
- class latexbuddy.modules.diction.Diction#
- format_errors(out, original, file, texfile)#
Parses diction errors and returns list of Problems.
- run_checks(config, file)#
Runs the checks and returns a list of discovered problems.
- Parameters
config (ConfigLoader) – the configuration options of the calling LaTeXBuddy instance
file (TexFile) – LaTeX file to be checked (with built-in detex option)
- Return type
LanguageTool#
This module defines the connection between LaTeXBuddy and LanguageTool.
- class latexbuddy.modules.languagetool.LanguageTool#
Wraps the LanguageTool API calls to check files.
- check_tex(file)#
Runs the LanguageTool checks on a file.
- Parameters
file (TexFile) – the file to run checks on
- Return type
- execute_commandline_request(file)#
Execute the LanguageTool command line app to check the text.
- find_disabled_rules(config)#
Reads all disabled rules and categories from the specified configuration and saves the result in the instance.
- Parameters
config (ConfigLoader) – configuration options to be read
- Return type
None
- find_languagetool_command()#
Searches for the LanguageTool command line app.
This method also checks if Java is installed.
- Return type
None
- find_languagetool_command_prefix()#
Finds the prefix of the shell command executing LanguageTool in the commandline.
- find_supported_languages()#
Acquires a list of supported languages from the version of LanguageTool that is currently used.
- static format_errors(raw_problems, file)#
Parses LanguageTool errors and converts them to LaTeXBuddy Error objects.
- Parameters
- Return type
- lt_languages_get_request(server_url)#
Sends a GET request to the specified URL in order to retrieve a JSON formatted list of supported languages by the server.
If the response format is invalid, this method will most likely fail with an exception.
- lt_post_request(file, server_url)#
Send a POST request to the LanguageTool server to check the text.
- matches_language_regex(language)#
Determines whether a given string is a language code by matching it against a regular expression.
- static parse_error_replacements(json_replacements, max_elements=5)#
Converts LanguageTool’s replacements to LaTeXBuddy suggestions list.
- run_checks(config, file)#
Runs the LanguageTool checks on a file and returns the results as a list.
Requires LanguageTool (server) to be set up. Local or global servers can be used.
- Parameters
config (ConfigLoader) – the configuration options of the calling LaTeXBuddy instance
file (TexFile) – LaTeX file to be checked (with built-in detex option)
- Return type
- class latexbuddy.modules.languagetool.LanguageToolLocalServer#
Defines an instance of a local LanguageTool deployment.
- static find_free_port(port=None)#
Tries to find a free port for the LanguageTool server.
- get_server_run_command()#
Searches for the LanguageTool server executable.
This method also checks if Java is installed.
- Return type
None
- static is_port_in_use(port)#
Checks if a port is already in use.
- start_local_server(port=8081)#
Starts the LanguageTool server locally.
- stop_local_server()#
Stops the local LanguageTool server process.
- Return type
None
- wait_till_server_up()#
Waits for the LanguageTool server to start.
- Raises
ConnectionError – if server didn’t start
- Return type
None
- class latexbuddy.modules.languagetool.Mode(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)#
Describes the LanguageTool mode.
LanguageTool can be run as a command line program, a local server, or a remote server.
Log filter#
- class latexbuddy.modules.logfilter.LogFilter#
A Filter for log files.
Using TexFilt: https://www.ctan.org/tex-archive/support/texfilt
- format_problems(raw_problems_path, file)#
Formats the output to a List of Problems.
- Parameters
- Returns
a list of problems
- Return type
- run_checks(config, file)#
Runs the Texfilt checks on a file and returns the results as a list.
- Parameters
config (ConfigLoader) – configurations of the LaTeXBuddy instance
file (TexFile) – the file to run checks on
- Returns
a list of problems
- Return type