Skip to content

Commit 4d961a6

Browse files
committed
[Doc] Use template variables for all snippet/example links
Absolute urls to tabris resources should be avoided in hand-written documentation. This change adds support for additional template variables that insert github urls. Added a README.md in the "tools" directory explaining which variables are available. Change-Id: I0eaf154a94fd0888f348795acff65aec8d4ffdd2
1 parent c169329 commit 4d961a6

13 files changed

+96
-56
lines changed

doc/api/Cell.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
]
2121
},
2222
"namespace": false,
23-
"description": "This widget is expected by [`ListView`](./ListView.md) as a child (in JSX) or turn value of `createCell`. It's data-binding enabled by default. It's children can also [not be selected](../selector.md#encapsulation) from the outside, except for using `apply` directly on the instance. This allows using it as a function component as demonstrated in [this example](https://github.com/eclipsesource/tabris-decorators/tree/v${doc:moduleversion}/examples/listview-cells-js).",
23+
"description": "This widget is expected by [`ListView`](./ListView.md) as a child (in JSX) or turn value of `createCell`. It's data-binding enabled by default. It's children can also [not be selected](../selector.md#encapsulation) from the outside, except for using `apply` directly on the instance. This allows using it as a function component as demonstrated in [this example](${doc:listview-cells-js}).",
2424
"properties": {
2525
"item": {
2626
"type": "ItemType",

doc/api/ColorResources.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@
1616
},
1717
{
1818
"title": "Defining raw color resource data in a separate JSON file.",
19-
"path": "https://github.com/eclipsesource/tabris-js/blob/v${doc:moduleversion}/snippets/resources/colors.json"
19+
"path": "${doc:snippetsUrl}/resources/colors.json"
2020
},
2121
{
2222
"title": "Converting raw color resource data to `ColorResources` instance.",
23-
"path": "https://github.com/eclipsesource/tabris-js/blob/v${doc:moduleversion}/snippets/resources/index.ts"
23+
"path": "${doc:snippetsUrl}/resources/index.ts"
2424
},
2525
{
2626
"title": "Using a ColorResources dictionary",
@@ -76,7 +76,7 @@
7676
{
7777
"name": "data",
7878
"type": "Data",
79-
"description": "The raw data (plain object) to create the dictionary from. The format must match the [Tabris.js colors JSON schema](https://github.com/eclipsesource/tabris-js/blob/v${doc:moduleversion}/schema/colors.json)."
79+
"description": "The raw data (plain object) to create the dictionary from. The format must match the [Tabris.js colors JSON schema](${doc:colors.json})."
8080
}
8181
],
8282
"returns": "ColorResources",
@@ -105,7 +105,7 @@
105105
{
106106
"name": "data",
107107
"type": "Data",
108-
"description": "The raw data (plain object) to create the dictionary from. The format must match the [Tabris.js colors JSON schema](https://github.com/eclipsesource/tabris-js/blob/v${doc:moduleversion}/schema/colors.json)."
108+
"description": "The raw data (plain object) to create the dictionary from. The format must match the [Tabris.js colors JSON schema](${doc:colors.json})."
109109
}
110110
],
111111
"returns": "ColorResources",
@@ -116,7 +116,7 @@
116116
"keyof Data"
117117
]
118118
},
119-
"description": "Creates a colors dictionary from the given raw \"data\" object. The format must match the [Tabris.js colors JSON schema](https://github.com/eclipsesource/tabris-js/blob/v${doc:moduleversion}/schema/colors.json). Entries in the \"data\" object starting with \"$\" are considered configuration options and will not become entries in the final colors dictionary."
119+
"description": "Creates a colors dictionary from the given raw \"data\" object. The format must match the [Tabris.js colors JSON schema](${doc:colors.json}). Entries in the \"data\" object starting with \"$\" are considered configuration options and will not become entries in the final colors dictionary."
120120
}
121121
]
122122
}

