doc: using `desc_addname` doesn't allow for line breaks.

The method `desc_addname` adds arguments to the name of the node, and hence does not allow for line breaks. In the case of Dynare commands we don't run into a problem with this but we run into this problem with longer MATLAB/Octave commands.

For Dynare commands, we don't run into the problem with commands running over the page width as we use placeholders like `OPTIONS` since the order of the parameters passed to a command is irrelevant

For MATLAB/Octave commands, the order of parameters passed to a function is important, hence we cannot use a placeholder such as `OPTIONS`

closes #1688
parent b4479361
Pipeline #2826 passed with stages
in 77 minutes and 14 seconds
# -*- coding: utf-8 -*-
# Copyright (C) 2018-2019 Dynare Team
# Copyright (C) 2018-2020 Dynare Team
#
# This file is part of Dynare.
#
......@@ -82,6 +82,17 @@ class DynObject(ObjectDescription):
if self.has_arguments:
if not arglist:
signode += addnodes.desc_parameterlist()
elif isinstance(self, MatComm):
# Handle arguments of MATLAB/Octave commands differently
# using `desc_addname` doesn't allow for line wrapping
# Issue: dynare#1688
if arglist.startswith('('):
arglist = arglist[1:]
if arglist.endswith(';'):
arglist = arglist[:-1]
if arglist.endswith(')'):
arglist = arglist[:-1]
signode += addnodes.desc_parameterlist(arglist,arglist)
else:
signode += addnodes.desc_addname(arglist,arglist)
return fullname, prefix
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment