From: Jean Privat Date: Fri, 28 Nov 2014 01:51:40 +0000 (-0500) Subject: all: add `nitish` tag for code-blocks skipped by nitunit X-Git-Tag: v0.6.11~5^2~1 X-Git-Url: http://nitlanguage.org all: add `nitish` tag for code-blocks skipped by nitunit Signed-off-by: Jean Privat --- diff --git a/contrib/nitiwiki/src/wiki_html.nit b/contrib/nitiwiki/src/wiki_html.nit index c984bc8..266e1d9 100644 --- a/contrib/nitiwiki/src/wiki_html.nit +++ b/contrib/nitiwiki/src/wiki_html.nit @@ -121,15 +121,17 @@ redef class WikiSection # # The generated tree will be something like this: # - # + # ~~~html + # + # ~~~ fun tpl_tree(limit: Int): Template do return tpl_tree_intern(limit, 1) end diff --git a/lib/ai/backtrack.nit b/lib/ai/backtrack.nit index 0232b4c..550df10 100644 --- a/lib/ai/backtrack.nit +++ b/lib/ai/backtrack.nit @@ -86,7 +86,7 @@ end # 2. Apply the method `run`, that will search and return a solution. # 3. Retrieve information from the solution. # -# ~~~~ +# ~~~~nitish # var p: BacktrackProblem = new MyProblem # var solver = p.solve # var res = solver.run diff --git a/lib/ai/examples/queens.nit b/lib/ai/examples/queens.nit index d25e129..0e86903 100644 --- a/lib/ai/examples/queens.nit +++ b/lib/ai/examples/queens.nit @@ -14,7 +14,7 @@ # The constraint is that two queens cannot be on the same row, column or diagonal. # # Eg. a solution to the 8-queens problem is -# ~~~ +# ~~~raw # +--------+ # |Q.......| # |....Q...| diff --git a/lib/ai/search.nit b/lib/ai/search.nit index 21a349d..64904ee 100644 --- a/lib/ai/search.nit +++ b/lib/ai/search.nit @@ -199,7 +199,7 @@ end # 2. Apply the method `run`, that will search and return a solution. # 3. Retrieve information from the solution. # -# ~~~~ +# ~~~~nitish # var p: SearchProblem = new MyProblem # var res = p.astar.run # if res != null then print "Found plan with {res.depth} actions, that cost {res.cost}: {res.plan.join(", ")}" diff --git a/lib/android/intent/intent_api10.nit b/lib/android/intent/intent_api10.nit index 20c85dc..005b475 100644 --- a/lib/android/intent/intent_api10.nit +++ b/lib/android/intent/intent_api10.nit @@ -646,8 +646,8 @@ class Intent # The general action to be performed # - # Example : - # ~~~ + # ~~~nitish + # # TODO better example # intent.action = intent_action.view.to_s # ~~~ fun action=(action: String) @@ -667,8 +667,8 @@ class Intent # Add category to the intent # Only activities providing all of the requested categories will be used # - # Example : - # ~~~ + # ~~~nitish + # # TODO better example # intent.add_category(intent_category.home.to_s) # ~~~ # Returns `self` allowing fluent programming @@ -720,8 +720,8 @@ class Intent # Add a flag to be used by the intent # - # Example : - # ~~~ + # ~~~nitish + # # TODO better example # intent.add_flags(intent_flag.activity_new_task) # ~~~ # Returns `self` allowing fluent programming diff --git a/lib/android/notification/notification.nit b/lib/android/notification/notification.nit index 07d1c00..a4d34d4 100644 --- a/lib/android/notification/notification.nit +++ b/lib/android/notification/notification.nit @@ -16,7 +16,7 @@ # Services to show notification in the Android status bar # -# ~~~~ +# ~~~~nitish # # Create and show a notification # var notif = new Notification("My Title", "Some content") # notif.ticker = "Ticker text" @@ -25,7 +25,7 @@ # # Update the notification # notif.text = "New content!" # notif.ongoing = true # Make it un-dismissable -# nofif.show +# notif.show # # # Hide the notification # notif.cancel diff --git a/lib/android/sensors.nit b/lib/android/sensors.nit index 4c28466..a38dd60 100644 --- a/lib/android/sensors.nit +++ b/lib/android/sensors.nit @@ -18,7 +18,8 @@ # The sensor support is implemented in android_app module, so the user can enable the type of sensor he wants to use. # There is an example of how you can use the android sensors in nit/examples/mnit_ballz : # -# ~~~~ +# ~~~~nitish +# #FIXME rewrite the example # var app = new MyApp # app.sensors_support_enabled = true # app.accelerometer.enabled = true diff --git a/lib/android/shared_preferences/shared_preferences_api10.nit b/lib/android/shared_preferences/shared_preferences_api10.nit index 404aaea..94aac59 100644 --- a/lib/android/shared_preferences/shared_preferences_api10.nit +++ b/lib/android/shared_preferences/shared_preferences_api10.nit @@ -205,15 +205,14 @@ class SharedPreferences # # User has to manage local stack deallocation himself # - # Example : - # ~~~ + # ~~~nitish # var foo = new HashMap[JavaString, JavaObject] # # ... # for key, value in foo do # key.delete_local_ref # value.delete_local_ref # end - # ~~~ + # ~~~ # *You should use Nit getters instead and get each value one by one* fun all: nullable HashMap[JavaString, JavaObject] do diff --git a/lib/android/shared_preferences/shared_preferences_api11.nit b/lib/android/shared_preferences/shared_preferences_api11.nit index 50d88e9..cb55acc 100644 --- a/lib/android/shared_preferences/shared_preferences_api11.nit +++ b/lib/android/shared_preferences/shared_preferences_api11.nit @@ -73,10 +73,9 @@ redef class SharedPreferences # # User has to manage local stack deallocation himself # - # Example : - # ~~~ - # var a_hash_set = shared_preferences.string_set("A key") - # ... + # ~~~nitish + # var a_hash_set = app.shared_preferences.string_set("A key") + # # ... # for element in a_hash_set do element.delete_local_ref # ~~~ fun string_set(key: String): HashSet[JavaString] @@ -92,10 +91,9 @@ redef class SharedPreferences # # User has to manage local stack deallocation himself # - # Example : - # ~~~ + # ~~~nitish # var foo = new HashSet[JavaString] - # shared_preferences.add_string_set("A key", foo) + # app.shared_preferences.add_string_set("A key", foo) # for element in foo do element.delete_local_ref # ~~~ fun add_string_set(key: String, value: HashSet[JavaString]): SharedPreferences diff --git a/lib/android/ui.nit b/lib/android/ui.nit index b4ed822..98ee444 100644 --- a/lib/android/ui.nit +++ b/lib/android/ui.nit @@ -21,7 +21,7 @@ # methods of the main thread to customize the response to a given event. # # This graph shows the path of a button click: -# ~~~ +# ~~~raw # UI Thread # Main thread # # User diff --git a/lib/jvm.nit b/lib/jvm.nit index 8012746..6063f23 100644 --- a/lib/jvm.nit +++ b/lib/jvm.nit @@ -30,7 +30,8 @@ in "C Header" `{ # Utility to select options to create the VM using `create_jvm` # # Usage example: -# ~~~~ +# +# ~~~~nitish # var builder = new JavaVMBuilder # builder.options.add "-Djava.class.path=." # var jvm = builder.create_jvm diff --git a/lib/markdown/markdown.nit b/lib/markdown/markdown.nit index 2f675d6..3d0a0a1 100644 --- a/lib/markdown/markdown.nit +++ b/lib/markdown/markdown.nit @@ -555,9 +555,9 @@ end # A Link Reference. # Links that are specified somewhere in the mardown document to be reused as shortcuts. # -# Example: -# -# [1]: http://example.com/ "Optional title" +# ~~~raw +# [1]: http://example.com/ "Optional title" +# ~~~ class LinkRef # Link href diff --git a/lib/mnit/mnit_injected_input.nit b/lib/mnit/mnit_injected_input.nit index a72b34d..9d8a819 100644 --- a/lib/mnit/mnit_injected_input.nit +++ b/lib/mnit/mnit_injected_input.nit @@ -24,7 +24,7 @@ # # The input event file is made of event descriptions, one event by line. # -# ~~~ +# ~~~raw # 10 click 10.0 20.0 # 20 quit # ~~~ diff --git a/lib/mnit_display.nit b/lib/mnit_display.nit index 7e474b7..fad361e 100644 --- a/lib/mnit_display.nit +++ b/lib/mnit_display.nit @@ -84,7 +84,7 @@ interface Drawable # Draw image by specifying the positon of each image corners # Corners are in counter-clockwise order stating top left # a is top left, b is bottom left, c is bottom right and d is top right - # ~~~ + # ~~~raw # a-d # | | # b-c diff --git a/lib/poset.nit b/lib/poset.nit index 9549e48..cb4fa87 100644 --- a/lib/poset.nit +++ b/lib/poset.nit @@ -52,12 +52,14 @@ class POSet[E: Object] # Return a view of `e` in the poset. # This allows to asks manipulate elements in thier relation with others elements. # - # var poset: POSet[Something] # ... - # for x in poset do - # for y in poset[x].direct_greaters do - # print "{x} -> {y}" - # end + # ~~~nitish + # var poset: POSet[Something] # ... + # for x in poset do + # for y in poset[x].direct_greaters do + # print "{x} -> {y}" # end + # end + # ~~~ # # REQUIRE: has(e) fun [](e: E): POSetElement[E] @@ -240,13 +242,15 @@ end # # For instance, one common usage is to add a specific attribute for each poset a class belong. # -# class Thing -# var in_some_relation: POSetElement[Thing] -# var in_other_relation: POSetElement[Thing] -# end -# var t: Thing # ... -# t.in_some_relation.greaters -# +# ~~~nitish +# class Thing +# var in_some_relation: POSetElement[Thing] +# var in_other_relation: POSetElement[Thing] +# end +# var t: Thing +# # ... +# t.in_some_relation.greaters +# ~~~ class POSetElement[E: Object] # The poset self belong to var poset: POSet[E] diff --git a/lib/sax/xml_reader.nit b/lib/sax/xml_reader.nit index c158532..6f80e77 100644 --- a/lib/sax/xml_reader.nit +++ b/lib/sax/xml_reader.nit @@ -275,9 +275,11 @@ interface XMLReader # document from a system identifier. It is the exact # equivalent of the following: # - # var source = new InputSouce - # source.system_id = system_id - # parse(source) + # ~~~nitish + # var source = new InputSouce + # source.system_id = system_id + # parse(source) + # ~~~ # # If the system identifier is a URL, it must be fully resolved # by the application before it is passed to the parser. diff --git a/lib/standard/collection/abstract_collection.nit b/lib/standard/collection/abstract_collection.nit index fa16295..3b7f908 100644 --- a/lib/standard/collection/abstract_collection.nit +++ b/lib/standard/collection/abstract_collection.nit @@ -33,25 +33,29 @@ import kernel # Subclasses often provide a more efficient implementation. # # Because of the `iterator` method, Collections instances can use -# the `for` control structure: +# the `for` control structure. # -# var x: Collection[U] -# # ... -# for u in x do -# # u is a U -# # ... -# end +# ~~~nitish +# var x: Collection[U] +# # ... +# for u in x do +# # u is a U +# # ... +# end +# ~~~ # -# that is equivalent with +# that is equivalent with the following: # -# var x: Collection[U] -# # ... -# var i = x.iterator -# while i.is_ok do -# var u = i.item # u is a U -# # ... -# i.next -# end +# ~~~nitish +# var x: Collection[U] +# # ... +# var i = x.iterator +# while i.is_ok do +# var u = i.item # u is a U +# # ... +# i.next +# end +# ~~~ interface Collection[E] # Get a new iterator on the collection. fun iterator: Iterator[E] is abstract diff --git a/lib/template/macro.nit b/lib/template/macro.nit index 0b1c9e4..2796a3c 100644 --- a/lib/template/macro.nit +++ b/lib/template/macro.nit @@ -47,16 +47,18 @@ import template # # In external file `example.tpl`: # -# -# -# -# %TITLE% -# -# -#

