Nicolas Cannasse 16 years ago
parent
commit
f01c5b3415
2 changed files with 23 additions and 22 deletions
  1. 22 0
      std/tools/haxedoc/HtmlPrinter.hx
  2. 1 22
      std/tools/haxedoc/Main.hx

+ 22 - 0
std/tools/haxedoc/HtmlPrinter.hx

@@ -35,6 +35,28 @@ class HtmlPrinter {
 		typeParams = new Array();
 	}
 
+	public function find( t : TypeRoot, path : Array<String>, pos : Int ) {
+		var name = path[pos];
+		var pack = (pos != path.length - 1);
+		var def = null;
+		for( c in t )
+			switch( c ) {
+			case TPackage(pname,_,subs):
+				if( name == pname ) {
+					if( pack )
+						return find(subs,path,pos+1);
+					def = c;
+				}
+			default:
+				if( pack ) continue;
+				var inf = TypeApi.typeInfos(c);
+				if( inf.path.toLowerCase() == path.join(".") )
+					return c;
+			}
+		return def;
+	}
+
+
 	public dynamic function output(str) {
 		neko.Lib.print(str);
 	}

+ 1 - 22
std/tools/haxedoc/Main.hx

@@ -90,27 +90,6 @@ class Main {
 			generateEntry(html,e,"content/");
 	}
 
-	static function findClass( t : TypeRoot, path : Array<String>, pos : Int ) {
-		var name = path[pos];
-		var pack = (pos != path.length - 1);
-		var def = null;
-		for( c in t )
-			switch( c ) {
-			case TPackage(pname,_,subs):
-				if( name == pname ) {
-					if( pack )
-						return findClass(subs,path,pos+1);
-					def = c;
-				}
-			default:
-				if( pack ) continue;
-				var inf = TypeApi.typeInfos(c);
-				if( inf.path.toLowerCase() == path.join(".") )
-					return c;
-			}
-		return def;
-	}
-
 	public static function main() {
 		if( neko.Web.isModNeko ) {
 			var h = neko.Web.getParams();
@@ -138,7 +117,7 @@ class Main {
 				html.process(TPackage("root","root",data));
 			else {
 				var clpath = clname.toLowerCase().split("/").join(".").split(".");
-				var f = findClass(data,clpath,0);
+				var f = html.find(data,clpath,0);
 				if( f == null )
 					throw "Class not found : "+clpath.join(".");
 				html.process(f);