feat(pipeline): add @common/@commonparams shared parameter blocks - #7
Closed
pfeerick wants to merge 1 commit into
Closed
feat(pipeline): add @common/@commonparams shared parameter blocks#7pfeerick wants to merge 1 commit into
pfeerick wants to merge 1 commit into
Conversation
The LVGL firmware annotation work (EdgeTX/edgetx#7771) repeats the same 9-line "common object properties" bullet list verbatim across 27+ widget-constructor luadoc comments, since there was no way to define it once and reference it. Any future change to those shared properties (as already happened once, for a version-citation fix) requires touching every single occurrence. Adds two new luadoc tags: - `@common <name>` defines a reusable, non-callable chunk of luadoc body text. It is never treated as an API item -- no page, no nav entry, no hub-page card. - `@commonparams <name>` used inside a `@function` block's parameter section textually splices in the matching `@common` block's body, before normal @param/@RetVal parsing runs. This works at the text level (not as a structured-parameter-array merge) because the existing convention documents each settings table as a single `@param params (table): * bullet * bullet ...` entry, not one @PARAM per field -- expansion has to happen before that bullet-list text becomes one flat description string. extract_model() now does two passes: collect all @common definitions first, then expand @commonparams references and parse @function blocks as normal. Fails loudly (matching this project's own stated design goal for the extractor) if a @commonparams reference points at an undefined @common block; warns if a @common block is defined but never referenced. Also fixes a real, unrelated bug found while testing this against the LVGL branch's actual content: FUNCTION_RE/PARAM_RE/RETVAL_RE/ NOTICE_RE/STATUS_RE all anchored `^@tag` at true column 0, but the LVGL functions are indented 2 spaces (nested inside a table registration block) -- every one of PR #7771's ~45 functions was silently extracting zero parameters and "unknown" availability before this fix. FUNCTION_RE itself didn't need the fix (extract_blocks() already strips the whole block, so the first tag always lands at column 0), but the rest do. Verified: rendered Markdown and LuaLS output are byte-identical before/after converting the LVGL branch to use @common/@commonparams (the only differences across all changed files are source line numbers, which genuinely shifted, and a generation timestamp). Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015yCHydHbzZYCKpav38SonD
pfeerick
added a commit
to pfeerick/edgetx
that referenced
this pull request
Sep 7, 2026
…arams The 9-line "common object properties" bullet list (x, y, w, h, color, pos, size, visible, floating) was repeated verbatim across all 27 widget-constructor luadoc comments in this file. A companion doc-pipeline change (JimB40/lua-reference-guide#7) adds @common/ @commonparams luadoc tags specifically to eliminate this: define the shared block once with @common, reference it from each widget with @commonparams, and the extractor splices it back in at build time -- so generated documentation is unchanged, but a future edit to a common property only needs to happen in one place. Verified: re-extracting and re-rendering this file's content with the new pipeline support produces output identical to before this refactor (only source line numbers and a generation timestamp differ, both expected side effects of inserting the new @common block). Comment-only change, no behavior change. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015yCHydHbzZYCKpav38SonD
4 tasks
Collaborator
Author
|
Superseded by direct work on |
pfeerick
added a commit
that referenced
this pull request
Sep 9, 2026
Ported from #7 (docs/common-param-support): the four regexes anchored `^@tag` at true column 0, silently dropping any tag line indented to match surrounding code style. Found while investigating EdgeTX/edgetx#7771 (adds LVGL luadoc annotations, which are indented 2 spaces inside their LROT_BEGIN table) -- every one of that PR's ~45 functions was extracting zero parameters and "unknown" availability before this fix. Turns out this wasn't LVGL-specific: re-extracting the current 2.12 baseline with the fix (same 153 items, none added or lost) surfaced two real, silent bugs already live on this site -- model.getSwashRing's availability was "unknown" instead of "2.8.0", and playNumber was missing its `volume` parameter entirely. Both are fixed by this rebuild. Only the extraction-phase fix is ported here, not #7's build_outputs/ page-path changes -- that PR's branch was forked before this session's nested-URL restructure and generated-file-marker work, and its diff would have reverted both. The @common/@commonparams mechanism from that PR (needed for EdgeTX/edgetx#7771's shared LVGL parameter blocks) is included since it's purely additive at the extraction phase and independent of page-path/output concerns. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HLXbKn4rY3NihRnqH89jmD
pfeerick
added a commit
that referenced
this pull request
Sep 9, 2026
Re-extracted from EdgeTX/edgetx branch 2.12 at 8718d2473a (the squash merge of #7771, "add luadoc annotations for the LVGL Lua API"): 153 -> 198 items, all 45 real. The 44 hand-preserved flat lvgl-*.md pages (ported from the official guide, since firmware had zero LVGL annotations at all -- see prior HANDOFF.md entries) are replaced with real nested display-lvgl/<item>.md pages generated the same way as every other group now; the old flat files are removed, not left as orphans. Both #5 (the manual port) and #7 (the @common/@commonparams support this depended on, already ported separately) on JimB40/lua-reference-guide are closed as superseded by this. docs-system/generated/api-model.local.json, REAL-EXTRACTION-NOTES.md (both copies), and HANDOFF.md updated to match. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HLXbKn4rY3NihRnqH89jmD
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The in-flight LVGL firmware annotation work (EdgeTX/edgetx#7771) repeats the same 9-line "common object properties" bullet list (
x,y,w,h,color,pos,size,visible,floating) verbatim across 27+ widget-constructor luadoc comments, since there was no way to define it once and reference it from many functions. Any future change to those shared properties (this already happened once, for a version-citation fix) requires editing every single occurrence.Adds two new luadoc tags to
tools/docs_pipeline.py:@common <name>defines a reusable, non-callable chunk of luadoc body text. It's never treated as an API item — no generated page, no nav entry, no hub-page card. Example:@commonparams <name>used inside a@functionblock's parameter section textually splices in the matching@commonblock's body, before normal@param/@retvalparsing runs:This works at the text level (splicing into the raw block before parsing), not as a structured-parameter-array merge after parsing — because the existing convention documents each settings table as a single
@param params (table): * bullet * bullet ...entry, not one@paramper field. Expansion has to happen before that bullet-list text collapses into one flat description string.extract_model()now does two passes: collect all@commondefinitions first, then expand@commonparamsreferences and parse@functionblocks as normal. Fails loudly (matching this project's own stated extractor design goal) if a@commonparamsreference points at an undefined@commonblock; warns if a@commonblock is defined but never referenced.Also fixes a real, unrelated bug found while testing this against the LVGL branch's actual content:
FUNCTION_RE/PARAM_RE/RETVAL_RE/NOTICE_RE/STATUS_REall anchored^@tagat true column 0, but the LVGL functions are indented 2 spaces (nested inside a table registration block) — every one of PR #7771's ~45 functions was silently extracting zero parameters and "unknown" availability before this fix.FUNCTION_REitself didn't need the fix (extract_blocks()already strips the whole block, so the first tag always lands at column 0), but the other four did.Test plan
@common/@commonparamssyntax unit-tested against a small standalone fixture — confirms expansion works,@commonblocks don't become items, undefined references fail loudly, unused definitions warn@commonparamsin all 27 occurrences and diffed the full rendered output (Markdown + LuaLS.d.lua) before/after — every difference across all 33 changed files is either a source line number (which genuinely shifted) or a generation timestamp; zero content differencesmkdocs build --strict(public + dev configs) — both pass clean, confirming no regression to any non-LVGL content🤖 Generated with Claude Code
https://claude.ai/code/session_015yCHydHbzZYCKpav38SonD