Browse Source

htmldoc fixes

Nicolas Cannasse 18 years ago
parent
commit
ca18e0f02c
6 changed files with 77 additions and 74 deletions
  1. 5 4
      std/mtwin/net/Ftp.hx
  2. 24 23
      std/mtwin/text/Diff.hx
  3. 40 38
      std/mtwin/text/Text2Xhtml.hx
  4. 2 1
      std/mtwin/web/Handler.hx
  5. 1 1
      std/neko/Web.hx
  6. 5 7
      std/neko/vm/Loader.hx

+ 5 - 4
std/mtwin/net/Ftp.hx

@@ -29,9 +29,9 @@ import neko.net.Socket;
 import neko.net.Host;
 import neko.net.Host;
 
 
 /**
 /**
-	Handles FTP protocol.	
+	Handles FTP protocol.
 
 
-	Example:
+	Example: [
 
 
 		var ftp = new Ftp("my.ftp.com", 21);
 		var ftp = new Ftp("my.ftp.com", 21);
 		ftp.login("myuser", "mypass");
 		ftp.login("myuser", "mypass");
@@ -47,6 +47,7 @@ import neko.net.Host;
 		fp.close();
 		fp.close();
 
 
 		ftp.close();
 		ftp.close();
+	]
 **/
 **/
 class Ftp {
 class Ftp {
 
 
@@ -200,7 +201,7 @@ class Ftp {
 		voidResponse();
 		voidResponse();
 	}
 	}
 
 
-	/** 
+	/**
 		Downloads remote file and write its content in output using neko.io.Output.writeBytes()
 		Downloads remote file and write its content in output using neko.io.Output.writeBytes()
 	**/
 	**/
 	public function get( output:neko.io.Output, remoteFileName:String, ?bufSize:Int ){
 	public function get( output:neko.io.Output, remoteFileName:String, ?bufSize:Int ){
@@ -380,7 +381,7 @@ class Ftp {
 				cb(buf, rdd);
 				cb(buf, rdd);
 			}
 			}
 			catch (eof:Eof){
 			catch (eof:Eof){
-				rdd = 0;		
+				rdd = 0;
 			}
 			}
 			if (rdd < bufSize)
 			if (rdd < bufSize)
 				break;
 				break;

+ 24 - 23
std/mtwin/text/Diff.hx

@@ -32,11 +32,12 @@ typedef LcsMatrix = Array<Array<Int>>
 
 
 	The diff text format is the same as the gnu diff utility format.
 	The diff text format is the same as the gnu diff utility format.
 
 
-	Usage:
-
+	Usage: [
 	var myDiff = Diff.diff(sourceString, modifiedString);
 	var myDiff = Diff.diff(sourceString, modifiedString);
 	var modified = Diff.patch(sourceString, myDiff); // modified == modifiedString
 	var modified = Diff.patch(sourceString, myDiff); // modified == modifiedString
 	var origin = Diff.unpatch(modified, myDiff); // origin == sourceString
 	var origin = Diff.unpatch(modified, myDiff); // origin == sourceString
+	]
+
 **/
 **/
 class Diff {
 class Diff {
 
 
@@ -47,17 +48,17 @@ class Diff {
 	static var NO_NEW_LINE = "\n\\ No newline at end of file\n";
 	static var NO_NEW_LINE = "\n\\ No newline at end of file\n";
 
 
 	/**
 	/**
-		This class uses a longest common subsequence algorithm which computes the distance between 
+		This class uses a longest common subsequence algorithm which computes the distance between
 		two array of strings and creates an optimal modification cursor.
 		two array of strings and creates an optimal modification cursor.
 
 
 		The cursor is stored in a int matrix and starts at index 0:0.
 		The cursor is stored in a int matrix and starts at index 0:0.
 
 
-		The matrix is filled of END, DOWN, DOWN_RIGHT, RIGHT movements.
+		The matrix is filled of [END], [DOWN], [DOWN_RIGHT], [RIGHT] movements.
 
 
-		DOWN => the src line must be removed
-		DOWN_RIGHT => lines are equals, no operation required
-		RIGHT => the dst line must be inserted
-		END => end of files reached, if END is reached before [m,n], some lines must be removed or inserted 
+		[DOWN] => the src line must be removed
+		[DOWN_RIGHT] => lines are equals, no operation required
+		[RIGHT] => the dst line must be inserted
+		[END] => end of files reached, if END is reached before [m,n], some lines must be removed or inserted
 	**/
 	**/
 	static function longestCommonSubsequence( src:Array<String>, dst:Array<String> ) : LcsMatrix {
 	static function longestCommonSubsequence( src:Array<String>, dst:Array<String> ) : LcsMatrix {
 		var m = src.length;
 		var m = src.length;
@@ -65,13 +66,13 @@ class Diff {
 		var cursor = new Array();
 		var cursor = new Array();
 		var c = new Array();
 		var c = new Array();
 		for (i in 0...m+1) {
 		for (i in 0...m+1) {
-			cursor[i] = new Array(); 
+			cursor[i] = new Array();
 			cursor[i][n] = 0;
 			cursor[i][n] = 0;
-			c[i] = new Array(); 
-			c[i][n] = 0; 
+			c[i] = new Array();
+			c[i][n] = 0;
 		}
 		}
 		for (j in 0...n+1) {
 		for (j in 0...n+1) {
-			cursor[m][j] = 0; 
+			cursor[m][j] = 0;
 			c[m][j] = 0;
 			c[m][j] = 0;
 		}
 		}
 		var i = m-1;
 		var i = m-1;
@@ -112,12 +113,12 @@ class Diff {
 		while (true){
 		while (true){
 			// direction changes, store this position
 			// direction changes, store this position
 			if (c[i][j] != prev)
 			if (c[i][j] != prev)
-				stack.add([i,j]); 
+				stack.add([i,j]);
 			prev = c[i][j];
 			prev = c[i][j];
 			switch (c[i][j]){
 			switch (c[i][j]){
 				case DOWN: i++;
 				case DOWN: i++;
 				case RIGHT: j++;
 				case RIGHT: j++;
-				case DOWN_RIGHT: i++; j++; 
+				case DOWN_RIGHT: i++; j++;
 				case END: break;
 				case END: break;
 				default: throw "Unknown "+c[i][j]+" at "+i+":"+j; i=0; j=0;
 				default: throw "Unknown "+c[i][j]+" at "+i+":"+j; i=0; j=0;
 			}
 			}
@@ -144,7 +145,7 @@ class Diff {
 		The returned string may be used by the gnu diff/patch utilities.
 		The returned string may be used by the gnu diff/patch utilities.
 	**/
 	**/
 	public static function diff( source:String, dest:String ) : String {
 	public static function diff( source:String, dest:String ) : String {
-		var srcNoNewLine = false;		
+		var srcNoNewLine = false;
 		var dstNoNewLine = false;
 		var dstNoNewLine = false;
 
 
 		var sourceLines = split(source); // source.split("\n");
 		var sourceLines = split(source); // source.split("\n");
@@ -153,7 +154,7 @@ class Diff {
 			sourceLines.push("");
 			sourceLines.push("");
 			srcNoNewLine = true;
 			srcNoNewLine = true;
 		}
 		}
-		
+
 		var destLines = split(dest); // dest.split("\n");
 		var destLines = split(dest); // dest.split("\n");
 		if (destLines[destLines.length-1].length > 0){
 		if (destLines[destLines.length-1].length > 0){
 			// no newline at end of file
 			// no newline at end of file
@@ -163,22 +164,22 @@ class Diff {
 
 
 		var m = sourceLines.length;
 		var m = sourceLines.length;
 		var n = destLines.length;
 		var n = destLines.length;
-		
+
 		var lcs = longestCommonSubsequence(sourceLines, destLines);
 		var lcs = longestCommonSubsequence(sourceLines, destLines);
 		var stack = lcsToStack(lcs);
 		var stack = lcsToStack(lcs);
 
 
 		var cursorKind = function(p){
 		var cursorKind = function(p){
-			return lcs[p[0]][p[1]]; 
+			return lcs[p[0]][p[1]];
 		}
 		}
 
 
 		var operationAdd = function(after:Int, from:Int, to:Int){
 		var operationAdd = function(after:Int, from:Int, to:Int){
 			var op = new StringBuf();
 			var op = new StringBuf();
-			op.add(after); 
-			op.add("a"); 
+			op.add(after);
+			op.add("a");
 			if (from == to) op.add(from) else { op.add(from); op.add(","); op.add(to); }
 			if (from == to) op.add(from) else { op.add(from); op.add(","); op.add(to); }
 			op.add("\n");
 			op.add("\n");
 			for (i in (from-1)...to){
 			for (i in (from-1)...to){
-				op.add("> "); 
+				op.add("> ");
 				op.add(destLines[i]);
 				op.add(destLines[i]);
 				if (dstNoNewLine && i == (destLines.length-2)){
 				if (dstNoNewLine && i == (destLines.length-2)){
 					op.add(NO_NEW_LINE);
 					op.add(NO_NEW_LINE);
@@ -236,8 +237,8 @@ class Diff {
 				case DOWN_RIGHT:
 				case DOWN_RIGHT:
 
 
 				case DOWN:
 				case DOWN:
-					var end = stack.pop(); 
-					if (cursorKind(end) == RIGHT){	
+					var end = stack.pop();
+					if (cursorKind(end) == RIGHT){
 						var del = stack.pop(); stack.push(del);
 						var del = stack.pop(); stack.push(del);
 						result.add(operationUpd(pos[0]+1, end[0], pos[1]+1, del[1]));
 						result.add(operationUpd(pos[0]+1, end[0], pos[1]+1, del[1]));
 					}
 					}

+ 40 - 38
std/mtwin/text/Text2Xhtml.hx

@@ -29,26 +29,26 @@ import haxe.Md5;
 /**
 /**
 	Transform a plain text document into an XHTML document.
 	Transform a plain text document into an XHTML document.
 
 
-	h1 : at least 4 * after the title
-	****
+	[h1 : at least 4 * after the title]
+	[****]
 
 
 	or
 	or
 
 
-	*** h1 : line starts with 3 *
+	[*** h1 : line starts with 3 *]
 
 
-	h2 : at least 4 = after the title
-	====
+	[h2 : at least 4 = after the title]
+	[====]
 
 
 	or
 	or
 
 
-	=== h2 : line starts with 3 =
+	[=== h2 : line starts with 3 =]
 
 
-	h3 : at least 4 - after the title
-	----
-	
-	or 
+	[h3 : at least 4 - after the title]
+	[----]
+
+	or
 
 
-	--- h3 : line starts with 3 -
+	[--- h3 : line starts with 3 -]
 
 
 
 
 	You may specify titles' ids using #myid# before your title text :
 	You may specify titles' ids using #myid# before your title text :
@@ -58,57 +58,59 @@ import haxe.Md5;
 	#anchorhere# my title
 	#anchorhere# my title
 	----
 	----
 
 
+	[
 	- list item 1
 	- list item 1
 	- list item 2
 	- list item 2
-    - no sub level at this time
+	- no sub level at this time
+	]
 
 
+	[
 	* ordered item 1
 	* ordered item 1
 	* ordered item 2
 	* ordered item 2
 	* no sub level at this time
 	* no sub level at this time
+	]
 
 
-	[pre]
-	some preformatted code
-	[/pre]
+	[[pre]some preformatted code[/pre]]
 
 
-	Will generate a link : http://www.google.com.
+	[Will generate a link : http://www.google.com.]
 
 
-	Will generate an internal link [link some name : /foo/bar/baz] with a name.
+	[Will generate an internal link [link some name : /foo/bar/baz] with a name.]
 
 
     Will generate a link with a name [link some name : http://example.com/foo/bar/baz] too.
     Will generate a link with a name [link some name : http://example.com/foo/bar/baz] too.
 
 
-	Please notice that spaces around central ":" are requires !
+	Please notice that spaces around central ":" are required !
 
 
-	Some //emphased text// and some **strong text**.
+	Some [//emphased text//] and some [**strong text**].
 
 
-	Now insert an image : @img http://www.foo.com/foo.jpg@
+	Now insert an image : [@img http://www.foo.com/foo.jpg@]
 
 
-	Inserting a Swf is easy : @swf WxHxV http://path/to/my/swf.swf@ where W means width, H means Height and V means flash Version, 
+	Inserting a Swf is easy : [@swf WxHxV http://path/to/my/swf.swf@] where W means width, H means Height and V means flash Version,
 	this feature uses the SWFObject javascript class to display the specified swf.
 	this feature uses the SWFObject javascript class to display the specified swf.
 
 
-	[html]
-	<p>This is some raw html you may like to insert manually to add some specific data like 
+	[[html]
+	<p>This is some raw html you may like to insert manually to add some specific data like
 	javascript or other stuff.</p>
 	javascript or other stuff.</p>
 	<p>Raw html may produce parse exceptions thrown by the Text2Xhtml.transform(src) method.</p>
 	<p>Raw html may produce parse exceptions thrown by the Text2Xhtml.transform(src) method.</p>
-	[/html]
+[/html]]
 
 
-	You can also insert [cite]some citations[/cite] !	
+	You can also insert [[cite]some citations[/cite]] !
 
 
 	That's almost everything for now :)
 	That's almost everything for now :)
 
 
 	Ah i almost forgot the haxe colorizer :
 	Ah i almost forgot the haxe colorizer :
 
 
-	[haxe]
-	class Foo {
-		// some comment
-		public function new(){
-		}
+	[[haxe]
+class Foo {
+	// some comment
+	public function new(){
+	}
 
 
-		// ...
+	// ...
 
 
-		public static function foo(){
-		}
+	public static function foo(){
 	}
 	}
-	[/haxe]
+}
+[/haxe]]
 
 
 **/
 **/
 class Text2Xhtml {
 class Text2Xhtml {
@@ -201,7 +203,7 @@ class Text2Xhtml {
 			result.add("</ul>\n");
 			result.add("</ul>\n");
 			str = StringTools.replace(str, list, result.toString());
 			str = StringTools.replace(str, list, result.toString());
 		}
 		}
-		
+
 		var xml = Xml.parse(str);
 		var xml = Xml.parse(str);
 		transformXml(xml);
 		transformXml(xml);
 		str = xml.toString();
 		str = xml.toString();
@@ -255,7 +257,7 @@ s.write('swf@id');
 		str = StringTools.replace(str, "@h", s[1]);
 		str = StringTools.replace(str, "@h", s[1]);
 		return str;
 		return str;
 	}
 	}
-	
+
 	function transformXml( xml:Xml, ?noParagraph:Bool ) {
 	function transformXml( xml:Xml, ?noParagraph:Bool ) {
 		if (xml.nodeType != Xml.Element && xml.nodeType != Xml.Document){
 		if (xml.nodeType != Xml.Element && xml.nodeType != Xml.Document){
 			var str = xml.nodeValue;
 			var str = xml.nodeValue;
@@ -298,7 +300,7 @@ s.write('swf@id');
 			pos = pos + repl.length;
 			pos = pos + repl.length;
 			token = findFirst(str.substr(pos, str.length-pos), [em,strong]);
 			token = findFirst(str.substr(pos, str.length-pos), [em,strong]);
 		}
 		}
-		
+
 		helper = new StringHelper(str);
 		helper = new StringHelper(str);
 		helper.restore("link", links);
 		helper.restore("link", links);
 		helper.restore("img", images);
 		helper.restore("img", images);
@@ -331,7 +333,7 @@ s.write('swf@id');
 }
 }
 
 
 class StringHelper {
 class StringHelper {
-	
+
 	public var str : String;
 	public var str : String;
 
 
 	public function new( s:String ){
 	public function new( s:String ){

+ 2 - 1
std/mtwin/web/Handler.hx

@@ -40,12 +40,13 @@ enum ActionError {
 /**
 /**
 	Generic class to handle web actions.
 	Generic class to handle web actions.
 
 
-	Add to your .htaccess :
+	Add to your .htaccess : [
 
 
 	<FilesMatch "^(actionName|actionName|...)$">
 	<FilesMatch "^(actionName|actionName|...)$">
 	RewriteEngine On
 	RewriteEngine On
 	RewriteRule (.*) /index.n
 	RewriteRule (.*) /index.n
 	</FilesMatch>
 	</FilesMatch>
+	]
 **/
 **/
 class Handler<T> {
 class Handler<T> {
 
 

+ 1 - 1
std/neko/Web.hx

@@ -47,7 +47,7 @@ class Web {
 
 
 	/**
 	/**
 		Returns an Array of Strings built using GET / POST values.
 		Returns an Array of Strings built using GET / POST values.
-		If you have in your URL the parameters [a[&#93;=foo;a[&#93;=hello;a[5&#93;=bar;a[3&#93;=baz] then
+		If you have in your URL the parameters [a[]=foo;a[]=hello;a[]=bar;a[]=baz] then
 		[neko.Web.getParamValues("a")] will return [["foo","hello",null,"baz",null,"bar"]]
 		[neko.Web.getParamValues("a")] will return [["foo","hello",null,"baz",null,"bar"]]
 	**/
 	**/
 	public static function getParamValues( param : String ) : Array<String> {
 	public static function getParamValues( param : String ) : Array<String> {

+ 5 - 7
std/neko/vm/Loader.hx

@@ -31,21 +31,19 @@ enum LoaderHandle {
 }
 }
 
 
 /**
 /**
-	<p>
 	Loaders can be used to dynamicly load Neko primitives stored in NDLL libraries.
 	Loaders can be used to dynamicly load Neko primitives stored in NDLL libraries.
-	</p>
-	<p>
+
+
 	Loaders can be used to dynamicly load other Neko modules (.n bytecode files).
 	Loaders can be used to dynamicly load other Neko modules (.n bytecode files).
 	Modules are referenced by names. To lookup the corresponding bytecode file, the
 	Modules are referenced by names. To lookup the corresponding bytecode file, the
 	default loader first look in its cache, then eventually adds the .n extension
 	default loader first look in its cache, then eventually adds the .n extension
 	to the name and lookup the bytecode in its path.
 	to the name and lookup the bytecode in its path.
-	</p>
-	<p>
+
+
 	Loaders can be used for sandbox security. When a Module is loaded with a given
 	Loaders can be used for sandbox security. When a Module is loaded with a given
 	Loader, this loader can manager the module security by filtering which
 	Loader, this loader can manager the module security by filtering which
 	primitives can be loaded by this module or by rewrapping them at loading-time
 	primitives can be loaded by this module or by rewrapping them at loading-time
 	with custom securized versions. Loaders are inherited in loaded submodules.
 	with custom securized versions. Loaders are inherited in loaded submodules.
-	</p>
 **/
 **/
 class Loader {
 class Loader {
 
 
@@ -131,7 +129,7 @@ class Loader {
 		way, the module is directly executed.
 		way, the module is directly executed.
 	**/
 	**/
 	public function loadModule( modName : String, ?loader : Loader ) : Module {
 	public function loadModule( modName : String, ?loader : Loader ) : Module {
-		var exp = untyped l.loadmodule(modName.__s,if( loader == null ) l else loader.l);		
+		var exp = untyped l.loadmodule(modName.__s,if( loader == null ) l else loader.l);
 		return new Module(exp.__module);
 		return new Module(exp.__module);
 	}
 	}