[gtk-doc] common: move CreateValidSGMLID to common
- From: Stefan Kost <stefkost src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gtk-doc] common: move CreateValidSGMLID to common
- Date: Wed, 25 Nov 2009 10:27:22 +0000 (UTC)
commit f44066988964f964bba015db382a70d9d899bce1
Author: Stefan Kost <ensonic users sf net>
Date: Wed Nov 25 11:03:17 2009 +0200
common: move CreateValidSGMLID to common
gtkdoc-common.pl.in | 35 +++++++++++++++++++++++++++++++++++
gtkdoc-fixxref.in | 29 +++--------------------------
gtkdoc-mkdb.in | 33 ---------------------------------
3 files changed, 38 insertions(+), 59 deletions(-)
---
diff --git a/gtkdoc-common.pl.in b/gtkdoc-common.pl.in
index ea6dd34..2d6d75a 100644
--- a/gtkdoc-common.pl.in
+++ b/gtkdoc-common.pl.in
@@ -313,6 +313,7 @@ sub ParseEnumDeclaration {
return @result;
}
+
#############################################################################
# Function : LogWarning
# Description : Log a warning in gcc style format
@@ -320,6 +321,7 @@ sub ParseEnumDeclaration {
# $line - line number for the wrong entry
# $message - description of the issue
#############################################################################
+
sub LogWarning {
my ($file, $line, $message) = @_;
@@ -329,3 +331,36 @@ sub LogWarning {
print "$file:$line: warning: $message\n"
}
+
+#############################################################################
+# Function : CreateValidSGMLID
+# Description : Creates a valid SGML 'id' from the given string.
+# According to http://www.w3.org/TR/html4/types.html#type-id
+# "ID and NAME tokens must begin with a letter ([A-Za-z]) and
+# may be followed by any number of letters, digits ([0-9]),
+# hyphens ("-"), underscores ("_"), colons (":"), and
+# periods (".")."
+#
+# NOTE: SGML ids are case-insensitive, so we have a few special
+# cases to avoid clashes of ids.
+# Arguments : $id - the string to be converted into a valid SGML id.
+#############################################################################
+
+sub CreateValidSGMLID {
+ my ($id) = $_[0];
+
+ # Special case, '_' would end up as '' so we use 'gettext-macro' instead.
+ if ($id eq "_") { return "gettext-macro"; }
+
+ $id =~ s/[_ ]/-/g;
+ $id =~ s/[,;]//g;
+ $id =~ s/^-*//;
+ $id =~ s/::/-/g;
+ $id =~ s/:/--/g;
+
+ # Append ":CAPS" to all all-caps identifiers
+ if ($id !~ /[a-z]/ && $id !~ /-CAPS$/) { $id .= ":CAPS" };
+
+ return $id;
+}
+
diff --git a/gtkdoc-fixxref.in b/gtkdoc-fixxref.in
index 8e9e406..90727a9 100755
--- a/gtkdoc-fixxref.in
+++ b/gtkdoc-fixxref.in
@@ -28,6 +28,9 @@ use strict;
use bytes;
use Getopt::Long;
+unshift @INC, '@PACKAGE_DATA_DIR@';
+require "gtkdoc-common.pl";
+
# Options
# name of documentation module
@@ -425,29 +428,3 @@ sub HighlightSourcePostprocess {
END_OF_HTML
}
-
-#############################################################################
-# Function : CreateValidSGMLID
-# Description : Creates a valid SGML 'id' from the given string.
-# NOTE: SGML ids are case-insensitive, so we have a few special
-# cases to avoid clashes of ids.
-# Arguments : $id - the string to be converted into a valid SGML id.
-#############################################################################
-
-sub CreateValidSGMLID {
- my ($id) = $_[0];
-
- # Special case, '_' would end up as '' so we use 'gettext-macro' instead.
- if ($id eq "_") { return "gettext-macro"; }
-
- $id =~ s/[_ ]/-/g;
- $id =~ s/[,\.]//g;
- $id =~ s/^-*//;
- $id =~ s/::/-/g;
- $id =~ s/:/--/g;
-
- # Append ":CAPS" to all all-caps identifiers
- if ($id !~ /[a-z]/ && $id !~ /-CAPS$/) { $id .= ":CAPS" };
-
- return $id;
-}
diff --git a/gtkdoc-mkdb.in b/gtkdoc-mkdb.in
index 27408eb..132f115 100755
--- a/gtkdoc-mkdb.in
+++ b/gtkdoc-mkdb.in
@@ -2218,39 +2218,6 @@ EOF
#############################################################################
-# Function : CreateValidSGMLID
-# Description : Creates a valid SGML 'id' from the given string.
-# According to http://www.w3.org/TR/html4/types.html#type-id
-# "ID and NAME tokens must begin with a letter ([A-Za-z]) and
-# may be followed by any number of letters, digits ([0-9]),
-# hyphens ("-"), underscores ("_"), colons (":"), and
-# periods (".")."
-#
-# NOTE: SGML ids are case-insensitive, so we have a few special
-# cases to avoid clashes of ids.
-# Arguments : $id - the string to be converted into a valid SGML id.
-#############################################################################
-
-sub CreateValidSGMLID {
- my ($id) = $_[0];
-
- # Special case, '_' would end up as '' so we use 'gettext-macro' instead.
- if ($id eq "_") { return "gettext-macro"; }
-
- $id =~ s/[_ ]/-/g;
- $id =~ s/[,;]//g;
- $id =~ s/^-*//;
- $id =~ s/::/-/g;
- $id =~ s/:/--/g;
-
- # Append ":CAPS" to all all-caps identifiers
- if ($id !~ /[a-z]/ && $id !~ /-CAPS$/) { $id .= ":CAPS" };
-
- return $id;
-}
-
-
-#############################################################################
# Function : CreateValidSGML
# Description : This turns any chars which are used in SGML into entities,
# e.g. '<' into '<'
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]