Handle multiple parameter types in documentation.

This commit is contained in:
Viktor Kovacs 2023-01-14 12:49:01 +01:00
parent 643abf8fc6
commit 0ca1aedf6f
9 changed files with 21 additions and 19 deletions

View File

@ -99,7 +99,7 @@
<div class="method_description">Creates a clone of the object.</div>
<div class="method_title">Returns</div>
<div class="method_returns">
<span class="type return_type"><a href="Camera.html" target="_self">Camera</a></span>
<span class="type parameter_type"><a href="Camera.html" target="_self">Camera</a></span>
</div>
</div>

View File

@ -92,7 +92,7 @@
<div class="method_description">Creates a clone of the object.</div>
<div class="method_title">Returns</div>
<div class="method_returns">
<span class="type return_type"><a href="EdgeSettings.html" target="_self">EdgeSettings</a></span>
<span class="type parameter_type"><a href="EdgeSettings.html" target="_self">EdgeSettings</a></span>
</div>
</div>

View File

@ -180,7 +180,7 @@
<div class="method_description">Returns the underlying Viewer object.</div>
<div class="method_title">Returns</div>
<div class="method_returns">
<span class="type return_type">Viewer</span>
<span class="type parameter_type">Viewer</span>
</div>
</div>
<div class="method_container">
@ -189,7 +189,7 @@
<div class="method_description">Returns the underlying Model object.</div>
<div class="method_title">Returns</div>
<div class="method_returns">
<span class="type return_type">Model</span>
<span class="type parameter_type">Model</span>
</div>
</div>
<div class="method_container">

View File

@ -85,7 +85,7 @@
<div class="method_description">Creates a clone of the object.</div>
<div class="method_title">Returns</div>
<div class="method_returns">
<span class="type return_type"><a href="EnvironmentSettings.html" target="_self">EnvironmentSettings</a></span>
<span class="type parameter_type"><a href="EnvironmentSettings.html" target="_self">EnvironmentSettings</a></span>
</div>
</div>

View File

@ -86,7 +86,7 @@
</div>
<div class="method_title">Returns</div>
<div class="method_returns">
<span class="type return_type"><a href="EmbeddedViewer.html" target="_self">EmbeddedViewer</a></span>
<span class="type parameter_type"><a href="EmbeddedViewer.html" target="_self">EmbeddedViewer</a></span>
</div>
</div>

View File

@ -133,7 +133,7 @@
<div class="method_description">Creates a clone of the object.</div>
<div class="method_title">Returns</div>
<div class="method_returns">
<span class="type return_type"><a href="RGBAColor.html" target="_self">RGBAColor</a></span>
<span class="type parameter_type"><a href="RGBAColor.html" target="_self">RGBAColor</a></span>
</div>
</div>

View File

@ -119,7 +119,7 @@
<div class="method_description">Creates a clone of the object.</div>
<div class="method_title">Returns</div>
<div class="method_returns">
<span class="type return_type"><a href="RGBColor.html" target="_self">RGBColor</a></span>
<span class="type parameter_type"><a href="RGBColor.html" target="_self">RGBColor</a></span>
</div>
</div>

10
docs/static/style.css vendored
View File

@ -200,6 +200,7 @@ li
.parameter_name
{
font-family: monospace;
margin-right: 3px;
}
.type
@ -210,20 +211,15 @@ li
border-radius: 3px;
}
.parameter_type
{
margin-left: 3px;
}
.parameter_attributes
{
color: #888888;
margin-left: 3px;
}
.return_type
.return_description
{
margin-right: 3px;
margin-left: 3px;
}
.parameter_description

View File

@ -210,12 +210,19 @@ class ClassDoc:
GenerateMethodHtml (method, generator, navigation, False)
return generator.GetHtml ()
def GenerateParameterTypesHtml (paramTypes, generator, navigation):
for i in range (0, len (paramTypes)):
paramType = paramTypes[i]
paramTypeHtml = FinalizeType (paramType, navigation.entityLinks)
generator.AddTagWithClass ('span', 'type parameter_type', paramTypeHtml)
if (i < len (paramTypes) - 1):
generator.AddTagWithClass ('span', 'parameter_type_separator', '|')
def GenerateParameterListHtml (parameters, generator, navigation):
for param in parameters:
generator.BeginTagWithClass ('div', 'parameter_header')
generator.AddTagWithClass ('span', 'parameter_name', param.name)
typeNames = map (lambda x : FinalizeType (x, navigation.entityLinks), param.types)
generator.AddTagWithClass ('span', 'type parameter_type', ', '.join (typeNames))
GenerateParameterTypesHtml (param.types, generator, navigation)
if param.isOptional:
generator.AddTagWithClass ('span', 'parameter_attributes', '(optional)')
generator.EndTag ('div')
@ -242,8 +249,7 @@ def GenerateMethodHtml (method, generator, navigation, isConstructor):
generator.AddTagWithClass ('div', 'method_title', 'Returns')
generator.BeginTagWithClass ('div', 'method_returns')
if method.returns.types != None:
typeNames = map (lambda x : FinalizeType (x, navigation.entityLinks), method.returns.types)
generator.AddTagWithClass ('span', 'type return_type', ', '.join (typeNames))
GenerateParameterTypesHtml (method.returns.types, generator, navigation)
if method.returns.description != None:
generator.AddTagWithClass ('span', 'return_description', FinalizeDescription (method.returns.description, navigation.entityLinks))
generator.EndTag ('div')