diff options
author | Carlos Garnacho <carlosg@gnome.org> | 2023-02-25 18:53:49 +0100 |
---|---|---|
committer | Carlos Garnacho <carlosg@gnome.org> | 2023-02-27 09:18:57 +0100 |
commit | 26ee267e186310be0bc78daeeba6391008cad70e (patch) | |
tree | 53bb161b21edf81833d5188151ed46146aae03f0 /docs | |
parent | 41f4297ce02f9b8176f6d740e20b35c950978d64 (diff) | |
download | tracker-26ee267e186310be0bc78daeeba6391008cad70e.tar.gz |
docs: Make the examples document go through file embedding
This document has some embedded code examples, these should be
embedded into the final markdown document.
Diffstat (limited to 'docs')
-rw-r--r-- | docs/reference/libtracker-sparql/examples.md.in (renamed from docs/reference/libtracker-sparql/examples.md) | 76 | ||||
-rw-r--r-- | docs/reference/libtracker-sparql/meson.build | 19 |
2 files changed, 50 insertions, 45 deletions
diff --git a/docs/reference/libtracker-sparql/examples.md b/docs/reference/libtracker-sparql/examples.md.in index 524637c06..37e4ca22b 100644 --- a/docs/reference/libtracker-sparql/examples.md +++ b/docs/reference/libtracker-sparql/examples.md.in @@ -29,21 +29,20 @@ main loop is not blocked while these operations are executed. Once you end up with the query, remember to call [method@Tracker.SparqlCursor.close]. The same applies to [method@Tracker.SparqlConnection.close] when no longer needed. -<div class="gi-lang-c"> - +In C: +```c {{ examples/connection-example.c }} +``` -</div> -<div class="gi-lang-python"> - +In Python: +```python {{ examples/connection-example.py }} +``` -</div> -<div class="gi-lang-javascript"> - +In Javascript: +```js {{ examples/connection-example.js }} - -</div> +``` ## Creating a private database @@ -65,21 +64,20 @@ main loop is not blocked while these operations are executed. Once you no longer need the connection, remember to call [method@Tracker.SparqlConnection.close]. -<div class="gi-lang-c"> - +In C: +```c {{ examples/private-store-example.c }} +``` -</div> -<div class="gi-lang-python"> - +In Python: +```python {{ examples/private-store-example.py }} +``` -</div> -<div class="gi-lang-javascript"> - +In Javascript: +```js {{ examples/private-store-example.js }} - -</div> +``` ## Creating a SPARQL endpoint @@ -92,21 +90,20 @@ concretely the creation of a D-Bus endpoint, that other applications may query e.g. through a connection created with [ctor@Tracker.SparqlConnection.bus_new]. -<div class="gi-lang-c"> - +In C: +```c {{ examples/endpoint-example.c }} +``` -</div> -<div class="gi-lang-python"> - +In Python: +``` python {{ examples/endpoint-example.py }} +``` -</div> -<div class="gi-lang-javascript"> - +In Javascript: +```js {{ examples/endpoint-example.js }} - -</div> +``` ## Receiving notification on changes @@ -119,18 +116,17 @@ on changes of certain RDF classes (Those with the This example demonstrates the use of [class@Tracker.Notifier] to receive notifications on database updates. -<div class="gi-lang-c"> - +In C: +```c {{ examples/notifier-example.c }} +``` -</div> -<div class="gi-lang-python"> - +In Python: +```python {{ examples/notifier-example.py }} +``` -</div> -<div class="gi-lang-javascript"> - +In Javascript: +```js {{ examples/notifier-example.js }} - -</div> +``` diff --git a/docs/reference/libtracker-sparql/meson.build b/docs/reference/libtracker-sparql/meson.build index b348795b7..7e987eb54 100644 --- a/docs/reference/libtracker-sparql/meson.build +++ b/docs/reference/libtracker-sparql/meson.build @@ -75,9 +75,18 @@ foreach doc : generated_files depends: [base_ontology_docs, nepomuk_ontology_docs]) endforeach +examples = custom_target( + 'examples', + input: 'examples.md.in', + output: 'examples.md', + command: [ + 'embed-files.py', + '@INPUT@', + '@OUTPUT@', + ]) + +overview = ['overview.md'] content = [ - 'overview.md', - 'examples.md', 'tutorial.md', 'ontologies.md', 'sparql-functions.md', @@ -90,7 +99,7 @@ content = [ # The TOML gi-docgen configuration wants a list of quoted file names. content_quoted = [] -foreach c : content + generated_content +foreach c : overview + fs.name(examples.full_path()) + content + generated_content content_quoted += '"@0@"'.format(c) endforeach @@ -117,8 +126,8 @@ reference = custom_target( '--content-dir=@0@'.format(meson.current_build_dir()), '@INPUT1@', ], - depends: [tracker_sparql_gir[0], generated_targets], - depend_files: content) + depends: [tracker_sparql_gir[0], generated_targets, examples], + depend_files: [overview, content]) docs_name = 'Tracker-3.0' meson.add_install_script('install-devhelp.sh', docs_name, reference) |