Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
},
}

src_trace_config_from_toml = "src_trace.toml"
src_trace_config_from_toml = "ubproject.toml"

###############################################################################
# SPHINX-NEEDS Config END
Expand Down
17 changes: 5 additions & 12 deletions docs/how-to-guides/trace-code/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,13 @@ Follow the installation instructions in the `CodeLinks documentation <https://co

**Step 2: Configure CodeLinks**

Create a file named ``src_trace.toml`` in your ``docs`` folder (next
to ``conf.py``) with the following content:
Add a ``[codelinks]`` section to your ``ubproject.toml`` (next to
``conf.py``) with the following content:

.. literalinclude:: ../../src_trace.toml
.. literalinclude:: ../../ubproject.toml
:language: toml
:caption: src_trace.toml
:caption: ubproject.toml (codelinks section)
:start-at: "[codelinks]"

**Step 3: Add the src-trace Directive**

Expand Down Expand Up @@ -78,11 +79,3 @@ Finally you can link from/to the traced source code lines like this:

This is a requirement that links to a need that has traced source code
lines.

.. note::

Current limitation: ``ubCode`` is not aware of this need id yet. This
means that the ``ubCode`` navigation inside Visual Studio Code will
not work and jumping from this ``rst`` file to the source code line
will not work. This will be implemented and supported in a future
release.
36 changes: 0 additions & 36 deletions docs/src_trace.toml

This file was deleted.

43 changes: 37 additions & 6 deletions docs/ubproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,6 @@ name = "X-as-Code (XaC)"
description = "Showcases for working with Sphinx-Needs"
srcdir = "."

[parse]
ignore_directives = [
# src-trace is not recognized by ubcode and produces a warning lint.
"src-trace"
]

# Rules for the ubCode formater, to get a nice looking documentation.
[format_rst]
fail_on_warning = []
Expand Down Expand Up @@ -408,3 +402,40 @@ src = "."
# ubCode setting: run a script command
[scripts]
sphinx = "sphinx-build -b html . _build/html"

[codelinks]
# Configuration for source tracing
set_local_url = false # Set to true to enable local code html and URL generation
local_url_field = "local" # Need's field name for local URL
set_remote_url = true # Set to true to enable remote url to be generated
remote_url_field = "remote-url" # Need's field name for remote URL


[codelinks.projects.x-as-code-cpp]
remote_url_pattern = "https://github.com/useblocks/x-as-code/blob/{commit}/{path}#L{line}" # URL pattern for remote source code

[codelinks.projects.x-as-code-cpp.source_discover]
src_dir = "../src" # Relative path from this TOML config to the source directory
include = [
"*.cpp",
"*.h"
]
exclude=[]
gitignore = true
comment_type = "cpp"

[codelinks.projects.x-as-code-cpp.analyse]
get_need_id_refs = true
get_oneline_needs = true
get_rst = true

[codelinks.projects.x-as-code-cpp.analyse.oneline_comment_style]
# start_sequence = "@"
# end_sequence for the online comments; default is an os-dependant newline character
field_split_char = ","
needs_fields = [
{ "name" = "title", "type" = "str" },
{ "name" = "id", "type" = "str" },
{ "name" = "type", "type" = "str", "default" = "impl" },
{ "name" = "links", "type" = "list[str]", "default" = [] },
]
1 change: 1 addition & 0 deletions src/ubproject.redirect.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
path = "../docs"
Loading