Debian Codegraph @

devel-docs/devel_docs_mod_guide.rst

raw
1 :orphan:
2
3 Modifying the development guide
4 ===============================
5
6 The following are guidelines and tips for modifying this guide.
7
8 Extra reStructuredText roles
9 ----------------------------
10
11 Aside, the `roles provided out-of-the box
12 <https://www.sphinx-doc.org/en/master/usage/restructuredtext/roles.html>`_,
13 some 3rd-party and custom roles may also be used.
14
15 Referencing issues, commits, users, etc
16 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
17
18 All roles provided by the `sphinx-issues
19 <https://github.com/sloria/sphinx-issues>`_ extension may be used as
20 described on its page but note that the repository-related and user roles
21 are restricted to the ``gitlab.gnome.org`` GitLab instance e.g:
22
23 - ``:user:`federico``` -> :user:`federico`,
24 - ``:issue:`GNOME/gnome-shell#5415``` -> :issue:`GNOME/gnome-shell#5415`,
25
26 and the default repository for the repository-related roles is
27 `GNOME/librsvg <https://gitlab.gnome.org/GNOME/librsvg>`_ e.g:
28
29 - ``:issue:`1``` -> :issue:`1`,
30 - ``:commit:`550ba0c83939dfd0e829528dc8175639ad92dd83```
31 -> :commit:`550ba0c83939dfd0e829528dc8175639ad92dd83`.
32
33 Referencing the source tree
34 ~~~~~~~~~~~~~~~~~~~~~~~~~~~
35
36 .. rst:role:: source
37
38 References entries in the librsvg source tree.
39
40 The target should be a valid path to an entry in the source tree
41 relative to the source tree root, which may be prepended with a branch
42 name, tag name or commit hash to reference the source tree at that
43 branch, tag or commit.
44
45 In other words, the target is of the form ``[<ref>:][<path>]``.
46 ``<ref>:`` may be omitted to reference the default branch (``main``) and
47 ``<path>`` may be omitted to reference the source tree root.
48
49 For example:
50
51 - ``:source:`rsvg/src/``` -> :source:`rsvg/src/`
52 - ``:source:`Maintainers <README.md#maintainers>```
53 -> :source:`Maintainers <README.md#maintainers>`
54 - ``:source:`550ba0c83939dfd0e829528dc8175639ad92dd83:rsvg/src/```
55 -> :source:`550ba0c83939dfd0e829528dc8175639ad92dd83:rsvg/src/`
56 - ``:source:`2.59's README <2.59.0:README.md>```
57 -> :source:`2.59's README <2.59.0:README.md>`
58 - ``:source:`2.59.1:``` -> :source:`2.59.1:`
59
60 To add to or modify these roles see
61 :source:`devel-docs/_extensions/source.py`.
62
63 Referencing the internals documentation
64 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
65
66 The following reference entities in the library's internals documentation:
67
68 .. rst:role:: internals:crate
69
70 This references a crate.
71
72 The target should be the name of the crate e.g
73 ``:internals:crate:`librsvg_c``` -> :internals:crate:`librsvg_c`.
74
75 .. rst:role:: internals:module
76
77 This references a module.
78
79 The target should be a rust-style reference for the module e.g:
80
81 - ``:internals:module:`rsvg::api``` -> :internals:module:`rsvg::api`
82 - ``:internals:module:`rsvg::xml::xml2```
83 -> :internals:module:`rsvg::xml::xml2`
84 - ``:internals:module:`librsvg_c::handle <librsvg_c::handle>```
85 -> :internals:module:`librsvg_c::handle <librsvg_c::handle>`
86
87 .. rst:role:: internals:struct
88 .. rst:role:: internals:enum
89 .. rst:role:: internals:trait
90 .. rst:role:: internals:type
91 .. rst:role:: internals:fn
92 .. rst:role:: internals:macro
93 .. rst:role:: internals:constant
94 .. rst:role:: internals:static
95
96 These reference top-level entities.
97
98 The target should be the rust-style fully-qualified reference for an
99 entity e.g:
100
101 - ``:internals:enum:`rsvg::RenderingError```
102 -> :internals:enum:`rsvg::RenderingError`
103 - ``:internals:struct:`librsvg_c::handle::RsvgHandle```
104 -> :internals:struct:`librsvg_c::handle::RsvgHandle`
105 - ``:internals:fn:`rsvg::drawing_ctx::draw_tree```
106 -> :internals:fn:`rsvg::drawing_ctx::draw_tree`
107 - ``:internals:constant:`rsvg::xml::xml2::XML_SAX2_MAGIC```
108 -> :internals:constant:`rsvg::xml::xml2::XML_SAX2_MAGIC`
109
110 .. rst:role:: internals:struct-field
111 .. rst:role:: internals:struct-method
112 .. rst:role:: internals:enum-variant
113 .. rst:role:: internals:trait-method
114 .. rst:role:: internals:trait-tymethod
115
116 These reference members of structs, enums, etc.
117
118 The target should be the rust-style **fully-qualified** reference for a
119 member entity. This normally renders as ``<parent>::<member>`` but the
120 reference target may be prepended by a ``~`` (tilde) to render as just
121 ``<member>``.
122
123 For example:
124
125 - ``:internals:struct-field:`rsvg::Length::unit```
126 -> :internals:struct-field:`rsvg::Length::unit`
127 - ``:internals:struct-method:`rsvg::element::Element::new```
128 -> :internals:struct-method:`rsvg::element::Element::new`
129 - ``:internals:struct-method:`~rsvg::element::Element::new```
130 -> :internals:struct-method:`~rsvg::element::Element::new`
131 - ``:internals:enum-variant:`rsvg::RenderingError::InvalidId```
132 -> :internals:enum-variant:`rsvg::RenderingError::InvalidId`
133
134 .. note::
135
136 :rst:role:`internals:trait-method` references a **provided** trait
137 method i.e a trait method that has a default implementation, such as
138 :internals:trait-method:`rsvg::element::ElementTrait::draw`;
139 while :rst:role:`internals:trait-tymethod` references a **required**
140 trait method i.e a trait method that only has a prototype, such as
141 :internals:trait-tymethod:`rsvg::length::Normalize::normalize`.
142
143 To reference a struct's implementation of a trait's method, use
144 :rst:role:`internals:struct-method`.
145
146 To add to or modify these roles see
147 :source:`devel-docs/_extensions/internals.py`.
148
149 Referencing RUSTSEC advisories
150 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
151
152 .. rst:role:: rustsec
153
154 References the official page of a RUSTSEC advisory.
155
156 The target should be the ID of the advisory e.g
157 ``:rustsec:`2020-0146``` -> :rustsec:`2020-0146`.