diff options
16 files changed, 81 insertions, 37 deletions
diff --git a/giscanner/doctemplates/Gjs/class.tmpl b/giscanner/doctemplates/Gjs/class.tmpl index 435b31a5..5882d9fa 100644 --- a/giscanner/doctemplates/Gjs/class.tmpl +++ b/giscanner/doctemplates/Gjs/class.tmpl @@ -1,17 +1,14 @@ <%inherit file="/class.tmpl"/> <%block name="synopsis"> <synopsis><code> -from gi.repository import ${namespace.name} +const ${namespace.name} = imports.gi.${namespace.name}; -${formatter.to_underscores(node.name).lower()} = ${namespace.name}.${node.name}(\ +let ${formatter.to_underscores(node.name).lower()} = ${namespace.name}.${node.name}({ % for ix, property_ in enumerate(node.properties): % if property_.construct or property_.construct_only or property_.writable: -<link xref='${namespace.name}.${node.name}-${property_.name}'>${property_.name.replace('-', '_')}</link>=value\ -% if ix != len(node.properties) - 1: -, \ -% endif + <link xref='${namespace.name}.${node.name}-${property_.name}'>${property_.name.replace('-', '_')}</link>: value, % endif % endfor -)\ +}); </code></synopsis> </%block> diff --git a/tests/scanner/Regress-1.0-Gjs-expected/Regress.AnnotationObject.page b/tests/scanner/Regress-1.0-Gjs-expected/Regress.AnnotationObject.page index 8bcae31c..e104633a 100644 --- a/tests/scanner/Regress-1.0-Gjs-expected/Regress.AnnotationObject.page +++ b/tests/scanner/Regress-1.0-Gjs-expected/Regress.AnnotationObject.page @@ -13,9 +13,14 @@ <title>Regress.AnnotationObject</title> <synopsis><code> -from gi.repository import Regress +const Regress = imports.gi.Regress; -annotation_object = Regress.AnnotationObject(<link xref='Regress.AnnotationObject-function-property'>function_property</link>=value, <link xref='Regress.AnnotationObject-string-property'>string_property</link>=value, <link xref='Regress.AnnotationObject-tab-property'>tab_property</link>=value) </code></synopsis> +let annotation_object = Regress.AnnotationObject({ + <link xref='Regress.AnnotationObject-function-property'>function_property</link>: value, + <link xref='Regress.AnnotationObject-string-property'>string_property</link>: value, + <link xref='Regress.AnnotationObject-tab-property'>tab_property</link>: value, +}); + </code></synopsis> <p>This is an object used to test regress_annotations.</p> diff --git a/tests/scanner/Regress-1.0-Gjs-expected/Regress.FooBuffer.page b/tests/scanner/Regress-1.0-Gjs-expected/Regress.FooBuffer.page index a3b5101c..1220e811 100644 --- a/tests/scanner/Regress-1.0-Gjs-expected/Regress.FooBuffer.page +++ b/tests/scanner/Regress-1.0-Gjs-expected/Regress.FooBuffer.page @@ -13,9 +13,11 @@ <title>Regress.FooBuffer</title> <synopsis><code> -from gi.repository import Regress +const Regress = imports.gi.Regress; -foo_buffer = Regress.FooBuffer() </code></synopsis> +let foo_buffer = Regress.FooBuffer({ +}); + </code></synopsis> diff --git a/tests/scanner/Regress-1.0-Gjs-expected/Regress.FooInterface.page b/tests/scanner/Regress-1.0-Gjs-expected/Regress.FooInterface.page index a195bb89..8e182705 100644 --- a/tests/scanner/Regress-1.0-Gjs-expected/Regress.FooInterface.page +++ b/tests/scanner/Regress-1.0-Gjs-expected/Regress.FooInterface.page @@ -13,9 +13,11 @@ <title>Regress.FooInterface</title> <synopsis><code> -from gi.repository import Regress +const Regress = imports.gi.Regress; -foo_interface = Regress.FooInterface() </code></synopsis> +let foo_interface = Regress.FooInterface({ +}); + </code></synopsis> diff --git a/tests/scanner/Regress-1.0-Gjs-expected/Regress.FooObject.page b/tests/scanner/Regress-1.0-Gjs-expected/Regress.FooObject.page index 6a0810ef..9f2290b4 100644 --- a/tests/scanner/Regress-1.0-Gjs-expected/Regress.FooObject.page +++ b/tests/scanner/Regress-1.0-Gjs-expected/Regress.FooObject.page @@ -13,9 +13,13 @@ <title>Regress.FooObject</title> <synopsis><code> -from gi.repository import Regress +const Regress = imports.gi.Regress; -foo_object = Regress.FooObject(<link xref='Regress.FooObject-hidden'>hidden</link>=value, <link xref='Regress.FooObject-string'>string</link>=value) </code></synopsis> +let foo_object = Regress.FooObject({ + <link xref='Regress.FooObject-hidden'>hidden</link>: value, + <link xref='Regress.FooObject-string'>string</link>: value, +}); + </code></synopsis> diff --git a/tests/scanner/Regress-1.0-Gjs-expected/Regress.FooOtherObject.page b/tests/scanner/Regress-1.0-Gjs-expected/Regress.FooOtherObject.page index 56e0fcbe..b007600f 100644 --- a/tests/scanner/Regress-1.0-Gjs-expected/Regress.FooOtherObject.page +++ b/tests/scanner/Regress-1.0-Gjs-expected/Regress.FooOtherObject.page @@ -13,9 +13,11 @@ <title>Regress.FooOtherObject</title> <synopsis><code> -from gi.repository import Regress +const Regress = imports.gi.Regress; -foo_other_object = Regress.FooOtherObject() </code></synopsis> +let foo_other_object = Regress.FooOtherObject({ +}); + </code></synopsis> diff --git a/tests/scanner/Regress-1.0-Gjs-expected/Regress.FooSubInterface.page b/tests/scanner/Regress-1.0-Gjs-expected/Regress.FooSubInterface.page index 3b093726..de032148 100644 --- a/tests/scanner/Regress-1.0-Gjs-expected/Regress.FooSubInterface.page +++ b/tests/scanner/Regress-1.0-Gjs-expected/Regress.FooSubInterface.page @@ -13,9 +13,11 @@ <title>Regress.FooSubInterface</title> <synopsis><code> -from gi.repository import Regress +const Regress = imports.gi.Regress; -foo_sub_interface = Regress.FooSubInterface() </code></synopsis> +let foo_sub_interface = Regress.FooSubInterface({ +}); + </code></synopsis> diff --git a/tests/scanner/Regress-1.0-Gjs-expected/Regress.FooSubobject.page b/tests/scanner/Regress-1.0-Gjs-expected/Regress.FooSubobject.page index f3a8b6d7..244f994d 100644 --- a/tests/scanner/Regress-1.0-Gjs-expected/Regress.FooSubobject.page +++ b/tests/scanner/Regress-1.0-Gjs-expected/Regress.FooSubobject.page @@ -13,9 +13,11 @@ <title>Regress.FooSubobject</title> <synopsis><code> -from gi.repository import Regress +const Regress = imports.gi.Regress; -foo_subobject = Regress.FooSubobject() </code></synopsis> +let foo_subobject = Regress.FooSubobject({ +}); + </code></synopsis> diff --git a/tests/scanner/Regress-1.0-Gjs-expected/Regress.TestFloating.page b/tests/scanner/Regress-1.0-Gjs-expected/Regress.TestFloating.page index 4f1c3233..1d78cd77 100644 --- a/tests/scanner/Regress-1.0-Gjs-expected/Regress.TestFloating.page +++ b/tests/scanner/Regress-1.0-Gjs-expected/Regress.TestFloating.page @@ -13,9 +13,11 @@ <title>Regress.TestFloating</title> <synopsis><code> -from gi.repository import Regress +const Regress = imports.gi.Regress; -test_floating = Regress.TestFloating() </code></synopsis> +let test_floating = Regress.TestFloating({ +}); + </code></synopsis> diff --git a/tests/scanner/Regress-1.0-Gjs-expected/Regress.TestFundamentalObject.page b/tests/scanner/Regress-1.0-Gjs-expected/Regress.TestFundamentalObject.page index ee5ea928..73312d2c 100644 --- a/tests/scanner/Regress-1.0-Gjs-expected/Regress.TestFundamentalObject.page +++ b/tests/scanner/Regress-1.0-Gjs-expected/Regress.TestFundamentalObject.page @@ -13,9 +13,11 @@ <title>Regress.TestFundamentalObject</title> <synopsis><code> -from gi.repository import Regress +const Regress = imports.gi.Regress; -test_fundamental_object = Regress.TestFundamentalObject() </code></synopsis> +let test_fundamental_object = Regress.TestFundamentalObject({ +}); + </code></synopsis> diff --git a/tests/scanner/Regress-1.0-Gjs-expected/Regress.TestFundamentalSubObject.page b/tests/scanner/Regress-1.0-Gjs-expected/Regress.TestFundamentalSubObject.page index 1418f6f7..93d6152c 100644 --- a/tests/scanner/Regress-1.0-Gjs-expected/Regress.TestFundamentalSubObject.page +++ b/tests/scanner/Regress-1.0-Gjs-expected/Regress.TestFundamentalSubObject.page @@ -13,9 +13,11 @@ <title>Regress.TestFundamentalSubObject</title> <synopsis><code> -from gi.repository import Regress +const Regress = imports.gi.Regress; -test_fundamental_sub_object = Regress.TestFundamentalSubObject() </code></synopsis> +let test_fundamental_sub_object = Regress.TestFundamentalSubObject({ +}); + </code></synopsis> diff --git a/tests/scanner/Regress-1.0-Gjs-expected/Regress.TestInheritDrawable.page b/tests/scanner/Regress-1.0-Gjs-expected/Regress.TestInheritDrawable.page index e5622894..d7ac0c5a 100644 --- a/tests/scanner/Regress-1.0-Gjs-expected/Regress.TestInheritDrawable.page +++ b/tests/scanner/Regress-1.0-Gjs-expected/Regress.TestInheritDrawable.page @@ -13,9 +13,11 @@ <title>Regress.TestInheritDrawable</title> <synopsis><code> -from gi.repository import Regress +const Regress = imports.gi.Regress; -test_inherit_drawable = Regress.TestInheritDrawable() </code></synopsis> +let test_inherit_drawable = Regress.TestInheritDrawable({ +}); + </code></synopsis> diff --git a/tests/scanner/Regress-1.0-Gjs-expected/Regress.TestInterface.page b/tests/scanner/Regress-1.0-Gjs-expected/Regress.TestInterface.page index 09c9898a..de64aad9 100644 --- a/tests/scanner/Regress-1.0-Gjs-expected/Regress.TestInterface.page +++ b/tests/scanner/Regress-1.0-Gjs-expected/Regress.TestInterface.page @@ -13,9 +13,11 @@ <title>Regress.TestInterface</title> <synopsis><code> -from gi.repository import Regress +const Regress = imports.gi.Regress; -test_interface = Regress.TestInterface() </code></synopsis> +let test_interface = Regress.TestInterface({ +}); + </code></synopsis> diff --git a/tests/scanner/Regress-1.0-Gjs-expected/Regress.TestObj.page b/tests/scanner/Regress-1.0-Gjs-expected/Regress.TestObj.page index 7ee950e7..9b4dd9ce 100644 --- a/tests/scanner/Regress-1.0-Gjs-expected/Regress.TestObj.page +++ b/tests/scanner/Regress-1.0-Gjs-expected/Regress.TestObj.page @@ -13,9 +13,22 @@ <title>Regress.TestObj</title> <synopsis><code> -from gi.repository import Regress +const Regress = imports.gi.Regress; -test_obj = Regress.TestObj(<link xref='Regress.TestObj-bare'>bare</link>=value, <link xref='Regress.TestObj-boxed'>boxed</link>=value, <link xref='Regress.TestObj-double'>double</link>=value, <link xref='Regress.TestObj-float'>float</link>=value, <link xref='Regress.TestObj-gtype'>gtype</link>=value, <link xref='Regress.TestObj-hash-table'>hash_table</link>=value, <link xref='Regress.TestObj-hash-table-old'>hash_table_old</link>=value, <link xref='Regress.TestObj-int'>int</link>=value, <link xref='Regress.TestObj-list'>list</link>=value, <link xref='Regress.TestObj-list-old'>list_old</link>=value, <link xref='Regress.TestObj-string'>string</link>=value) </code></synopsis> +let test_obj = Regress.TestObj({ + <link xref='Regress.TestObj-bare'>bare</link>: value, + <link xref='Regress.TestObj-boxed'>boxed</link>: value, + <link xref='Regress.TestObj-double'>double</link>: value, + <link xref='Regress.TestObj-float'>float</link>: value, + <link xref='Regress.TestObj-gtype'>gtype</link>: value, + <link xref='Regress.TestObj-hash-table'>hash_table</link>: value, + <link xref='Regress.TestObj-hash-table-old'>hash_table_old</link>: value, + <link xref='Regress.TestObj-int'>int</link>: value, + <link xref='Regress.TestObj-list'>list</link>: value, + <link xref='Regress.TestObj-list-old'>list_old</link>: value, + <link xref='Regress.TestObj-string'>string</link>: value, +}); + </code></synopsis> diff --git a/tests/scanner/Regress-1.0-Gjs-expected/Regress.TestSubObj.page b/tests/scanner/Regress-1.0-Gjs-expected/Regress.TestSubObj.page index fe84d57f..9e0566e1 100644 --- a/tests/scanner/Regress-1.0-Gjs-expected/Regress.TestSubObj.page +++ b/tests/scanner/Regress-1.0-Gjs-expected/Regress.TestSubObj.page @@ -13,9 +13,11 @@ <title>Regress.TestSubObj</title> <synopsis><code> -from gi.repository import Regress +const Regress = imports.gi.Regress; -test_sub_obj = Regress.TestSubObj() </code></synopsis> +let test_sub_obj = Regress.TestSubObj({ +}); + </code></synopsis> diff --git a/tests/scanner/Regress-1.0-Gjs-expected/Regress.TestWi8021x.page b/tests/scanner/Regress-1.0-Gjs-expected/Regress.TestWi8021x.page index 2ea9c575..dc09718e 100644 --- a/tests/scanner/Regress-1.0-Gjs-expected/Regress.TestWi8021x.page +++ b/tests/scanner/Regress-1.0-Gjs-expected/Regress.TestWi8021x.page @@ -13,9 +13,12 @@ <title>Regress.TestWi8021x</title> <synopsis><code> -from gi.repository import Regress +const Regress = imports.gi.Regress; -test_wi8021x = Regress.TestWi8021x(<link xref='Regress.TestWi8021x-testbool'>testbool</link>=value) </code></synopsis> +let test_wi8021x = Regress.TestWi8021x({ + <link xref='Regress.TestWi8021x-testbool'>testbool</link>: value, +}); + </code></synopsis> |