From: Dan Luedtke <mail@danrl.de>
To: rdunlap@xenotime.net, linux-kernel@vger.kernel.org
Cc: Dan Luedtke <mail@danrl.de>
Subject: [PATCH 3/3] scripts/kernel-doc: added ids to articles for reference
Date: Thu, 26 Jul 2012 08:52:33 +0200 [thread overview]
Message-ID: <1343285553-14275-3-git-send-email-mail@danrl.de> (raw)
In-Reply-To: <1343285553-14275-1-git-send-email-mail@danrl.de>
An id has been added to block-level elements "article". This allows
jumping to a particular article via url. E.g. doc.html#func:foo
would sroll down to the documentation of function foo.
Signed-off-by: Dan Luedtke <mail@danrl.de>
---
scripts/kernel-doc | 30 +++++++++++++++++++++++-------
1 file changed, 23 insertions(+), 7 deletions(-)
diff --git a/scripts/kernel-doc b/scripts/kernel-doc
index 1d3c779..97e037a 100755
--- a/scripts/kernel-doc
+++ b/scripts/kernel-doc
@@ -499,7 +499,7 @@ sub output_highlight {
}
}
-#output sections in html
+# output sections in html
sub output_section_html(%) {
my %args = %{$_[0]};
my $section;
@@ -659,7 +659,7 @@ sub output_blockhead_html(%) {
print "<hr>\n";
}
-#output sections in html5
+# output sections in html5
sub output_section_html5(%) {
my %args = %{$_[0]};
my $section;
@@ -679,7 +679,11 @@ sub output_enum_html5(%) {
my %args = %{$_[0]};
my ($parameter);
my $count;
- print "<article class=\"enum\">\n";
+ my $html5id;
+
+ $html5id = $args{'enum'};
+ $html5id =~ s/[^a-zA-Z0-9\-]+/_/g;
+ print "<article class=\"enum\" id=\"enum:". $html5id . "\">";
print "<h1>enum " . $args{'enum'} . "</h1>\n";
print "<ol class=\"code\">\n";
print "<li>";
@@ -719,8 +723,11 @@ sub output_typedef_html5(%) {
my %args = %{$_[0]};
my ($parameter);
my $count;
+ my $html5id;
- print "<article class=\"typedef\">\n";
+ $html5id = $args{'typedef'};
+ $html5id =~ s/[^a-zA-Z0-9\-]+/_/g;
+ print "<article class=\"typedef\" id=\"typedef:" . $html5id . "\">\n";
print "<h1>typedef " . $args{'typedef'} . "</h1>\n";
print "<ol class=\"code\">\n";
@@ -737,8 +744,11 @@ sub output_typedef_html5(%) {
sub output_struct_html5(%) {
my %args = %{$_[0]};
my ($parameter);
+ my $html5id;
- print "<article class=\"struct\">\n";
+ $html5id = $args{'struct'};
+ $html5id =~ s/[^a-zA-Z0-9\-]+/_/g;
+ print "<article class=\"struct\" id=\"struct:" . $html5id . "\">\n";
print "<hgroup>\n";
print "<h1>" . $args{'type'} . " " . $args{'struct'} . "</h1>";
print "<h2>". $args{'purpose'} . "</h2>\n";
@@ -806,8 +816,11 @@ sub output_function_html5(%) {
my %args = %{$_[0]};
my ($parameter, $section);
my $count;
+ my $html5id;
- print "<article class=\"function\">\n";
+ $html5id = $args{'function'};
+ $html5id =~ s/[^a-zA-Z0-9\-]+/_/g;
+ print "<article class=\"function\" id=\"func:". $html5id . "\">\n";
print "<hgroup>\n";
print "<h1>" . $args{'function'} . "</h1>";
print "<h2>" . $args{'purpose'} . "</h2>\n";
@@ -865,9 +878,12 @@ sub output_blockhead_html5(%) {
my %args = %{$_[0]};
my ($parameter, $section);
my $count;
+ my $html5id;
foreach $section (@{$args{'sectionlist'}}) {
- print "<article class=\"doc\">\n";
+ $html5id = $section;
+ $html5id =~ s/[^a-zA-Z0-9\-]+/_/g;
+ print "<article class=\"doc\" id=\"doc:". $html5id . "\">\n";
print "<h1>$section</h1>\n";
print "<p>\n";
output_highlight($args{'sections'}{$section});
--
1.7.10
next prev parent reply other threads:[~2012-07-26 6:53 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-07-25 13:38 [PATCH] scripts/kernel-doc: added support for html5 Dan Luedtke
2012-07-25 13:50 ` FYI: Example [Re: [PATCH] scripts/kernel-doc: added support for html5] Dan Luedtke
2012-07-25 18:14 ` [PATCH] scripts/kernel-doc: added support for html5 Randy Dunlap
2012-07-26 6:52 ` [PATCH 1/3] " Dan Luedtke
2012-07-26 6:52 ` [PATCH 2/3] scripts/kernel-doc: modern html -> html version 5 Dan Luedtke
2012-07-26 6:52 ` Dan Luedtke [this message]
2012-07-26 6:53 ` [PATCH] scripts/kernel-doc: added support for html5 Dan Luedtke
2012-07-26 15:13 ` Randy Dunlap
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1343285553-14275-3-git-send-email-mail@danrl.de \
--to=mail@danrl.de \
--cc=linux-kernel@vger.kernel.org \
--cc=rdunlap@xenotime.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox