documentor: (#1061) Linking to template classes and template parameter classes
authorJerome St-Louis <jerome@ecere.com>
Thu, 6 Feb 2014 22:20:56 +0000 (05:20 +0700)
committerJerome St-Louis <jerome@ecere.com>
Thu, 6 Feb 2014 23:06:11 +0000 (06:06 +0700)
doc/ecere.eCdoc
documentor/src/Documentor.ec
extras/html/htmlParser.ec

index b49e7bb..1bf43ef 100644 (file)
Binary files a/doc/ecere.eCdoc and b/doc/ecere.eCdoc differ
index f6b0401..0b6bc70 100644 (file)
@@ -54,6 +54,57 @@ IDESettingsContainer settingsContainer
    dataOwner = &settings;
 };
 
+void GetTemplateString(Class c, char * templateString)
+{
+   Module m = c.module.application;
+   char * n = c.name;
+   char * lt = strchr(n, '<');
+   char * s;
+   char ch;
+   char curName[256];
+   int len = 0;
+
+   memcpy(templateString, n, lt-n);
+   templateString[lt-n] = 0;
+   strcat(templateString, "</a>");
+
+   for(s = lt; (ch = *s); s++)
+   {
+      if(ch == '<' || ch == '>' || ch == ',')
+      {
+         if(len)
+         {
+            Class pc;
+            char * d = templateString + strlen(templateString);
+            curName[len] = 0;
+            pc = eSystem_FindClass(m, curName);
+            if(pc)
+               sprintf(d, "<a href=\"api://%p\" style=\"text-decoration: none;\">%s</a>", pc, pc.name);
+            else
+               strcat(d, curName);
+         }
+         if(ch == '<')
+            strcat(templateString, "&lt;");
+         else if(ch == '>')
+            strcat(templateString, "&gt;");
+         else
+            strcat(templateString, ", ");
+         len = 0;
+      }
+      else if(ch == '=')
+      {
+         curName[len++] = ' ';
+         curName[len++] = ch;
+         curName[len++] = ' ';
+         curName[0] = 0;
+         strcat(templateString, curName);
+         len = 0;
+      }
+      else if(ch != ' ')
+         curName[len++] = ch;
+   }
+}
+
 // WARNING : This function expects a null terminated string since it recursively concatenate...
 static void _PrintType(Type type, char * string, bool printName, bool printFunction, bool fullName)
 {
@@ -71,11 +122,19 @@ static void _PrintType(Type type, char * string, bool printName, bool printFunct
                   if(type._class.registered)
                   {
                      char hex[20];
-                     sprintf(hex, "%p", type._class.registered);
+                     char * s = type._class.registered.name;
+                     sprintf(hex, "%p", type._class.registered.templateClass ? type._class.registered.templateClass : type._class.registered);
                      strcat(string, "<a href=\"api://");
                      strcat(string, hex);
                      strcat(string, "\" style=\"text-decoration: none;\">");
-                     strcat(string, type._class.registered.name);
+                     if(strchr(s, '<'))
+                     {
+                        char n[1024];
+                        GetTemplateString(type._class.registered, n);
+                        strcat(string, n);
+                     }
+                     else
+                        strcat(string, type._class.registered.name);
                      strcat(string, "</a>");
                   }
                   else
index 19b96bd..7c41f7f 100644 (file)
@@ -1134,6 +1134,8 @@ class HTMLFile
                         unicode = ' ';
                      else if(!strcmpi(symbol, "copy"))
                         unicode ='©';
+                     else if(!strcmpi(symbol, "reg"))
+                        unicode = '®';
                      else if(!strcmpi(symbol, "raquo"))
                         unicode = '»';
                      else if(!strcmpi(symbol, "eacute"))
@@ -1148,6 +1150,20 @@ class HTMLFile
                         unicode = 'â';
                      else if(!strcmpi(symbol, "ocirc"))
                         unicode = 'ô';
+                     else if(!strcmpi(symbol, "lt"))
+                        unicode = '<';
+                     else if(!strcmpi(symbol, "gt"))
+                        unicode = '>';
+                     else if(!strcmpi(symbol, "amp"))
+                        unicode = '&';
+                     else if(!strcmpi(symbol, "euro"))
+                        unicode = '€';
+                     else if(!strcmpi(symbol, "yen"))
+                        unicode = '¥';
+                     else if(!strcmpi(symbol, "pound"))
+                        unicode = '£';
+                     else if(!strcmpi(symbol, "cent"))
+                        unicode = '¢';
                      if(unicode)
                      {
                         int len = UTF32toUTF8Len(&unicode, 1, utf8, 5);