Skip to content

Commit

Permalink
doc: Fix indentation and rendering of RST code blocks
Browse files Browse the repository at this point in the history
  • Loading branch information
edalm committed Jan 9, 2024
1 parent eb69939 commit 5104b82
Show file tree
Hide file tree
Showing 4 changed files with 63 additions and 63 deletions.
102 changes: 51 additions & 51 deletions doc/contributing/source/coding-style.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1159,44 +1159,44 @@ expressions in if statements and variable declarations.

For instance, the following code:

.. sourcecode:: cpp
.. sourcecode:: cpp

bool IsPositive(int n)
{
if (n > 0)
{
return true;
}
else
{
return false;
}
}
bool IsPositive(int n)
{
if (n > 0)
{
return true;
}
else
{
return false;
}
}

void ProcessNumber(int n)
{
if (IsPositive(n) == true)
{
...
}
}
void ProcessNumber(int n)
{
if (IsPositive(n) == true)
{
...
}
}

can be rewritten as:

.. sourcecode:: cpp
.. sourcecode:: cpp

bool IsPositive(int n)
{
return n > 0;
}
bool IsPositive(int n)
{
return n > 0;
}

void ProcessNumber(int n)
{
if (IsPositive(n))
{
...
}
}
void ProcessNumber(int n)
{
if (IsPositive(n))
{
...
}
}

Smart pointer boolean comparisons
=================================
Expand Down Expand Up @@ -1608,23 +1608,23 @@ add the following configuration to ``.vscode/settings.json``:

.. sourcecode:: json

{
"editor.formatOnPaste": true,
"editor.formatOnSave": true,
"editor.formatOnType": true,
"[python]": {
"editor.defaultFormatter": "ms-python.black-formatter",
"editor.codeActionsOnSave": {
"source.organizeImports": "explicit",
},
},
"black-formatter.args": [
"--config",
"pyproject.toml",
],
"isort.check": true,
"isort.args": [
"--sp",
"pyproject.toml",
],
}
{
"editor.formatOnPaste": true,
"editor.formatOnSave": true,
"editor.formatOnType": true,
"[python]": {
"editor.defaultFormatter": "ms-python.black-formatter",
"editor.codeActionsOnSave": {
"source.organizeImports": "explicit",
},
},
"black-formatter.args": [
"--config",
"pyproject.toml",
],
"isort.check": true,
"isort.args": [
"--sp",
"pyproject.toml",
],
}
8 changes: 4 additions & 4 deletions doc/manual/source/callbacks.rst
Original file line number Diff line number Diff line change
Expand Up @@ -511,8 +511,8 @@ with one or more bound arguments::

template <typename T, typename ARG, typename BOUND_ARG>
class SpecificFunctor : public Functor
{
public:
{
public:
SpecificFunctor(T* p, int (T::*_pmi)(ARG arg), BOUND_ARG boundArg)
{
m_p = p;
Expand All @@ -524,11 +524,11 @@ with one or more bound arguments::
{
(*m_p.*m_pmi)(m_boundArg, arg);
}
private:
private:
void (T::*m_pmi)(ARG arg);
T* m_p;
BOUND_ARG m_boundArg;
};
};

You can see that when the specific functor is created, the bound argument is saved
in the functor / callback object itself. When the ``operator()`` is invoked with
Expand Down
2 changes: 1 addition & 1 deletion doc/manual/source/events.rst
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ or by using a command line argument

.. sourcecode:: terminal

$ ./ns3 run "... -SimulatorImplementationType=ns3::DistributedSimulatorImpl"
$ ./ns3 run "... --SimulatorImplementationType=ns3::DistributedSimulatorImpl"

In addition to the basic simulator engines there is a general facility used
to build "adapters" which provide small behavior modifications to one of
Expand Down
14 changes: 7 additions & 7 deletions doc/manual/source/working-with-cmake.rst
Original file line number Diff line number Diff line change
Expand Up @@ -73,13 +73,13 @@ print the configuration options:
~$ cd ns-3-dev
~/ns-3-dev$ ./ns3 configure --help
usage: ns3 configure [-h] [-d {debug,release,optimized}] [-G G]
[--cxx-standard CXX_STANDARD] [--enable-asserts]
[--disable-asserts] [--enable-examples]
[--disable-examples] [--enable-logs]
[--disable-logs] [--enable-tests]
[--disable-tests] [--enable-verbose]
[--disable-verbose]
...
[--cxx-standard CXX_STANDARD] [--enable-asserts]
[--disable-asserts] [--enable-examples]
[--disable-examples] [--enable-logs]
[--disable-logs] [--enable-tests]
[--disable-tests] [--enable-verbose]
[--disable-verbose]
...

positional arguments:
configure
Expand Down

0 comments on commit 5104b82

Please sign in to comment.