SF.net SVN: geany:[3397] trunk

ntrel at users.sourceforge.net ntrel at xxxxx
Thu Dec 18 16:26:26 UTC 2008


Revision: 3397
          http://geany.svn.sourceforge.net/geany/?rev=3397&view=rev
Author:   ntrel
Date:     2008-12-18 16:26:26 +0000 (Thu, 18 Dec 2008)

Log Message:
-----------
Also parse headings with tags inside header tag.

Modified Paths:
--------------
    trunk/ChangeLog
    trunk/tagmanager/html.c

Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog	2008-12-17 16:28:36 UTC (rev 3396)
+++ trunk/ChangeLog	2008-12-18 16:26:26 UTC (rev 3397)
@@ -1,3 +1,9 @@
+2008-12-18  Nick Treleaven  <nick(dot)treleaven(at)btinternet(dot)com>
+
+ * tagmanager/html.c:
+   Also parse headings with tags inside header tag.
+
+
  2008-12-17  Enrico Tröger  <enrico(dot)troeger(at)uvena(dot)de>
 
  * src/keyfile.c:

Modified: trunk/tagmanager/html.c
===================================================================
--- trunk/tagmanager/html.c	2008-12-17 16:28:36 UTC (rev 3396)
+++ trunk/tagmanager/html.c	2008-12-18 16:26:26 UTC (rev 3397)
@@ -23,16 +23,7 @@
 static void installHtmlRegex (const langType language)
 {
 #define POSSIBLE_ATTRIBUTES "([ \t]+[a-z]+=\"?[^>\"]*\"?)*"
-/* the following matches headings with "<a>" tags inside like
- * <h1><a href="#id109">Some Text</a></h1>
- * but it fails matching simple headings like
- * <h1>Some Text</h1> */
-/*#define INNER_HEADING "[ \t]*<.*>(.+)<.*>[ \t]*"*/
 
-/* this matches simple heading without nested tags */
-/** TODO combine both pattern to be able to match both heading styles */
-#define INNER_HEADING "[ \t]*(.+)[ \t]*"
-
 	addTagRegex (language,
 		"<a"
 		POSSIBLE_ATTRIBUTES
@@ -41,20 +32,29 @@
 		"[ \t]*>",
 		"\\2", "m,member,named anchors", "i");
 
+	addTagRegex (language, "^[ \t]*function[ \t]*([A-Za-z0-9_]+)[ \t]*\\(",
+		"\\1", "f,function,JavaScript functions", NULL);
+
+/* the following matches headings with tags inside like
+ * <h1><a href="#id109"><i>Some Text</i></a></h1>
+ * and
+ * <h1>Some Text</h1> */
+#define SPACES "[ \t]*"
+#define ATTRS "[^>]*"
+#define INNER_HEADING \
+	ATTRS ">" SPACES "(<" ATTRS ">" SPACES ")*([^<]+).*"
+
 	addTagRegex (language,
-		"<h1.*>" INNER_HEADING "</h1>",
-		"\\1", "n,namespace,H1 heading", "i");
+		"<h1" INNER_HEADING "</h1>",
+		"\\2", "n,namespace,H1 heading", "i");
 
 	addTagRegex (language,
-		"<h2.*>" INNER_HEADING "</h2>",
-		"\\1", "c,class,H2 heading", "i");
+		"<h2" INNER_HEADING "</h2>",
+		"\\2", "c,class,H2 heading", "i");
 
 	addTagRegex (language,
-		"<h3.*>" INNER_HEADING "</h3>",
-		"\\1", "v,variable,H3 heading", "i");
-
-	addTagRegex (language, "^[ \t]*function[ \t]*([A-Za-z0-9_]+)[ \t]*\\(",
-		"\\1", "f,function,JavaScript functions", NULL);
+		"<h3" INNER_HEADING "</h3>",
+		"\\2", "v,variable,H3 heading", "i");
 }
 
 /* Create parser definition stucture */


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.



More information about the Commits mailing list