[gtk-doc] fixxref: move more code from global scope into functions
- From: Stefan Kost <stefkost src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk-doc] fixxref: move more code from global scope into functions
- Date: Tue, 16 Jun 2015 08:10:09 +0000 (UTC)
commit 11427f7a5043130726b8b9c7174f5a225c0192f4
Author: Stefan Sauer <ensonic users sf net>
Date: Mon Jun 15 18:44:28 2015 +0200
fixxref: move more code from global scope into functions
gtkdoc-fixxref.in | 77 ++++++++++++++++++++++++++++++----------------------
1 files changed, 44 insertions(+), 33 deletions(-)
---
diff --git a/gtkdoc-fixxref.in b/gtkdoc-fixxref.in
index 774970c..fcc0e3d 100755
--- a/gtkdoc-fixxref.in
+++ b/gtkdoc-fixxref.in
@@ -49,6 +49,7 @@ my %optctl = ('module' => \$MODULE,
'version' => \$PRINT_VERSION,
'help' => \$PRINT_HELP,
'src-lang' => \$SRC_LANG);
+
GetOptions(\%optctl, "module=s", "module-dir=s", "html-dir:s", "extra-dir=s@",
"src-lang=s", "version", "help");
@@ -172,41 +173,11 @@ foreach my $dir (@EXTRA_DIRS) {
}
}
-if (defined($MODULE)) {
- open (INPUT, "$MODULE-sections.txt")
- || die "Can't open $MODULE-sections.txt: $!";
- my $subsection = "";
- while (<INPUT>) {
- if (m/^#/) {
- next;
-
- } elsif (m/^<SECTION>/) {
- $subsection = "";
- } elsif (m/^<SUBSECTION\s*(.*)>/i) {
- $subsection = $1;
- } elsif (m/^<SUBSECTION>/) {
- next;
- } elsif (m/^<TITLE>(.*)<\/TITLE>/) {
- next;
- } elsif (m/^<FILE>(.*)<\/FILE>/) {
- next;
- } elsif (m/^<INCLUDE>(.*)<\/INCLUDE>/) {
- next;
- } elsif (m/^<\/SECTION>/) {
- next;
- } elsif (m/^(\S+)/) {
- my $symbol=CreateValidSGMLID($1);
-
- if ($subsection eq "Standard" || $subsection eq "Private") {
- $NoLinks{$symbol} = 1;
- }
- }
- }
- close (INPUT);
-}
+&ReadSections ();
&FixCrossReferences ($MODULE_DIR);
+
sub ScanIndices {
my ($scan_dir, $use_absolute_links) = @_;
@@ -237,6 +208,7 @@ sub ScanIndices {
}
}
+
sub ScanIndex {
my ($file, $use_absolute_links) = @_;
@@ -268,6 +240,44 @@ sub ScanIndex {
}
+sub ReadSections {
+ if (!defined($MODULE)) {
+ return;
+ }
+
+ open (INPUT, "$MODULE-sections.txt")
+ || die "Can't open $MODULE-sections.txt: $!";
+ my $subsection = "";
+ while (<INPUT>) {
+ if (m/^#/) {
+ next;
+
+ } elsif (m/^<SECTION>/) {
+ $subsection = "";
+ } elsif (m/^<SUBSECTION\s*(.*)>/i) {
+ $subsection = $1;
+ } elsif (m/^<SUBSECTION>/) {
+ next;
+ } elsif (m/^<TITLE>(.*)<\/TITLE>/) {
+ next;
+ } elsif (m/^<FILE>(.*)<\/FILE>/) {
+ next;
+ } elsif (m/^<INCLUDE>(.*)<\/INCLUDE>/) {
+ next;
+ } elsif (m/^<\/SECTION>/) {
+ next;
+ } elsif (m/^(\S+)/) {
+ my $symbol=$1;
+
+ if ($subsection eq "Standard" || $subsection eq "Private") {
+ $NoLinks{CreateValidSGMLID($symbol)} = 1;
+ }
+ }
+ }
+ close (INPUT);
+}
+
+
sub FixCrossReferences {
my ($scan_dir) = @_;
@@ -455,6 +465,7 @@ sub HighlightSource {
return &HighlightSourcePostprocess($type, $highlighted_source);
}
+
sub HighlightSourceVim {
my ($type, $source) = @_;
@@ -507,6 +518,7 @@ sub HighlightSourceVim {
return &HighlightSourcePostprocess($type, $highlighted_source);
}
+
sub HighlightSourcePostprocess {
my ($type, $highlighted_source) = @_;
@@ -538,4 +550,3 @@ sub HighlightSourcePostprocess {
</div>
END_OF_HTML
}
-
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]