From 82491528e22b97334df8115f014c1f144c1c5c52 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20S=C3=B6derberg?= Date: Sun, 1 Sep 2024 12:30:28 +0200 Subject: [PATCH] fix(annotations): correct `@Parser` parameter description --- docs/annotations/index.md | 7 ++++++- main.py | 6 ++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/docs/annotations/index.md b/docs/annotations/index.md index fc6d693..b1f4c1c 100644 --- a/docs/annotations/index.md +++ b/docs/annotations/index.md @@ -222,7 +222,12 @@ annotation. If no value is passed to the annotation then the parser will become the default parser for the method return type. You may also pass a suggestion provider name to the annotation to bind the parser to a specific suggestion provider. -The signature of the method must be exactly: +The parameter list is flexible (see the +{{ javadoc("https://javadoc.io/doc/org.incendo/cloud-annotations/latest/org/incendo/cloud/annotations/parser/Parser.html", "JavaDoc", False) }} +) but the parser _must_ return the type you wish to parse. The parser will be +registered to the [parser registry](../core/index.md#parser-registry). + +Example: ```java // Named parser: @Parser("parserName") diff --git a/main.py b/main.py index 613a5d2..7840048 100644 --- a/main.py +++ b/main.py @@ -32,14 +32,16 @@ def dependency_listing(name: str, version: str = None) -> str: """.format(name=name, version=env.variables.version[version]) @env.macro - def javadoc(link: str, title: str = None) -> str: + def javadoc(link: str, title: str = None, code: bool = True) -> str: if title is None: split = link.split("/") title = split[len(split) - 1].replace(".html", "") if link.startswith("<"): link = link[1: len(link) - 1] + if code: + title = f'`{title}`' - return '[`{title}`](<{link}> "Click to open the JavaDoc")'.format(link=link, title=title) + return '[{title}](<{link}> "Click to open the JavaDoc")'.format(link=link, title=title) @env.macro def snippet(path: str, section: str = "snippet", title: str = None, indent = 0) -> str: