From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) by lore.proxmox.com (Postfix) with ESMTPS id 1604C1FF142 for ; Fri, 05 Jun 2026 17:38:31 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id CE7E41E753; Fri, 5 Jun 2026 17:38:29 +0200 (CEST) From: =?UTF-8?q?Michael=20K=C3=B6ppl?= To: pve-devel@lists.proxmox.com Subject: [PATCH docs v4 1/8] asciidoc-pve: allow linking sections with get_help_link Date: Fri, 5 Jun 2026 17:38:12 +0200 Message-ID: <20260605153819.310048-2-m.koeppl@proxmox.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260605153819.310048-1-m.koeppl@proxmox.com> References: <20260605153819.310048-1-m.koeppl@proxmox.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1780673865941 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.093 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Message-ID-Hash: ERIPS3APUTQPSH4QHOG3MGIO64Q2K4NQ X-Message-ID-Hash: ERIPS3APUTQPSH4QHOG3MGIO64Q2K4NQ X-MailFrom: m.koeppl@proxmox.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.10 Precedence: list List-Id: Proxmox VE development discussion List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: scan_extjs_file previously only scanned for occurrences of onlineHelp. Linking to specific sections of the documentation with get_help_link was not possible without an accompanying onlineHelp entry. Extend the regex to also match get_help_link('blockid') calls. biome may reformat function calls across multiple lines, so a scan which reads one line at a time would miss those occurrences. Switch from reading the file line by line to reading the whole file and matching globally. In addition, tolerate an optional trailing comma after the blockid argument. Line numbers for die/warn messages are reconstructed from the match offset since $. is no longer meaningful when matching against the full buffer. Signed-off-by: Michael Köppl --- Feedback very much welcome. I ran into this problem when biome started formatting the get_help_link function calls to multiple lines. Alternatively, I could've added a `biome-ignore format: ...` to the affected lines in pve-manager, but since it looks like we're not ignoring the rules anywhere, I chose to adapt the scan function. I tested this on both onlineHelp links and get_help_link links. scripts/asciidoc-pve.in | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/scripts/asciidoc-pve.in b/scripts/asciidoc-pve.in index d42ddbe9..12fde424 100644 --- a/scripts/asciidoc-pve.in +++ b/scripts/asciidoc-pve.in @@ -463,16 +463,17 @@ sub scan_extjs_file { debug("scan-extjs $filename"); - while (defined(my $line = <$fh>)) { - if ($line =~ m/\s+onlineHelp:\s*[\'\"]([^{}\[\]\'\"]+)[\'\"]/) { - my $blockid = $1; - my $link = $fileinfo->{blockid_target}->{default}->{$blockid}; - if (!(defined($link) || defined($online_help_links->{$blockid}))) { - die "undefined blockid '$blockid' ($filename, line $.)\n" if !$allow_missing; - warn "ignoring undefined blockid '$blockid' ($filename, line $.)\n"; - } - $res_data->{$blockid} = 1; + my $content = do { local $/; <$fh> }; + + while ($content =~ m/(?|\s+onlineHelp:\s*[\'\"]([^{}\[\]\'\"]+)[\'\"]|\bget_help_link\(\s*[\'\"]([^{}\[\]\'\"]+)[\'\"]\s*,?\s*\))/g) { + my $blockid = $1; + my $line_no = 1 + (substr($content, 0, $-[0]) =~ tr/\n//); + my $link = $fileinfo->{blockid_target}->{default}->{$blockid}; + if (!(defined($link) || defined($online_help_links->{$blockid}))) { + die "undefined blockid '$blockid' ($filename, line $line_no)\n" if !$allow_missing; + warn "ignoring undefined blockid '$blockid' ($filename, line $line_no)\n"; } + $res_data->{$blockid} = 1; } } -- 2.47.3