[doc] Add language info summary

This commit is contained in:
Andreas Dangel
2023-09-01 09:41:46 +02:00
parent 291a5aa956
commit ca40dc41b0
4 changed files with 27 additions and 15 deletions

View File

@ -0,0 +1,11 @@
<details>
<summary>Name: {{include.name}}</summary>
<div class="card">
<ul class="list-group list-group-flush">
<li class="list-group-item">Implementation: {% jdoc include.implementation %}</li>
<li class="list-group-item">id: {{include.id}}</li>
<li class="list-group-item">PMD: {% if include.supports_pmd %}✔️{% else %}❌{% endif %}</li>
<li class="list-group-item">CPD: {% if include.supports_cpd %}✔️{% else %}❌{% endif %}</li>
</ul>
</div>
</details>

View File

@ -106,16 +106,25 @@ class JavadocTag < Liquid::Tag
def initialize(tag_name, doc_ref, tokens)
super
# sanitize a little
doc_ref.delete! " \"'"
@doc_ref = doc_ref
end
arr = doc_ref.split("#") # split into fqcn + member suffix
def render(var_ctx)
# maybe the parameter is actually a variable - try to resolve it first
if var_ctx.key?(@doc_ref)
@doc_ref = var_ctx[@doc_ref]
end
# sanitize a little
@doc_ref.delete! " \"'"
arr = @doc_ref.split("#") # split into fqcn + member suffix
@type_fqcn = arr[0]
@member_suffix = arr[1] || "" # default to empty string
unless Regexp.new('(!\w*!)?' + Regexp.union(JDocNamespaceDeclaration::NAMESPACED_FQCN_REGEX, JDocNamespaceDeclaration::SYM_REGEX).source ) =~ @type_fqcn
fail "Wrong syntax for type reference, expected eg nspace::a.b.C, !opts!nspace::a.b.C, or :nspace"
fail "Wrong syntax for type reference, expected eg nspace::a.b.C, !opts!nspace::a.b.C, or :nspace, but got \'" + @type_fqcn + "\'"
end
# If no options, then split produces [@type_fqcn]
@ -130,9 +139,6 @@ class JavadocTag < Liquid::Tag
elsif tag_name == "jdoc_old"
@use_previous_api_version = true
end
end
def render(var_ctx)
artifact_name, @type_fqcn = JDocNamespaceDeclaration::parse_fqcn(@type_fqcn, var_ctx)
resolved_type = JavadocTag::fqcn_type(artifact_name, @type_fqcn)

View File

@ -7,14 +7,7 @@ tags: [languages]
summary: "Apex-specific features and guidance"
---
Implementation: {% jdoc apex::lang.apex.ApexLanguageModule %}
Name: Apex
id: apex
PMD: yes
CPD: yes
{% include warning.html content="Todo for pmd 7" %}
{% include language_info.html name='Apex' id='apex' implementation='apex::lang.apex.ApexLanguageModule' supports_pmd='✔️' supports_cpd='✔️' %}
## Metrics framework

View File

@ -7,6 +7,8 @@ tags: [languages]
summary: "Java-specific features and guidance"
---
{% include language_info.html name='Java' id='java' implementation='java::lang.java.JavaLanguageModule' supports_pmd='✔️' supports_cpd='✔️' %}
{% include warning.html content="WIP, todo for pmd 7" %}
## Overview of supported Java language versions