%TITLE%

-#

%ARTICLE%

-# -# +# ~~~html +# +# +# +# %TITLE% +# +# +#

%TITLE%

+#

%ARTICLE%

+# +# +# ~~~ # # Loading the template file using `TemplateString`: # diff --git a/src/astbuilder.nit b/src/astbuilder.nit index 620bf49..8aa0295 100644 --- a/src/astbuilder.nit +++ b/src/astbuilder.nit @@ -134,11 +134,13 @@ redef class AExpr # To create the new node `n`, we need to attach the child to it. # But, to put `n` where `c` was in `p`, the place has to be remembered. # - # var p: AExpr - # var c = p.c - # var h = c.detach_with_placeholder - # var n = astbuilder.make_XXX(c) - # h.replace_with(n) + # ~~~nitish + # var p: AExpr + # var c = p.c + # var h = c.detach_with_placeholder + # var n = astbuilder.make_XXX(c) + # h.replace_with(n) + # ~~~ fun detach_with_placeholder: AExpr do var h = new APlaceholderExpr.make diff --git a/src/model/model.nit b/src/model/model.nit index e709a6f..9be5738 100644 --- a/src/model/model.nit +++ b/src/model/model.nit @@ -773,9 +773,13 @@ abstract class MType # In Nit, for each super-class of a type, there is a equivalent super-type. # # Example: + # + # ~~~nitish # class G[T, U] end # class H[V] super G[V, Bool] end + # # H[Int] supertype_to G #-> G[Int, Bool] + # ~~~ # # REQUIRE: `super_mclass` is a super-class of `self` # REQUIRE: `self.need_anchor implies anchor != null and self.can_resolve_for(anchor, null, mmodule)` @@ -809,9 +813,11 @@ abstract class MType # # ## Example 1 # - # class G[E] end - # class H[F] super G[F] end - # class X[Z] end + # ~~~ + # class G[E] end + # class H[F] super G[F] end + # class X[Z] end + # ~~~ # # * Array[E].resolve_for(H[Int]) #-> Array[Int] # * Array[E].resolve_for(G[Z], X[Int]) #-> Array[Z] @@ -829,30 +835,34 @@ abstract class MType # # ## Example 2 # - # class A[E] - # fun foo(e:E):E is abstract - # end - # class B super A[Int] end + # ~~~ + # class A[E] + # fun foo(e:E):E is abstract + # end + # class B super A[Int] end + # ~~~ # # The signature on foo is (e: E): E # If we resolve the signature for B, we get (e:Int):Int # # ## Example 3 # - # class A[E] - # fun foo(e:E) is abstract - # end - # class B[F] - # var a: A[Array[F]] - # fun bar do a.foo(x) # <- x is here - # end + # ~~~nitish + # class A[E] + # fun foo(e:E):E is abstract + # end + # class C[F] + # var a: A[Array[F]] + # fun bar do a.foo(x) # <- x is here + # end + # ~~~ # # The first question is: is foo available on `a`? # # The static type of a is `A[Array[F]]`, that is an open type. # in order to find a method `foo`, whe must look at a resolved type. # - # A[Array[F]].anchor_to(B[nullable Object]) #-> A[Array[nullable Object]] + # A[Array[F]].anchor_to(C[nullable Object]) #-> A[Array[nullable Object]] # # the method `foo` exists in `A[Array[nullable Object]]`, therefore `foo` exists for `a`. # @@ -860,7 +870,7 @@ abstract class MType # # the signature of `foo` is `foo(e:E)`, thus we must resolve the type E # - # E.resolve_for(A[Array[F]],B[nullable Object]) #-> Array[F] + # E.resolve_for(A[Array[F]],C[nullable Object]) #-> Array[F] # # The resolution can be done because `E` make sense for the class A (see `can_resolve_for`) # diff --git a/src/model_utils.nit b/src/model_utils.nit index 9297793..7af444d 100644 --- a/src/model_utils.nit +++ b/src/model_utils.nit @@ -535,7 +535,9 @@ end # # Comparison is made with the formula: # -# a.concern_rank + a.booster_rank <=> b.concern_rank + b.booster_ran +# ~~~nitish +# a.concern_rank + a.booster_rank <=> b.concern_rank + b.booster_ran +# ~~~ # # If both `a` and `b` have the same ranking, # ordering is based on lexicographic comparison of `a.name` and `b.name` diff --git a/src/neo.nit b/src/neo.nit index a566f31..eebd408 100644 --- a/src/neo.nit +++ b/src/neo.nit @@ -178,7 +178,9 @@ # # For example, if the source code contains: # +# ~~~nitish # fun foo(a: A, b: B, c: C) +# ~~~ # # The `MSignature` node will contain a property # `parameter_names = ["a", "b", "c"]` so the MSignature can be reconstructed diff --git a/src/nitpretty.nit b/src/nitpretty.nit index 32294c2..141ef1b 100644 --- a/src/nitpretty.nit +++ b/src/nitpretty.nit @@ -41,45 +41,55 @@ # `Licence comments` are attached to the top of the file # no blank line before, one after. # -# # This is a licence comment +# ~~~nitish +# # This is a licence comment # -# # Documentation for module `foo` -# module foo +# # Documentation for module `foo` +# module foo +# ~~~ # # `ADoc` are documentation comments attached to a `AModule`, `AClassdef`, `APropdef`. # # They are printed before the definition with a blank line before and no after # at the same indentation level than the definition. # -# # Documentation for module `foo` -# module foo +# ~~~nitish +# # Documentation for module `foo` +# module foo # -# # Documentation for class `Bar` -# class Bar -# # Documentation for method `baz` -# fun baz do end -# end +# # Documentation for class `Bar` +# class Bar +# # Documentation for method `baz` +# fun baz do end +# end +# ~~~ # # `Block comments` are comments composed of one or more line rattached to nothing. # They are displayed with one blank line before and after at current indent level. # -# -# # block -# # comment -# +# ~~~nitish +# +# # block +# # comment +# +# ~~~ # # `Attached comments` are comments attached to a production. # They are printed as this. # -# fun foo do # attached comment -# end +# ~~~nitish +# fun foo do # attached comment +# end +# ~~~ # # `nitpretty` automatically remove multiple blanks between comments: # -# # Licence -# # ... -# -# # Block comment +# ~~~nitish +# # Licence +# # ... +# +# # Block comment +# ~~~ # # ### Inlining # @@ -99,17 +109,19 @@ # * There is a blank between each class definition # * There is no blank line at the end of the module # -# # Documentation for module `foo` -# module foo +# ~~~nitish +# # Documentation for module `foo` +# module foo # -# import a -# # import b -# import c +# import a +# # import b +# import c # -# # Documentation for class `Bar` -# class Bar end +# # Documentation for class `Bar` +# class Bar end # -# class Baz end # not a `ADoc` comment +# class Baz end # not a `ADoc` comment +# ~~~ # # # ### Classes @@ -119,60 +131,73 @@ # * There is a blank between each block definition # * There no blank line at the end of the class definition # -# # Documentation for class `Bar` -# class Bar end +# ~~~nitish +# # Documentation for class `Bar` +# class Bar end # -# class Baz -# super Bar +# class Baz +# super Bar # -# fun a is abstract -# private fun b do end +# fun a is abstract +# private fun b do end # -# fun c do -# # ... -# end -# end +# fun c do +# # ... +# end +# end +# ~~~ # -# Generic types have no espace after or before brackets and are separated by a comma and a space: +# Generic types have no space after or before brackets and are separated by a comma and a space: # -# class A[E: Type1, F: Type1] do end +# ~~~nitish +# class A[E: Type1, F: Type1] end +# ~~~ # # ### Blocks # # * Inlined productions have no blank lines between them # * Block productions have a blank before and after # -# var a = 10 -# var b = 0 +# ~~~nitish +# var a = 10 +# var b = 0 # -# if a > b then -# # is positive -# print "positive" -# end +# if a > b then +# # is positive +# print "positive" +# end # -# print "end" +# print "end" +# ~~~ # # ### Calls and Binary Ops # # Arguments are always printed separated with a comma and a space: # -# foo(a, b, c) +# ~~~nitish +# foo(a, b, c) +# ~~~ # # Binary ops are always printed wrapped with spaces: # -# var c = 1 + 2 +# ~~~nitish +# var c = 1 + 2 +# ~~~ # # Calls and binary ops can be splitted to fit the `max-size` constraint. # Breaking priority is given to arguments declaration after the comma. # -# return foo("aaaaaaaaaaaaaaaaaaaaaaaaaa", "bbbbbbbbbbbbbbbbbbbbbbbbbbb", -# "cccccccccccccccccccccccccc") +# ~~~nitish +# return foo("aaaaaaaaaaaaaaaaaaaaaaaaaa", "bbbbbbbbbbbbbbbbbbbbbbbbbbb", +# "cccccccccccccccccccccccccc") +# ~~~ # # Binary ops can also be broken to fit the `max-size` limit: # -# return "aaaaaaaaaaaaaaaaaaaaaaaaaa" + "bbbbbbbbbbbbbbbbbbbbbbbbbbb" + -# "cccccccccccccccccccccccccc" -# +# ~~~nitish +# return "aaaaaaaaaaaaaaaaaaaaaaaaaa" + "bbbbbbbbbbbbbbbbbbbbbbbbbbb" + +# "cccccccccccccccccccccccccc" +# ~~~ module nitpretty import template diff --git a/src/transform.nit b/src/transform.nit index 2212380..07acefb 100644 --- a/src/transform.nit +++ b/src/transform.nit @@ -272,10 +272,12 @@ end redef class AArrayExpr # `[x,y]` is replaced with # - # var t = new Array[X].with_capacity(2) - # t.add(x) - # t.add(y) - # t + # ~~~nitish + # var t = new Array[X].with_capacity(2) + # t.add(x) + # t.add(y) + # t + # ~~~ redef fun accept_transform_visitor(v) do var nblock = v.builder.make_block @@ -323,11 +325,15 @@ end redef class ASendReassignFormExpr # `x.foo(y)+=z` is replaced with # - # x.foo(y) = x.foo(y) + z + # ~~~nitish + # x.foo(y) = x.foo(y) + z + # ~~~ # # witch is, in reality: # - # x."foo="(y, x.foo(y)."+"(z)) + # ~~~nitish + # x."foo="(y, x.foo(y)."+"(z)) + # ~~~ redef fun accept_transform_visitor(v) do var nblock = v.builder.make_block