doc/api/FontResources.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@
1616
},
1717
{
1818
"title": "Defining raw font resource data in a separate JSON file.",
19-
"path": "https://github.com/eclipsesource/tabris-js/blob/v${doc:moduleversion}/snippets/resources/fonts.json"
19+
"path": "${doc:snippetsUrl}/resources/fonts.json"
2020
},
2121
{
2222
"title": "Converting raw font resource data to `FontResources` instance.",
23-
"path": "https://github.com/eclipsesource/tabris-js/blob/v${doc:moduleversion}/snippets/resources/index.ts"
23+
"path": "${doc:snippetsUrl}/resources/index.ts"
2424
},
2525
{
2626
"title": "Using a FontResources dictionary",
@@ -76,7 +76,7 @@
7676
{
7777
"name": "data",
7878
"type": "Data",
79-
"description": "The raw data (plain object) to create the dictionary from. The format must match the [Tabris.js fonts JSON schema](https://github.com/eclipsesource/tabris-js/blob/v${doc:moduleversion}/schema/fonts.json)."
79+
"description": "The raw data (plain object) to create the dictionary from. The format must match the [Tabris.js fonts JSON schema](${doc:fonts.json})."
8080
}
8181
],
8282
"returns": "FontResources",
@@ -105,7 +105,7 @@
105105
{
106106
"name": "data",
107107
"type": "Data",
108-
"description": "The raw data (plain object) to create the dictionary from. The format must match the [Tabris.js fonts JSON schema](https://github.com/eclipsesource/tabris-js/blob/v${doc:moduleversion}/schema/fonts.json)."
108+
"description": "The raw data (plain object) to create the dictionary from. The format must match the [Tabris.js fonts JSON schema](${doc:fonts.json})."
109109
}
110110
],
111111
"returns": "FontResources",
@@ -116,7 +116,7 @@
116116
"keyof Data"
117117
]
118118
},
119-
"description": "Creates a fonts dictionary from the given raw \"data\" object. The format must match the [Tabris.js fonts JSON schema](https://github.com/eclipsesource/tabris-js/blob/v${doc:moduleversion}/schema/fonts.json). Entries in the \"data\" object starting with \"$\" are considered configuration options and will not become entries in the final fonts dictionary."
119+
"description": "Creates a fonts dictionary from the given raw \"data\" object. The format must match the [Tabris.js fonts JSON schema](${doc:fonts.json}). Entries in the \"data\" object starting with \"$\" are considered configuration options and will not become entries in the final fonts dictionary."
120120
}
121121
]
122122
}

doc/api/TextResources.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@
1616
},
1717
{
1818
"title": "Defining raw text resource data in a separate JSON file.",
19-
"path": "https://github.com/eclipsesource/tabris-js/blob/v${doc:moduleversion}/snippets/resources/texts.json"
19+
"path": "${doc:texts.json}"
2020
},
2121
{
2222
"title": "Converting raw text resource data to `TextResources` instance.",
23-
"path": "https://github.com/eclipsesource/tabris-js/blob/v${doc:moduleversion}/snippets/resources/index.ts"
23+
"path": "${doc:snippetsUrl}/resources/index.ts"
2424
},
2525
{
2626
"title": "Using a TextResources dictionary",
@@ -76,7 +76,7 @@
7676
{
7777
"name": "data",
7878
"type": "Data",
79-
"description": "The raw data (plain object) to create the dictionary from. The format must match the [Tabris.js texts JSON schema](https://github.com/eclipsesource/tabris-js/blob/v${doc:moduleversion}/schema/texts.json)."
79+
"description": "The raw data (plain object) to create the dictionary from. The format must match the [Tabris.js texts JSON schema](${doc:texts.json})."
8080
}
8181
],
8282
"returns": "TextResources",
@@ -105,7 +105,7 @@
105105
{
106106
"name": "data",
107107
"type": "Data",
108-
"description": "The raw data (plain object) to create the dictionary from. The format must match the [Tabris.js texts JSON schema](https://github.com/eclipsesource/tabris-js/blob/v${doc:moduleversion}/schema/texts.json)."
108+
"description": "The raw data (plain object) to create the dictionary from. The format must match the [Tabris.js texts JSON schema](${doc:texts.json})."
109109
}
110110
],
111111
"returns": "TextResources",
@@ -116,7 +116,7 @@
116116
"keyof Data"
117117
]
118118
},
119-
"description": "Creates a texts dictionary from the given raw \"data\" object. The format must match the [Tabris.js texts JSON schema](https://github.com/eclipsesource/tabris-js/blob/v${doc:moduleversion}/schema/texts.json). Entries in the \"data\" object starting with \"$\" are considered configuration options and will not become entries in the final texts dictionary."
119+
"description": "Creates a texts dictionary from the given raw \"data\" object. The format must match the [Tabris.js texts JSON schema](${doc:texts.json}). Entries in the \"data\" object starting with \"$\" are considered configuration options and will not become entries in the final texts dictionary."
120120
}
121121
]
122122
}

