docs/parse-support-md: Break out descr2key

We are going to want to reuse this.  No functional change.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Acked-by: Juergen Gross <jgross@suse.com>
This commit is contained in:
Ian Jackson committed 2018-12-10 15:13:07 +00:00
1 parent 77924ecb0c
commit f0a7739397
1 file changed
+14 -8
+14 -8
View File
@@ -137,6 +137,19 @@ sub parse_feature_entry ($) {
$sectnode->{Status}[$version_index] = $value;
}
sub descr2key ($) {
my ($descr) = @_;
die unless @insections;
my $insection = $insections[$#insections];
my $key = lc $descr;
$key =~ y/ /-/;
$key =~ y/-0-9A-Za-z//cd;
$key = $insection->{Anchor}.'--'.$key;
return $key;
}
sub ri_CodeBlock {
my ($c) = @_;
my ($infos, $text) = @$c;
@@ -164,17 +177,10 @@ sub ri_CodeBlock {
($toplevel and 'top').
"\n$l\n ?");
die unless @insections;
my $insection = $insections[$#insections];
if (length $descr) {
my $key = lc $descr;
$key =~ y/ /-/;
$key =~ y/-0-9A-Za-z//cd;
$key = $insection->{Anchor}.'--'.$key;
push @insections,
{
Key => $key,
Key => descr2key($descr),
Headline => [{ t => 'Str', c => $descr }],
};
}
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.