SF.net SVN: geany-plugins:[1592] trunk/geany-plugins/geanygendoc

colombanw at users.sourceforge.net colombanw at xxxxx
Sat Sep 18 01:00:29 UTC 2010


Revision: 1592
          http://geany-plugins.svn.sourceforge.net/geany-plugins/?rev=1592&view=rev
Author:   colombanw
Date:     2010-09-18 01:00:29 +0000 (Sat, 18 Sep 2010)

Log Message:
-----------
GeanyGenDoc: Add policy PASS to completely ignore a symbol

This is useful e.g. to fix some annoyances of some tag parser that
extracts for example all the variables even inside functions (such as
the PHP one), which clutters the symbol list and then makes many
documentation requests to fail simply because they matched a variable
and not the enclosing function.

Modified Paths:
--------------
    trunk/geany-plugins/geanygendoc/docs/manual.html
    trunk/geany-plugins/geanygendoc/docs/manual.rst
    trunk/geany-plugins/geanygendoc/src/ggd-doc-setting.c
    trunk/geany-plugins/geanygendoc/src/ggd-doc-setting.h
    trunk/geany-plugins/geanygendoc/src/ggd-doc-type.c
    trunk/geany-plugins/geanygendoc/src/ggd.c

Modified: trunk/geany-plugins/geanygendoc/docs/manual.html
===================================================================
--- trunk/geany-plugins/geanygendoc/docs/manual.html	2010-09-17 20:05:28 UTC (rev 1591)
+++ trunk/geany-plugins/geanygendoc/docs/manual.html	2010-09-18 01:00:29 UTC (rev 1592)
@@ -506,6 +506,11 @@
 <dt><tt class="docutils literal">FORWARD</tt></dt>
 <dd>Forward the documentation request to the parent. This is useful for symbols
 that are documented by their parent, such as <a class="reference external" href="http://www.gtk.org/gtk-doc/">Gtk-Doc</a>'s enumerations.</dd>
+<dt><tt class="docutils literal">PASS</tt></dt>
+<dd>Completely ignore the symbol and handle the documentation request as if it
+hasn't existed at all. This can be useful to ignore e.g. variables if
+if they are extracted by the tag manager of the language, and you won't
+document them and don't want them to "eat" the documentation request.</dd>
 </dl>
 </dd>
 <dt><tt class="docutils literal">children</tt> (enumeration)</dt>
@@ -554,7 +559,7 @@
 <h2><a class="toc-backref" href="#id28">License</a></h2>
 <div class="line-block">
 <div class="line">GeanyGenDoc, a Geany plugin to ease generation of source code documentation</div>
-<div class="line">Copyright (C) 2010  Colomban Wendling <<a class="reference external" href="mailto:ban@herbesfolles.org">ban@herbesfolles.org</a>></div>
+<div class="line">Copyright (C) 2010  Colomban Wendling <ban(at)herbesfolles(dot)org></div>
 </div>
 <p>This program is free software: you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
@@ -622,7 +627,7 @@
 </div>
 <div class="footer">
 <hr class="footer" />
-Generated on: 2010-08-16.
+Generated on: 2010-09-18.
 
 </div>
 </body>

Modified: trunk/geany-plugins/geanygendoc/docs/manual.rst
===================================================================
--- trunk/geany-plugins/geanygendoc/docs/manual.rst	2010-09-17 20:05:28 UTC (rev 1591)
+++ trunk/geany-plugins/geanygendoc/docs/manual.rst	2010-09-18 01:00:29 UTC (rev 1592)
@@ -426,6 +426,12 @@
   ``FORWARD``
     Forward the documentation request to the parent. This is useful for symbols
     that are documented by their parent, such as `Gtk-Doc`_'s enumerations.
+  
+  ``PASS``
+    Completely ignore the symbol and handle the documentation request as if it
+    hasn't existed at all. This can be useful to ignore e.g. variables if
+    if they are extracted by the tag manager of the language, and you won't
+    document them and don't want them to "eat" the documentation request.
 
 ``children`` (enumeration)
   How the symbol's children can be used in the template. Possible values are:

Modified: trunk/geany-plugins/geanygendoc/src/ggd-doc-setting.c
===================================================================
--- trunk/geany-plugins/geanygendoc/src/ggd-doc-setting.c	2010-09-17 20:05:28 UTC (rev 1591)
+++ trunk/geany-plugins/geanygendoc/src/ggd-doc-setting.c	2010-09-18 01:00:29 UTC (rev 1592)
@@ -201,7 +201,8 @@
     GgdPolicy     policy;
   } policies[] = {
     { "KEEP",       GGD_POLICY_KEEP },
-    { "FORWARD",    GGD_POLICY_FORWARD }/*,
+    { "FORWARD",    GGD_POLICY_FORWARD },
+    { "PASS",       GGD_POLICY_PASS }/*,
     { "DUPLICATE",  GGD_POLICY_DUPLICATE }*/
   };
   guint i;

