mirror of
https://gitlab.gnome.org/jwestman/blueprint-compiler.git
synced 2025-05-04 15:59:08 -04:00
docs: Use correct lexer name for code blocks
This commit is contained in:
parent
a8512d83f3
commit
0f5be1b051
11 changed files with 37 additions and 37 deletions
|
@ -22,7 +22,7 @@ Blueprint is a markup language and compiler for GTK 4 user interfaces.
|
||||||
packaging
|
packaging
|
||||||
|
|
||||||
|
|
||||||
.. code-block::
|
.. code-block:: blueprint
|
||||||
|
|
||||||
using Gtk 4.0;
|
using Gtk 4.0;
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,7 @@ GObject Introspection
|
||||||
|
|
||||||
Blueprint files can import GObject Introspection namespaces like this:
|
Blueprint files can import GObject Introspection namespaces like this:
|
||||||
|
|
||||||
.. code-block::
|
.. code-block:: blueprint
|
||||||
|
|
||||||
using Gtk 4.0;
|
using Gtk 4.0;
|
||||||
using Adw 1;
|
using Adw 1;
|
||||||
|
|
|
@ -166,14 +166,14 @@ version_conflict
|
||||||
----------------
|
----------------
|
||||||
This error occurs when two versions of a namespace are imported (possibly transitively) in the same file. For example, this will cause a version conflict:
|
This error occurs when two versions of a namespace are imported (possibly transitively) in the same file. For example, this will cause a version conflict:
|
||||||
|
|
||||||
.. code-block:: blueprintui
|
.. code-block:: blueprint
|
||||||
|
|
||||||
using Gtk 4.0;
|
using Gtk 4.0;
|
||||||
using Gtk 3.0;
|
using Gtk 3.0;
|
||||||
|
|
||||||
But so will this:
|
But so will this:
|
||||||
|
|
||||||
.. code-block:: blueprintui
|
.. code-block:: blueprint
|
||||||
|
|
||||||
using Gtk 4.0;
|
using Gtk 4.0;
|
||||||
using Handy 1;
|
using Handy 1;
|
||||||
|
|
|
@ -17,7 +17,7 @@ A blueprint document consists of a :ref:`GTK declaration<Syntax GtkDecl>`, one s
|
||||||
Example
|
Example
|
||||||
~~~~~~~
|
~~~~~~~
|
||||||
|
|
||||||
.. code-block:: blueprintui
|
.. code-block:: blueprint
|
||||||
|
|
||||||
// Gtk Declaration
|
// Gtk Declaration
|
||||||
using Gtk 4.0;
|
using Gtk 4.0;
|
||||||
|
@ -43,7 +43,7 @@ Every blueprint file begins with the line ``using Gtk 4.0;``, which declares the
|
||||||
Example
|
Example
|
||||||
~~~~~~~
|
~~~~~~~
|
||||||
|
|
||||||
.. code-block:: blueprintui
|
.. code-block:: blueprint
|
||||||
|
|
||||||
using Gtk 4.0;
|
using Gtk 4.0;
|
||||||
|
|
||||||
|
@ -68,7 +68,7 @@ The compiler requires typelib files for these libraries to be installed. They ar
|
||||||
Example
|
Example
|
||||||
~~~~~~~
|
~~~~~~~
|
||||||
|
|
||||||
.. code-block:: blueprintui
|
.. code-block:: blueprint
|
||||||
|
|
||||||
// Import libadwaita
|
// Import libadwaita
|
||||||
using Adw 1;
|
using Adw 1;
|
||||||
|
|
|
@ -6,7 +6,7 @@ Expressions make your user interface code *reactive*. This means when your
|
||||||
application's data changes, the user interface reacts to the change
|
application's data changes, the user interface reacts to the change
|
||||||
automatically.
|
automatically.
|
||||||
|
|
||||||
.. code-block:: blueprintui
|
.. code-block:: blueprint
|
||||||
|
|
||||||
label: bind MyAppWindow.account.username;
|
label: bind MyAppWindow.account.username;
|
||||||
/* ^ ^ ^
|
/* ^ ^ ^
|
||||||
|
@ -81,7 +81,7 @@ Cast Expressions
|
||||||
|
|
||||||
Cast expressions allow Blueprint to know the type of an expression when it can't otherwise determine it.
|
Cast expressions allow Blueprint to know the type of an expression when it can't otherwise determine it.
|
||||||
|
|
||||||
.. code-block:: blueprintui
|
.. code-block:: blueprint
|
||||||
|
|
||||||
// Cast the result of the closure so blueprint knows it's a string
|
// Cast the result of the closure so blueprint knows it's a string
|
||||||
label: bind $my_closure() as <string>
|
label: bind $my_closure() as <string>
|
|
@ -78,7 +78,7 @@ Valid in `Adw.MessageDialog <https://gnome.pages.gitlab.gnome.org/libadwaita/doc
|
||||||
|
|
||||||
The ``responses`` block defines the buttons that will be added to the dialog. The ``destructive`` or ``suggested`` flag sets the appearance of the button, and the ``disabled`` flag can be used to disable the button.
|
The ``responses`` block defines the buttons that will be added to the dialog. The ``destructive`` or ``suggested`` flag sets the appearance of the button, and the ``disabled`` flag can be used to disable the button.
|
||||||
|
|
||||||
.. code-block:: blueprintui
|
.. code-block:: blueprint
|
||||||
|
|
||||||
using Adw 1;
|
using Adw 1;
|
||||||
|
|
||||||
|
@ -106,7 +106,7 @@ Valid in `Gtk.ComboBoxText <https://docs.gtk.org/gtk4/class.ComboBoxText.html>`_
|
||||||
|
|
||||||
The ``items`` block defines the items that will be added to the combo box. The optional ID can be used to refer to the item rather than its label.
|
The ``items`` block defines the items that will be added to the combo box. The optional ID can be used to refer to the item rather than its label.
|
||||||
|
|
||||||
.. code-block:: blueprintui
|
.. code-block:: blueprint
|
||||||
|
|
||||||
ComboBoxText {
|
ComboBoxText {
|
||||||
items [
|
items [
|
||||||
|
@ -133,7 +133,7 @@ Valid in `Gtk.FileFilter <https://docs.gtk.org/gtk4/class.FileFilter.html>`_.
|
||||||
|
|
||||||
The ``mime-types``, ``patterns``, and ``suffixes`` blocks define the items that will be added to the file filter. The ``mime-types`` block accepts mime types (including wildcards for subtypes, such as ``image/*``). The ``patterns`` block accepts glob patterns, and the ``suffixes`` block accepts file extensions.
|
The ``mime-types``, ``patterns``, and ``suffixes`` blocks define the items that will be added to the file filter. The ``mime-types`` block accepts mime types (including wildcards for subtypes, such as ``image/*``). The ``patterns`` block accepts glob patterns, and the ``suffixes`` block accepts file extensions.
|
||||||
|
|
||||||
.. code-block:: blueprintui
|
.. code-block:: blueprint
|
||||||
|
|
||||||
FileFilter {
|
FileFilter {
|
||||||
mime-types [ "text/plain", "image/*" ]
|
mime-types [ "text/plain", "image/*" ]
|
||||||
|
@ -156,7 +156,7 @@ Valid in `Gtk.Widget <https://docs.gtk.org/gtk4/class.Widget.html>`_.
|
||||||
|
|
||||||
The ``layout`` block describes how the widget should be positioned within its parent. The available properties depend on the parent widget's layout manager.
|
The ``layout`` block describes how the widget should be positioned within its parent. The available properties depend on the parent widget's layout manager.
|
||||||
|
|
||||||
.. code-block:: blueprintui
|
.. code-block:: blueprint
|
||||||
|
|
||||||
Grid {
|
Grid {
|
||||||
Button {
|
Button {
|
||||||
|
@ -196,7 +196,7 @@ The ``template`` block defines the template that will be used to create list ite
|
||||||
|
|
||||||
The template type must be `Gtk.ListItem <https://docs.gtk.org/gtk4/class.ListItem.html>`_. The template object can be referenced with the ``template`` keyword.
|
The template type must be `Gtk.ListItem <https://docs.gtk.org/gtk4/class.ListItem.html>`_. The template object can be referenced with the ``template`` keyword.
|
||||||
|
|
||||||
.. code-block:: blueprintui
|
.. code-block:: blueprint
|
||||||
|
|
||||||
ListView {
|
ListView {
|
||||||
factory: BuilderListItemFactory {
|
factory: BuilderListItemFactory {
|
||||||
|
@ -244,7 +244,7 @@ Valid in `Gtk.SizeGroup <https://docs.gtk.org/gtk4/class.SizeGroup.html>`_.
|
||||||
|
|
||||||
The ``widgets`` block defines the widgets that will be added to the size group.
|
The ``widgets`` block defines the widgets that will be added to the size group.
|
||||||
|
|
||||||
.. code-block:: blueprintui
|
.. code-block:: blueprint
|
||||||
|
|
||||||
Box {
|
Box {
|
||||||
Button button1 {}
|
Button button1 {}
|
||||||
|
@ -270,7 +270,7 @@ Valid in `Gtk.StringList <https://docs.gtk.org/gtk4/class.StringList.html>`_.
|
||||||
|
|
||||||
The ``strings`` block defines the strings in the string list.
|
The ``strings`` block defines the strings in the string list.
|
||||||
|
|
||||||
.. code-block:: blueprintui
|
.. code-block:: blueprint
|
||||||
|
|
||||||
StringList {
|
StringList {
|
||||||
strings ["violin", "guitar", _("harp")]
|
strings ["violin", "guitar", _("harp")]
|
||||||
|
@ -291,7 +291,7 @@ Valid in any `Gtk.Widget <https://docs.gtk.org/gtk4/class.Widget.html>`_.
|
||||||
|
|
||||||
The ``styles`` block defines CSS classes that will be added to the widget.
|
The ``styles`` block defines CSS classes that will be added to the widget.
|
||||||
|
|
||||||
.. code-block:: blueprintui
|
.. code-block:: blueprint
|
||||||
|
|
||||||
Button {
|
Button {
|
||||||
styles ["suggested-action"]
|
styles ["suggested-action"]
|
||||||
|
@ -327,7 +327,7 @@ The ``action response`` extension sets the ``action`` child type for the child a
|
||||||
|
|
||||||
No more than one child of a dialog or infobar may have the ``default`` flag.
|
No more than one child of a dialog or infobar may have the ``default`` flag.
|
||||||
|
|
||||||
.. code-block:: blueprintui
|
.. code-block:: blueprint
|
||||||
|
|
||||||
Dialog {
|
Dialog {
|
||||||
[action response=ok default]
|
[action response=ok default]
|
||||||
|
|
|
@ -21,7 +21,7 @@ Menus, such as the application menu, are defined using the ``menu`` keyword. Men
|
||||||
Example
|
Example
|
||||||
~~~~~~~
|
~~~~~~~
|
||||||
|
|
||||||
.. code-block:: blueprintui
|
.. code-block:: blueprint
|
||||||
|
|
||||||
menu my_menu {
|
menu my_menu {
|
||||||
submenu {
|
submenu {
|
||||||
|
@ -53,7 +53,7 @@ The most common menu attributes are ``label``, ``action``, and ``icon``. Because
|
||||||
Example
|
Example
|
||||||
~~~~~~~
|
~~~~~~~
|
||||||
|
|
||||||
.. code-block:: blueprintui
|
.. code-block:: blueprint
|
||||||
|
|
||||||
menu {
|
menu {
|
||||||
item ("label")
|
item ("label")
|
||||||
|
|
|
@ -24,7 +24,7 @@ Optionally, objects may have an ID to provide a handle for other parts of the bl
|
||||||
Example
|
Example
|
||||||
~~~~~~~
|
~~~~~~~
|
||||||
|
|
||||||
.. code-block:: blueprintui
|
.. code-block:: blueprint
|
||||||
|
|
||||||
Label label1 {
|
Label label1 {
|
||||||
label: "Hello, world!";
|
label: "Hello, world!";
|
||||||
|
@ -69,7 +69,7 @@ A property's value can be another object, either inline or referenced by ID.
|
||||||
Example
|
Example
|
||||||
~~~~~~~
|
~~~~~~~
|
||||||
|
|
||||||
.. code-block:: blueprintui
|
.. code-block:: blueprint
|
||||||
|
|
||||||
Label {
|
Label {
|
||||||
label: "text";
|
label: "text";
|
||||||
|
@ -102,7 +102,7 @@ Optionally, you can provide an object ID to use when connecting the signal.
|
||||||
Example
|
Example
|
||||||
~~~~~~~
|
~~~~~~~
|
||||||
|
|
||||||
.. code-block:: blueprintui
|
.. code-block:: blueprint
|
||||||
|
|
||||||
Button {
|
Button {
|
||||||
clicked => $on_button_clicked();
|
clicked => $on_button_clicked();
|
||||||
|
@ -141,7 +141,7 @@ Examples
|
||||||
Add children to a container
|
Add children to a container
|
||||||
+++++++++++++++++++++++++++
|
+++++++++++++++++++++++++++
|
||||||
|
|
||||||
.. code-block:: blueprintui
|
.. code-block:: blueprint
|
||||||
|
|
||||||
Button {
|
Button {
|
||||||
Image {}
|
Image {}
|
||||||
|
@ -150,7 +150,7 @@ Add children to a container
|
||||||
Child types
|
Child types
|
||||||
+++++++++++
|
+++++++++++
|
||||||
|
|
||||||
.. code-block:: blueprintui
|
.. code-block:: blueprint
|
||||||
|
|
||||||
HeaderBar {
|
HeaderBar {
|
||||||
[start]
|
[start]
|
||||||
|
@ -165,7 +165,7 @@ Child types
|
||||||
Child extensions
|
Child extensions
|
||||||
++++++++++++++++
|
++++++++++++++++
|
||||||
|
|
||||||
.. code-block:: blueprintui
|
.. code-block:: blueprint
|
||||||
|
|
||||||
Dialog {
|
Dialog {
|
||||||
// Here, a child extension annotation defines the button's response.
|
// Here, a child extension annotation defines the button's response.
|
||||||
|
@ -176,7 +176,7 @@ Child extensions
|
||||||
Internal children
|
Internal children
|
||||||
+++++++++++++++++
|
+++++++++++++++++
|
||||||
|
|
||||||
.. code-block:: blueprintui
|
.. code-block:: blueprint
|
||||||
|
|
||||||
Dialog {
|
Dialog {
|
||||||
[internal-child content_area]
|
[internal-child content_area]
|
||||||
|
|
|
@ -15,7 +15,7 @@ Widget subclassing is one of the primary techniques for structuring an applicati
|
||||||
|
|
||||||
You could implement this with the following blueprint:
|
You could implement this with the following blueprint:
|
||||||
|
|
||||||
.. code-block:: blueprintui
|
.. code-block:: blueprint
|
||||||
|
|
||||||
using Gtk 4.0;
|
using Gtk 4.0;
|
||||||
|
|
||||||
|
@ -39,7 +39,7 @@ We can solve these problems by giving each widget its own blueprint file, which
|
||||||
|
|
||||||
For this to work, we need to specify in the blueprint which object is the one being instantiated. We do this with a template block:
|
For this to work, we need to specify in the blueprint which object is the one being instantiated. We do this with a template block:
|
||||||
|
|
||||||
.. code-block:: blueprintui
|
.. code-block:: blueprint
|
||||||
|
|
||||||
using Gtk 4.0;
|
using Gtk 4.0;
|
||||||
|
|
||||||
|
@ -56,7 +56,7 @@ This blueprint can only be used by the ``MapsHeaderBar`` constructor. Instantiat
|
||||||
|
|
||||||
This ``MapsHeaderBar`` class, along with its blueprint template, can then be referenced in another blueprint:
|
This ``MapsHeaderBar`` class, along with its blueprint template, can then be referenced in another blueprint:
|
||||||
|
|
||||||
.. code-block:: blueprintui
|
.. code-block:: blueprint
|
||||||
|
|
||||||
using Gtk 4.0;
|
using Gtk 4.0;
|
||||||
|
|
||||||
|
|
|
@ -45,7 +45,7 @@ The type of a ``typeof<>`` literal is `GType <https://docs.gtk.org/gobject/alias
|
||||||
Example
|
Example
|
||||||
~~~~~~~
|
~~~~~~~
|
||||||
|
|
||||||
.. code-block:: blueprintui
|
.. code-block:: blueprint
|
||||||
|
|
||||||
Gio.ListStore {
|
Gio.ListStore {
|
||||||
item-type: typeof<GObject.Object>;
|
item-type: typeof<GObject.Object>;
|
||||||
|
@ -66,7 +66,7 @@ Flags are used to specify a set of options. One or more of the available flag va
|
||||||
Example
|
Example
|
||||||
~~~~~~~
|
~~~~~~~
|
||||||
|
|
||||||
.. code-block:: blueprintui
|
.. code-block:: blueprint
|
||||||
|
|
||||||
Adw.TabView {
|
Adw.TabView {
|
||||||
shortcuts: control_tab | control_shift_tab;
|
shortcuts: control_tab | control_shift_tab;
|
||||||
|
@ -85,7 +85,7 @@ Translated Strings
|
||||||
|
|
||||||
Use ``_("...")`` to mark strings as translatable. You can put a comment for translators on the line above if needed.
|
Use ``_("...")`` to mark strings as translatable. You can put a comment for translators on the line above if needed.
|
||||||
|
|
||||||
.. code-block:: blueprintui
|
.. code-block:: blueprint
|
||||||
|
|
||||||
Gtk.Label label {
|
Gtk.Label label {
|
||||||
/* Translators: This is the main text of the welcome screen */
|
/* Translators: This is the main text of the welcome screen */
|
||||||
|
@ -94,7 +94,7 @@ Use ``_("...")`` to mark strings as translatable. You can put a comment for tran
|
||||||
|
|
||||||
Use ``C_("context", "...")`` to add a *message context* to a string to disambiguate it, in case the same string appears in different places. Remember, two strings might be the same in one language but different in another depending on context.
|
Use ``C_("context", "...")`` to add a *message context* to a string to disambiguate it, in case the same string appears in different places. Remember, two strings might be the same in one language but different in another depending on context.
|
||||||
|
|
||||||
.. code-block:: blueprintui
|
.. code-block:: blueprint
|
||||||
|
|
||||||
Gtk.Label label {
|
Gtk.Label label {
|
||||||
/* Translators: This is a section in the preferences window */
|
/* Translators: This is a section in the preferences window */
|
||||||
|
@ -118,7 +118,7 @@ The simplest bindings connect to a property of another object in the blueprint.
|
||||||
Example
|
Example
|
||||||
~~~~~~~
|
~~~~~~~
|
||||||
|
|
||||||
.. code-block:: blueprintui
|
.. code-block:: blueprint
|
||||||
|
|
||||||
/* Use bindings to show a label when a switch
|
/* Use bindings to show a label when a switch
|
||||||
* is active, without any application code */
|
* is active, without any application code */
|
||||||
|
|
|
@ -5,7 +5,7 @@ Translations
|
||||||
Blueprint files can be translated with xgettext. To mark a string as translated,
|
Blueprint files can be translated with xgettext. To mark a string as translated,
|
||||||
use the following syntax:
|
use the following syntax:
|
||||||
|
|
||||||
.. code-block::
|
.. code-block:: blueprint
|
||||||
|
|
||||||
_("translated string")
|
_("translated string")
|
||||||
|
|
||||||
|
@ -34,7 +34,7 @@ conflicts. Two strings that are the same in English, but appear in different
|
||||||
contexts, might be different in another language! To disambiguate, use ``C_``
|
contexts, might be different in another language! To disambiguate, use ``C_``
|
||||||
instead of ``_`` and add a context string as the first argument:
|
instead of ``_`` and add a context string as the first argument:
|
||||||
|
|
||||||
.. code-block::
|
.. code-block:: blueprint
|
||||||
|
|
||||||
C_("shortcuts window", "Quit")
|
C_("shortcuts window", "Quit")
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue