[pve-devel] [PATCH docs v2 2/2] asciidoc-pve: ignore anchor names in curly braces

Stefan Sterz s.sterz at proxmox.com
Mon Nov 14 09:26:40 CET 2022


On 11/11/22 19:22, Thomas Lamprecht wrote:
> Am 11/11/2022 um 16:05 schrieb Stefan Sterz:
>> previously the scanner would detect some `onlineHelp` keys that are
>> set via CBind as anchor names. this would cause it to fail, as they
>> cannot be present anywhere in the documentation. no valid anchor name
>> can be wrapped in curly braces, as they need to be valid xml names.
>> hence it should be safe to just ignore all keys wrapped in curly
>> braces.
>>
>> Signed-off-by: Stefan Sterz <s.sterz at proxmox.com>
>> ---
>>  asciidoc-pve.in | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/asciidoc-pve.in b/asciidoc-pve.in
>> index d638a38..c536371 100644
>> --- a/asciidoc-pve.in
>> +++ b/asciidoc-pve.in
>> @@ -465,7 +465,7 @@ sub scan_extjs_file {
>>      debug("scan-extjs $filename");
>>  
>>      while(defined(my $line = <$fh>)) {
>> -	if ($line =~ m/\s+onlineHelp:\s*[\'\"](.*?)[\'\"]/) {
>> +	if ($line =~ m/\s+onlineHelp:\s*[\'\"]([^{].*?[^}])[\'\"]/) {
> 
> IIUC this indirectly raised the minimum length of references to two characters,
> not a deal breaker IMO as I don't really expect two characters to be used anytime
> soon (maybe with unicode 🤔🧠💭 x)), but maybe hint it in the commit message.
> 

yes that is correct. just to have made the suggestion: the "[^}]" could
be dropped here. that should get us back down to one character, but will
also filter the necessary keys. and anchors like "{key" are just as
invalid as "{key}" in asciidoc.

>>  	    my $blockid = $1;
>>  	    my $link = $fileinfo->{blockid_target}->{default}->{$blockid};
>>  	    die "undefined blockid '$blockid' ($filename, line $.)\n"
> 





More information about the pve-devel mailing list