Modified: trunk/geany-plugins/geanygendoc/src/ggd-doc-setting.h
===================================================================
--- trunk/geany-plugins/geanygendoc/src/ggd-doc-setting.h	2010-09-17 20:05:28 UTC (rev 1591)
+++ trunk/geany-plugins/geanygendoc/src/ggd-doc-setting.h	2010-09-18 01:00:29 UTC (rev 1592)
@@ -51,13 +51,15 @@
  * _GgdPolicy:
  * @GGD_POLICY_KEEP: Document the symbol
  * @GGD_POLICY_FORWARD: Forward the documentation request to the parent symbol
+ * @GGD_POLICY_PASS: Ignore the symbol, do as if it didn't exist
  * 
  * Possible policies for documenting symbols.
  */
 typedef enum _GgdPolicy
 {
   GGD_POLICY_KEEP,
-  GGD_POLICY_FORWARD/*,
+  GGD_POLICY_FORWARD,
+  GGD_POLICY_PASS/*,
   GGD_POLICY_DUPLICATE*/
 } GgdPolicy;
 

Modified: trunk/geany-plugins/geanygendoc/src/ggd-doc-type.c
===================================================================
--- trunk/geany-plugins/geanygendoc/src/ggd-doc-type.c	2010-09-17 20:05:28 UTC (rev 1591)
+++ trunk/geany-plugins/geanygendoc/src/ggd-doc-type.c	2010-09-18 01:00:29 UTC (rev 1592)
@@ -157,13 +157,13 @@
  * ggd_doc_type_resolve_setting:
  * @doctype: A #GgdDocType
  * @match: A match "pattern"
- * @nth_child: return location for the number of redirections to go to the final
+ * @nth_child: return location for the number of redirection to go to the final
  *             match
  * 
- * Resolve the setting that should be applied fo match @match. This is similar
- * to ggd_doc_type_get_setting() but applies the policy too (e.g. if @match
- * matches a setting of which the policy is FORWARD, this function will try to
- * resolve the parent and return it, and so on).
+ * Resolve the setting that should be applied of match @match. This is similar
+ * to ggd_doc_type_get_setting() but applies FORWARD policies too (e.g. if
+ * @match matches a setting of which the policy is FORWARD, this function will
+ * try to resolve the parent and return it, and so on).
  * 
  * Returns: the matching #GgdDocSetting or %NULL if none matches.
  */
@@ -181,7 +181,7 @@
   /*g_debug ("Resolving match \"%s\"...", child_match);*/
   if (nth_child) (*nth_child) = 0;
   setting = ggd_doc_type_get_setting (doctype, child_match);
-  while (setting && setting->policy != GGD_POLICY_KEEP) {
+  while (setting && setting->policy == GGD_POLICY_FORWARD) {
     gchar *parent_match = get_parent_match (child_match);
     
     if (nth_child) (*nth_child)++;

Modified: trunk/geany-plugins/geanygendoc/src/ggd.c
===================================================================
--- trunk/geany-plugins/geanygendoc/src/ggd.c	2010-09-17 20:05:28 UTC (rev 1591)
+++ trunk/geany-plugins/geanygendoc/src/ggd.c	2010-09-18 01:00:29 UTC (rev 1592)
@@ -519,6 +519,8 @@
   
   g_return_val_if_fail (DOC_VALID (doc), FALSE);
   
+ again:
+  
   if (doc->tm_file) {
     tag_array = doc->tm_file->tags_array;
     tag = ggd_tag_find_from_line (tag_array, line + 1 /* it is a SCI line */);
@@ -531,6 +533,12 @@
       GList          *tag_list = NULL;
       
       setting = get_setting_from_tag (doctype, doc, tag, &tag);
+      if (setting && setting->policy == GGD_POLICY_PASS) {
+        /* We want to completely skip this tag, so try previous line instead
+         * FIXME: this implementation is kinda ugly... */
+        line--;
+        goto again;
+      }
       if (setting && setting->autodoc_children) {
         tag_list = ggd_tag_find_children_filtered (tag_array, tag,
                                                    FILETYPE_ID (doc->file_type),


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



More information about the Plugins-Commits mailing list