Write¶
The write
command is used to generate file formats such as reStructuredText from the markers extracted by the analyse
command.
This allows you to create documentation that includes links to source code based on the need ids specified in your code comments.
Example usage¶
With the following extracted markers fron the analyse
command,
{
"my_project": [
{
"filepath": "/home/demo/git_repo/ub/sphinx-codelinks/tests/data/need_id_refs/dummy_1.cpp",
"remote_url": "https://github.com/useblocks/sphinx-codelinks/blob/951e40e7845f06d5cfc4ca20ebb984308fdaf985/tests/data/need_id_refs/dummy_1.cpp#L3",
"source_map": {
"start": {"row": 2, "column": 13},
"end": {"row": 2, "column": 51}
},
"tagged_scope": "void dummy_func1(){\n //...\n }",
"need_ids": ["NEED_001", "NEED_002", "NEED_003", "NEED_004"],
"marker": "@need-ids:",
"type": "need-id-refs"
},
],
}
The following RST file with needextend directive can be generated by the write rst
command:
.. needextend:: NEED_001
:remote-url: https://github.com/useblocks/sphinx-codelinks/blob/951e40e7845f06d5cfc4ca20ebb984308fdaf985/tests/data/need_id_refs/dummy_1.cpp#L3
.. needextend:: NEED_002
:remote-url: https://github.com/useblocks/sphinx-codelinks/blob/951e40e7845f06d5cfc4ca20ebb984308fdaf985/tests/data/need_id_refs/dummy_1.cpp#L3
.. needextend:: NEED_003
:remote-url: https://github.com/useblocks/sphinx-codelinks/blob/951e40e7845f06d5cfc4ca20ebb984308fdaf985/tests/data/need_id_refs/dummy_1.cpp#L3
.. needextend:: NEED_004
:remote-url: https://github.com/useblocks/sphinx-codelinks/blob/951e40e7845f06d5cfc4ca20ebb984308fdaf985/tests/data/need_id_refs/dummy_1.cpp#L3
More examples can be found in test cases