Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
fix linebreaks in function help and CASE (fixes #14189)
  • Loading branch information
jef-n committed Feb 25, 2016
1 parent 93ba5cd commit b89956e
Show file tree
Hide file tree
Showing 8 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion resources/function_help/json/$scale
@@ -1,7 +1,7 @@
{
"name": "$scale",
"type": "function",
"description": "Returns the current scale of the map canvas.\\n\\nNote: This function is only available in some contexts and will be 0 otherwise.",
"description": "Returns the current scale of the map canvas.<br><br>Note: This function is only available in some contexts and will be 0 otherwise.",
"examples": [
{ "expression":"$scale", "returns":"10000"}
]
Expand Down
2 changes: 1 addition & 1 deletion resources/function_help/json/CASE
@@ -1,5 +1,5 @@
{
"name": "CASE",
"type": "expression",
"description": "<pre>\\nCASE\\nWHEN <i>condition</i> THEN <i>result</i>\\n[ ...n ]\\n[ ELSE <i>result</i> ]\\nEND\\n</pre>\\n[ ] marks optional components\\n\\n<h4>Arguments</h4>\\n <i> WHEN condition</i> - The condition expression to evaluate. <br>\\n<i> THEN result</i> - If <i>condition</i> evaluates to True then <i>result</i> is evaluated and returned. <br>\\n<i> ELSE result</i> - If none of the above conditions evaluated to True then <i>result</i> is evaluated and returned. <br>\\n\\n<h4>Example</h4>\\n<pre>\\nCASE\\nWHEN <i>\"column\" IS NULL</i> THEN <i>'None'</i>\\n END\\n</pre>\\n"
"description": "<pre><br>CASE<br>WHEN <i>condition</i> THEN <i>result</i><br>[ ...n ]<br>[ ELSE <i>result</i> ]<br>END<br></pre>[ ] marks optional components<br><h4>Arguments</h4><br><i> WHEN condition</i> - The condition expression to evaluate. <br><br><i> THEN result</i> - If <i>condition</i> evaluates to True then <i>result</i> is evaluated and returned. <br><br><i> ELSE result</i> - If none of the above conditions evaluated to True then <i>result</i> is evaluated and returned.<br><br><h4>Example</h4><pre>CASE<br>WHEN <i>\"column\" IS NULL</i> THEN <i>'None'</i><br>END</pre>"
}
2 changes: 1 addition & 1 deletion resources/function_help/json/Field
@@ -1,6 +1,6 @@
{
"name": "Field",
"type": "group",
"description": "Double click to add field name to expression string.\\nRight-Click on field name to open context menu sample value loading options.",
"description": "Double click to add field name to expression string.<br>Right-Click on field name to open context menu sample value loading options.",
"notes": "Loading field values from WFS layers isn't supported, before the layer is actually inserted, ie. when building queries."
}
2 changes: 1 addition & 1 deletion resources/function_help/json/Fields and Values
@@ -1,6 +1,6 @@
{
"name": "Fields and Values",
"type": "group",
"description": "Contains a list of fields from the layer. Sample values can also be accessed via right-click.\\nSelect the field name from the list then right-click to access context menu with options to load sample values from the selected field.\\n",
"description": "Contains a list of fields from the layer. Sample values can also be accessed via right-click.<br>Select the field name from the list then right-click to access context menu with options to load sample values from the selected field.",
"notes": "Loading field values from WFS layers isn't supported, before the layer is actually inserted, ie. when building queries."
}
2 changes: 1 addition & 1 deletion resources/function_help/json/age
@@ -1,7 +1,7 @@
{
"name": "age",
"type": "function",
"description": "Returns the difference between two dates or datetimes.\nThe difference is returned as a <code>Interval</code> and needs to be used with one of the following functions in order to extract useful information:<br /><ul><li><code>year</code><li><code>month</code><li><code>week</code><li><code>day</code><li><code>hour</code><li><code>minute</code><li><code>second</code></ul>",
"description": "Returns the difference between two dates or datetimes.<br>The difference is returned as a <code>Interval</code> and needs to be used with one of the following functions in order to extract useful information:<br /><ul><li><code>year</code><li><code>month</code><li><code>week</code><li><code>day</code><li><code>hour</code><li><code>minute</code><li><code>second</code></ul>",
"arguments": [ {"arg":"datetime1","description":"a string, date or datetime representing the later date"},
{"arg":"datetime2","description":"a string, date or datetime representing the earlier date"}],
"examples": [ { "expression":"age('2012-05-12','2012-05-2')", "returns":"interval", "note":"use <code>day</code> to extract number of days"},
Expand Down
2 changes: 1 addition & 1 deletion resources/function_help/json/op_concat
@@ -1,7 +1,7 @@
{
"name": "||",
"type": "operator",
"description": "Joins two values together into a string.\n\nIf one of the values is NULL the result will be NULL. See the CONCAT function for a different behavior.",
"description": "Joins two values together into a string.<br><br>If one of the values is NULL the result will be NULL. See the CONCAT function for a different behavior.",
"arguments": [
{ "arg": "a", "description": "value" },
{ "arg": "b", "description": "value" }
Expand Down
4 changes: 2 additions & 2 deletions resources/function_help/json/wordwrap
Expand Up @@ -6,6 +6,6 @@
{"arg":"wrap_length","description":"an integer. If wrap_length is positive the number represents the ideal maximum number of characters to wrap; if negative, the number represents the minimum number of characters to wrap."},
{"arg":"delimiter_string","description":"the delimiter string to wrap to a new line (optional)."}
],
"examples": [ { "expression":"wordwrap('UNIVERSITY OF QGIS',13)", "returns":"'UNIVERSITY OF\nQGIS'"},
{ "expression":"wordwrap('UNIVERSITY OF QGIS',-3)", "returns":"'UNIVERSITY\nOF QGIS'"} ]
"examples": [ { "expression":"wordwrap('UNIVERSITY OF QGIS',13)", "returns":"'UNIVERSITY OF<br>QGIS'"},
{ "expression":"wordwrap('UNIVERSITY OF QGIS',-3)", "returns":"'UNIVERSITY<br>OF QGIS'"} ]
}
4 changes: 2 additions & 2 deletions src/core/qgsexpression.cpp
Expand Up @@ -4415,7 +4415,7 @@ QString QgsExpression::helptext( QString name )
helpContents += QString( "<h3>%1</h3>\n<div class=\"description\">%2</p></div>" ).arg( v.mName, v.mDescription );
}

if ( f.mType != tr( "group" ) )
if ( f.mType != tr( "group" ) && f.mType != tr( "expression" ) )
helpContents += QString( "<h4>%1</h4>\n<div class=\"syntax\">\n" ).arg( tr( "Syntax" ) );

if ( f.mType == tr( "operator" ) )
Expand All @@ -4431,7 +4431,7 @@ QString QgsExpression::helptext( QString name )
.arg( v.mArguments[0].mArg, name, v.mArguments[1].mArg );
}
}
else if ( f.mType != tr( "group" ) )
else if ( f.mType != tr( "group" ) && f.mType != tr( "expression" ) )
{
helpContents += QString( "<code><span class=\"functionname\">%1</span>" ).arg( name );

Expand Down

0 comments on commit b89956e

Please sign in to comment.