ソースを参照

[std] consistently use ```haxe for code blocks in docs

[skip ci]
Jens Fischer 6 年 前
コミット
db33df9625

+ 0 - 2
.vscode/tasks.json

@@ -1,6 +1,4 @@
 {
-    // See https://go.microsoft.com/fwlink/?LinkId=733558
-    // for the documentation about the tasks.json format
     "version": "2.0.0",
 	"tasks": [
 		{

+ 1 - 1
std/StringTools.hx

@@ -531,7 +531,7 @@ class StringTools {
 		http://msdn.microsoft.com/en-us/library/ms880421
 
 		Examples:
-		```
+		```haxe
 		quoteWinArg("abc") == "abc";
 		quoteWinArg("ab c") == '"ab c"';
 		```

+ 2 - 2
std/cs/Flags.hx

@@ -27,8 +27,8 @@
 	Usage example:
 
 	```haxe
-		import cs.system.reflection.BindingFlags;
-		var binding = new Flags(BindingFlags.Public) | BindingFlags.Static | BindingFlags.NonPublic;
+	import cs.system.reflection.BindingFlags;
+	var binding = new Flags(BindingFlags.Public) | BindingFlags.Static | BindingFlags.NonPublic;
 	```
  **/
 abstract Flags<T : EnumValue>(T) from T to T

+ 15 - 14
std/eval/vm/Context.hx

@@ -35,24 +35,25 @@ extern class Context {
 
 		Sample plugin:
 
+		```ocaml
+		open EvalValue
+		open EvalContext
+		open EvalEncode
+
+		let add_int = vfun2 (fun v1 v2 -> match v1,v2 with
+			| VInt32 i1,VInt32 i2 -> vint32 (Int32.add i1 i2)
+			| _ -> exc_string "Expected int + int"
+		)
+		;;
+		EvalStdLib.StdContext.register ["add_int",add_int]
 		```
-open EvalValue
-open EvalContext
-open EvalEncode
-
-let add_int = vfun2 (fun v1 v2 -> match v1,v2 with
-	| VInt32 i1,VInt32 i2 -> vint32 (Int32.add i1 i2)
-	| _ -> exc_string "Expected int + int"
-)
-;;
-EvalStdLib.StdContext.register ["add_int",add_int]
-```
 
 		Usage from Haxe:
 
-		```var module:TestPlugin = eval.vm.Context.loadPlugin("testPlugin.cmo");
-trace(module.add_int(4, 3));
-```
+		```haxe
+		var module:TestPlugin = eval.vm.Context.loadPlugin("testPlugin.cmo");
+		trace(module.add_int(4, 3));
+		```
 
 		Plugins have to be compiled with the same OCaml version as the Haxe compiler
 		and using the same Haxe version. If a plugin cannot be loaded, an exception

+ 1 - 1
std/haxe/macro/ExprTools.hx

@@ -152,7 +152,7 @@ class ExprTools {
 					ExprTools.map(e, capitalizeStrings);
 			}
 		}
-		```haxe
+		```
 	**/
 	static public function map( e : Expr, f : Expr -> Expr ) : Expr {
 		return {pos: e.pos, expr: switch(e.expr) {

+ 2 - 2
std/js/Syntax.hx

@@ -13,11 +13,11 @@ extern class Syntax {
 		`code` must be a string constant.
 
 		Additional `args` are supported to provide code interpolation, for example:
-		```
+		```haxe
 		Syntax.code("console.log({0}, {1})", "hi", 42);
 		```
 		will generate
-		```
+		```haxe
 		console.log("hi", 42);
 		```
 	**/

+ 1 - 1
std/php/Boot.hx

@@ -490,7 +490,7 @@ class Boot {
 
 	/**
 		Helper method to avoid "Cannot use temporary expression in write context" error for expressions like this:
-		```
+		```haxe
 		(new MyClass()).fieldName = 'value';
 		```
 	**/

+ 1 - 1
std/php/Generator.hx

@@ -6,7 +6,7 @@ package php;
 	Generator is not a Haxe Iterable. It can be iterated one time only.
 	Unfortunately Haxe does not know that in PHP generators may have no `return` expression or `return value` with any type of `value`.
 	Use `return null` or untyped cast to workaround this issue:
-	```
+	```haxe
 	function generatorWithoutReturn():Generator {
 		php.Syntax.yield(1);
 		return null;

+ 9 - 9
std/php/Syntax.hx

@@ -15,11 +15,11 @@ extern class Syntax {
         `php` should be a string literal with php code.
         It can contain placeholders like `{0}`, `{1}` which will be replaced with corresponding arguments from `args`.
         E.g.:
-        ```
+        ```haxe
         Syntax.code("var_dump({0}, {1})", a, b);
         ```
         will generate
-        ```
+        ```haxe
         var_dump($a, $b);
         ```
     **/
@@ -172,18 +172,18 @@ extern class Syntax {
 
     /**
         Generates PHP class name for a provided Haxe class.
-        ```
+        ```haxe
         trace(Syntax.nativeClassName(php.Web)); // outputs: php\Web
         ```
      */
     static function nativeClassName<T>(cls:EitherType<Class<T>, Enum<T>>) : String;
 
     /**
-        ```
+        ```haxe
         Syntax.foreach(collection, function(key, value) trace(key, value));
         ```
         generates:
-        ```
+        ```haxe
         foreach($collection as $key => $value) {
             trace($key, $value);
         }
@@ -245,22 +245,22 @@ extern class Syntax {
     static function staticCall( className:AsVar<EitherType<Class<Dynamic>,String>>, methodName:String, args:Rest<Dynamic> ) : Dynamic;
 
     /**
-        ```
+        ```haxe
         Syntax.arrayDecl(arg1, arg2, arg3);
         ```
         Generates native array declaration:
-        ```
+        ```haxe
         [$arg1, $arg2, $arg3]
         ```
     **/
     static function arrayDecl<T>( args:Rest<T> ) : NativeIndexedArray<T>;
 
     /**
-        ```
+        ```haxe
         Syntax.assocDecl({field1:'first', field2:2}});
         ```
         Generates native associative array declaration:
-        ```
+        ```haxe
         ["field1" => "first", "field2" => 2];
         ```
         This method is not recursive.

+ 1 - 1
std/php/_std/StringTools.hx

@@ -153,7 +153,7 @@ import php.*;
 		http://msdn.microsoft.com/en-us/library/ms880421
 
 		Examples:
-		```
+		```haxe
 		quoteWinArg("abc") == "abc";
 		quoteWinArg("ab c") == '"ab c"';
 		```

+ 1 - 1
tests/nullsafety/src/cases/Test.hx

@@ -80,7 +80,7 @@ class AllVarsInitializedInConstructor_weHaveClosure_thisShouldBeUsable {
 
 	/**
 	 * This is generated like:
-	 * ```
+	 * ```haxe
 	 * var _gthis = this; //problems come from here
 	 * this.v = 42;
 	 * var f = function() {