doc/declarative-ui.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -328,10 +328,10 @@ const StyledText = attributes => TextView({textColor: 'red', ...attributes}, Sty
328328

329329
You can find further example snippets for functional components here:
330330

331-
* [JavaScript/JSX](https://playground.tabris.com/?snippet=functional-jsx-components.jsx)
332-
* [Pure JavaScript](https://playground.tabris.com/?snippet=functional-js-components.js)
333-
* [TypeScript/JSX](https://playground.tabris.com/?snippet=functional-jsx-components-typescript.tsx)
334-
* [Pure TypeScript](https://playground.tabris.com/?snippet=functional-js-components-typescript.tsx)
331+
* [JavaScript/JSX](${doc:functional-jsx-components.jsx})
332+
* [Pure JavaScript](${doc:functional-js-components.js})
333+
* [TypeScript/JSX](${doc:functional-jsx-components-typescript.jsx})
334+
* [Pure TypeScript](${doc:functional-js-components-typescript.js})
335335

336336
There are two categories of functional components, stateless and dynamic:
337337

@@ -373,7 +373,7 @@ function PersonDataView(attr) {
373373
}
374374
```
375375

376-
> You can also use the `<Setter>` element to define the change listener as seen [here for JavaScript/JSX](https://playground.tabris.com/?snippet=functional-jsx-components.jsx) and [here for TypeScript/JSX](https://playground.tabris.com/?snippet=functional-jsx-components-typescript.tsx).
376+
> You can also use the `<Setter>` element to define the change listener as seen [here for JavaScript/JSX](${doc:functional-jsx-components.jsx}) and [here for TypeScript/JSX](${doc:functional-jsx-components-typescript.tsx}).
377377
378378
The usage is as you would expect:
379379

doc/developer-app.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ Here you'll find a collection of example scripts that you can modify and try on
2323

2424
To load the playground script in your Developer App, go to the "URL" tab on the home screen and scan the QR code on the playground page. When you edit the code in the playground you only need to reload via the developer console or scan the QR code again.
2525

26-
You can also add your own scripts to the list by pressing "save". Note that these are stored only on your machine and will be lost if you clear your browser user data. The snippets [are also available in the tabris git repository](https://github.com/eclipsesource/tabris-js/tree/master/snippets).
26+
You can also add your own scripts to the list by pressing "save". Note that these are stored only on your machine and will be lost if you clear your browser user data. The snippets [are also available in the tabris git repository](${doc:snippetsUrl}).
2727

2828
## Code Sideloading
2929

doc/examples.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
## Snippets
66

7-
The `tabris-js` [repository](https://github.com/eclipsesource/tabris-js) contains dozens of [self-running snippets](https://github.com/eclipsesource/tabris-js/tree/v${doc:moduleversion}/snippets) demonstrating all **features of the Tabris.js core module**. These can be run directly from the [Tabris.js Playground](https://playground.tabris.com/) via the [Tabris.js Developer App](./developer-app.md). The API documentation example links point to the snippets in the playground.
7+
The `tabris-js` [repository](https://github.com/eclipsesource/tabris-js) contains dozens of [self-running snippets](${doc:snippetsUrl}) demonstrating all **features of the Tabris.js core module**. These can be run directly from the [Tabris.js Playground](https://playground.tabris.com/) via the [Tabris.js Developer App](./developer-app.md). The API documentation example links point to the snippets in the playground.
88

99
You can also run a selection of UI-related snippets directly in the app without the playground.
1010

@@ -13,7 +13,7 @@ All snippets use declarative UI and ES6 Module Syntax. Most also use JSX, and so
1313
## Databinding Examples
1414

1515
The `tabris-decorators` [repository](https://github.com/eclipsesource/tabris-decorators) contains minimalistic
16-
[**databinding** and **redux** examples](https://github.com/eclipsesource/tabris-decorators/tree/v${doc:moduleversion}/examples) as complete tabris projects. The **ListView** and **ItemPicker** widgets (high-level extensions of `CollectionView` and `Picker`) are also demonstrated only here. They are also linked in the databinding documentation.
16+
[**databinding** and **redux** examples](${doc:examplesUrl}) as complete tabris projects. The **ListView** and **ItemPicker** widgets (high-level extensions of `CollectionView` and `Picker`) are also demonstrated only here. They are also linked in the databinding documentation.
1717

1818
The examples can be easily run without local setup via the GitPod links provided in the README.md files. A GitHub account is required. The READMEs also contain comprehensive descriptions for each example.
1919

doc/getting-started.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ In the project directory, type `npm start`. This will start the development serv
4545

4646
Swipe from the right edge of the screen to open the developer console, which lets you restart the script or go back to the Developer App.
4747

48-
Now you can start developing. You may want to have a look at the rest of the documentation and [the Tabris.js snippets](https://github.com/eclipsesource/tabris-js/tree/master/snippets).
48+
Now you can start developing. You may want to have a look at the rest of the documentation and [the Tabris.js snippets](${doc:snippetsUrl}).
4949

5050
## Publishing your app
5151

doc/permissions.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ async function requestPermissions(...permissions) {
203203

204204
The following snippets demonstrate how to use the `tabris.permission` API.
205205

206-
* [permission.jsx](https://playground.tabris.com/?gitref=v3.1.0&snippet=permission.jsx)
207-
* [permission-advanced.tsx](https://playground.tabris.com/?gitref=v3.1.0&snippet=permission-advanced.tsx)
206+
* [permission.jsx](${doc:permission.jsx})
207+
* [permission-advanced.tsx](${doc:permission-advanced.tsx})
208208

209209
Also see the [Android](https://developer.android.com/guide/topics/permissions/overview) and [iOS](https://developer.apple.com/design/human-interface-guidelines/ios/app-architecture/requesting-permission/) documentation on permission.

doc/resource-management.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ Create a separate directory dedicated to your resource dictionaries. The example
6464
6565
If your project has a `tsconfig.json` or `jsconfig.json` make sure it contains the compiler option `"resolveJsonModule": true`. This makes it possible to consume the _.json_ files as modules without loosing type safety.
6666
67-
The `index.js` (or `index.ts`) module will take care of converting the raw data to resources dictionaries and exporting them from the `resources` directory. (Hint: A file named "index.js" allows [treating an entire directory as a single module](https://nodejs.org/api/modules.html#modules_folders_as_modules).) An example for this can be found [here](https://github.com/eclipsesource/tabris-js/blob/v${doc:moduleversion}/snippets/resources/index.ts).
67+
The `index.js` (or `index.ts`) module will take care of converting the raw data to resources dictionaries and exporting them from the `resources` directory. (Hint: A file named "index.js" allows [treating an entire directory as a single module](https://nodejs.org/api/modules.html#modules_folders_as_modules).) An example for this can be found [here](${doc:snippets}/resources/index.ts).
6868
6969
> Note: You don't need to follow this exact layout of course, but it is the assumed configuration used in all examples below.
7070

0 commit comments

Comments
 (0)