Confluence 5 User Macro parameters limitations? - macros

I'm writing a User Macro in Confluence 5 and I found that the 10th parameter is not being interpreted.
This is my macro header:
## #param ArtifactVersion:title=Artifact Version|type=string|required=true
## #param Contacts:title=Contacts|type=string|required=true
## #param Date:title=Date|type=date|required=true
## #param RollbackVersion:title=Rollback Version|type=string|required=true
## #param QaEngineer:title=QA Engineer|type=string|required=false
## #param ArtifactId:title=Artifact Id|type=string|required=true
## #param SiteName:title=Site Name|type=string|required=true
## #param Servers:title=Servers|type=string|required=true
## #param Instance:title=Instance|type=enum|enumValues=0,1,2,3,4,5,6,7,8,9,10|required=true
## #param MyParam:title=My Param|type=string|required=true
If I add another param (MyParam) then it is not being interpreted. It just prints $paramMyParam literally.

I'm fairly certain that there is an underlying limitation of 9 params in Confluence user macros. Whether or not this is a deliberate design decision, a limitation of the underlying architecture, or simply an oversight/bug, I cannot say.
If this is a deal-breaker for your macro, you could consider re-writing it as a fully-fledged Macro module using a Java plugin.

I am not certain you can have the 10th parameter, but I believe you could combine 2 parameters into 1 to allow room for the last one.
Artifact version and Artifact ID sound like they could be parsed out of the same string, similar to the way you would do so for the list of servers you have for your 8th parameter.

Related

JSDoc: make param required/optional based on another param

I have two parameters, limit and page. If page is passed, limit is required. Otherwise, limit is optional. Below is my current JSDoc. How can I modify it (if this is possible) to properly show the relationship between the two?
/**
* ...
* #param {Number} [ctx.request.body.limit] A limit on the number of items to return
* #param {Number} [ctx.request.body.page] The page we are currently on. A `limit` must also be
* given when using this parameter
*/

Doxygen repeating text

In all my APIs I have a line of text that gets repeated. Is there a way to put that text in one place and link to it from the APIs?
For instance, in the below example, how to put the 'text that is common for many APIs' in one place, instead of writing the same thing in all the APIs?
/**
* #brief Function description
* #param [in] param function param description
* #return return description
*
* #attention text that is common for many APIs
***********************************************************************/
int func(int param);
In case it is always the same line, best would be to define a special command for it by means of and alias in the doxygen configuration file (Doxyfile), see the tag ALIASES
For longer texts the doxygen command \includedoc would be the way to go.

What does the expression ## mean in Chisel?

I've been looking all over the web to find out what the expression ## means in chisel, but can't find it anywhere.
For example in this code snippet:
val ways = Module(new BRAM(log2Up(conf.lines), conf.ways * line_size))
val din = Vec.fill(conf.ways) { Bits(width=line_size) }
if(conf.ways == 2) {
ways.io.din := din(1) ## din(0)
}
What is the line in the if-statement doing using the ## expression?
Thanks!
Since you can't really google for symbolic characters such as #, you'll need to find the documentation for the ## method another way. The simplest way would be to just hover over ## in your IDE and let it display the API doc. If this isn't possible because your IDE doesn't do that or you haven't downloaded the API docs, you can find the docs for whichever class the method is called on and look it up there.
In this case you're calling ## on din(1). Since din is a vector of Bits, din(1) is a Bits object. So we can look up the Bits class in the Chisel API docs and find the following on ##:
def ##(other: Bits): UInt
Returns this wire concatenated with other, where this wire forms the most significant part and other forms the least significant part.
The width of the output is sum of the inputs.

Set type for variables from form data in Lumen framework.

If I send form in Lumen, data can be validated via validate method. For example, in some method in some controller:
$this->validate($request, [
'id' => 'required|integer|exists:user',
]);
$user_id = $request->input('id');
But variable type of $user_id still string. Is there any built in (in framework) methods for getting variable in type which I write? In this case is integer.
I use intval() now.
Unfortunately, to my knowledge there's no way to define what types input should have in Laravel/Lumen when the value is accessed.
PHP interprets all user input as strings (or arrays of strings).
In Illuminate\Validation\Validator, the method that determines if a value is an integer uses filter_var() to test if the string value provided by the user conforms to the rules of the int type.
Here's what it's actually doing:
/**
* Validate that an attribute is an integer.
*
* #param string $attribute
* #param mixed $value
* #return bool
*/
protected function validateInteger($attribute, $value)
{
if (! $this->hasAttribute($attribute)) {
return true;
}
return is_null($value) || filter_var($value, FILTER_VALIDATE_INT) !== false;
}
Alas, it does not then update the type of the field it checks, as you have seen.
I think your use of intval() is probably the most appropriate option if you absolutely need the value of the user_id field to be interpreted as an integer.
Really the only caveat of using intval() is that it is limited to returning integers according to your operating system.
From the documentation (http://php.net/manual/en/function.intval.php):
32 bit systems have a maximum signed integer range of -2147483648 to 2147483647. So for example on such a system, intval('1000000000000') will return 2147483647. The maximum signed integer value for 64 bit systems is 9223372036854775807.
So as long as you keep your user-base to less than 2,147,483,647 users, you shouldn't have any issues with intval() if you're on a 32-bit system. Wouldn't we all be so lucky as to have to worry about having too many users?
Joking aside, I bring it up because if you're using intval() for a user-entered number that might be huge, you run the risk of hitting that cap. Probably not a huge concern though.
And of course, intval() will return 0 for non-numeric string input.

Doxygen - how to document a variable so I can see its type

I'm sorry if it sounds too simple a question but still ...
I am documenting php code and whereas all functions etc. look good in the generated documentation,
I have problems with variable types which should be visible in the generated documentation.
I document them in this way:
/**
* $request - request object
*
* #type int
* #access private
*/
private $request;
As a result, I can see 'int' in the generated documentation, but #type is not a correct command. The proper command would be #var instead of #type but then I cannot see the type of the variable in the documentation.
So the question is "How to document a variable so I can see its type?"
Please help :)