Doxygen: Struct fields are documented on two lines - doxygen

In the HTML output of Doxygen, all my structs are documented in a table, where the field in on one row and the description is on the next row and I believe that is harder to read. Is there a way to stop that?
Example
------------------------------------------------------------------
| struct field | |
| | struct field description |
------------------------------------------------------------------
Or, the specific HTML:
<tr class="memitem:a484f4be31b797e3cf9c0f8abb2d71064">
<td class="memItemLeft" >double <b>time</b></td>
</tr>
<tr class="memdesc:a484f4be31b797e3cf9c0f8abb2d71064">
<td class="mdescLeft"></td>
<td class="mdescRight">time in secs <br /></td>
</tr>
Desired:
------------------------------------------------------------------
| struct field | struct field description |
------------------------------------------------------------------
<tr class="memitem:a484f4be31b797e3cf9c0f8abb2d71064">
<td class="memItemLeft" >double <b>time</b></td>
<td class="mdescRight">time in secs <br /></td>
</tr>
Edit
Example struct:
struct example {
double time; //!< time in secs
};
Doxyfile differences
# Doxyfile 1.9.3
OPTIMIZE_OUTPUT_FOR_C = YES
BUILTIN_STL_SUPPORT = YES
CPP_CLI_SUPPORT = YES
DISTRIBUTE_GROUP_DOC = YES
SHOW_USED_FILES = NO
LAYOUT_FILE = layout.xml
QUIET = YES
WARN_NO_PARAMDOC = YES
RECURSIVE = YES
EXCLUDE_PATTERNS = */x64/*
STRIP_CODE_COMMENTS = NO
VERBATIM_HEADERS = NO
HTML_OUTPUT = html
GENERATE_TREEVIEW = YES
SEARCHENGINE = NO
GENERATE_LATEX = NO
HAVE_DOT = YES
COLLABORATION_GRAPH = NO
DOT_PATH = "C:\Program Files (x86)\Graphviz2.38\bin"
DOT_MULTI_TARGETS = YES
GENERATE_LEGEND = NO
Edit 2
Sometimes it occurs, and sometimes it does not, and I haven't been able to figure out the rules for selection yet. An anonymous struct in a class definition seems to always choose the "bad" path though
class test {
public:
struct {
double time; //!< time in secs
} temp;
}

Related

How to use filelink title instead of filename

i want to show the title of a file instead of the filename.
version 6.0.14
my typoscript:
tt_content.uploads.20.renderObj.20.wrap = <span class="csc-uploads-fileName"><i class="fileicon-"></i>|</span>
tt_content.uploads.20.itemRendering.30.if.isTrue.field = true
tt_content.uploads.20.renderObj.10.file.width = 80
tt_content.uploads.20.renderObj.40.bytes.labels = Byte | KB | MB | GB
tt_content.uploads.20.renderObj.40.wrap = <span class="badge">|</span>
i tried
tt_content.uploads.20.renderObj.20.data = file:current:title
but i wont to show the filename if the title is empty. i dont know how to do it ...
if you are using Version 6.x use:
tt_content.uploads.20.renderObj.20.data = file:current:description // file:current:name
if you are using an older version try to use that (not tested but should work):
tt_content.uploads.20.labelStdWrap.override.if.isTrue.data = register:description
tt_content.uploads.20.labelStdWrap.override.data = register:description
tt_content.uploads.20.labelStdWrap.insertData = 1

Github markdown, syntax highlight of code blocks in the table cell

Markdown has pipe table syntax but it's not enough for some cases.
| table | syntax | without multiline cell content |
So, we can use HTML table tags.
<table>
<tr>
<td>
```csharp
const int x = 3;
const string y = "foo";
readonly Object obj = getObject();
```
</td>
<td>
```nemerle
def x : int = 3;
def y : string = "foo";
def obj : Object = getObject();
```
</td>
<td>
Variables defined with <code>def</code> cannot be changed once defined. This is similar to <code>readonly</code> or <code>const</code> in C# or <code>final</code> in Java. Most variables in Nemerle aren't explicitly typed like this.
</td>
</tr>
But some time ago syntax highlighting was broken and this wiki page looks ugly now. Any ideas on how to fix this?
You can use <pre> in tables, as teh_senaus said. But if you do that, syntax highlighting won't work... or will it?
Through random experimentation I found that GitHub allows specifying it with <pre lang="csharp">. This has the same effect that ```csharp does of setting the syntax highlighting to C#.
This isn't really documented anywhere in GitHub's help center, nor in linguist's documentation. But it works, even inside of tables.
So for your example table, the new code would be as follows:
<table>
<tr>
<td>
<pre lang="csharp">
const int x = 3;
const string y = "foo";
readonly Object obj = getObject();
</pre>
</td>
<td>
<pre lang="nemerle">
def x : int = 3;
def y : string = "foo";
def obj : Object = getObject();
</pre>
</td>
<td>
Variables defined with <code>def</code> cannot be changed once defined. This is similar to <code>readonly</code> or <code>const</code> in C# or <code>final</code> in Java. Most variables in Nemerle aren't explicitly typed like this.
</td>
</tr>
Add a blank line between the <td> and the code block.
Here's the fixed markdown:
<table>
<tr>
<td>
```csharp
const int x = 3;
const string y = "foo";
readonly Object obj = getObject();
```
</td>
<td>
```nemerle
def x : int = 3;
def y : string = "foo";
def obj : Object = getObject();
```
</td>
<td>
Variables defined with <code>def</code> cannot be changed once defined. This is similar to <code>readonly</code> or <code>const</code> in C# or <code>final</code> in Java. Most variables in Nemerle aren't explicitly typed like this.
</td>
</tr>
</table>
and the result:
You can use <pre>. Syntax highlighting won't work, but at least it will be formatted properly.
<td><pre>
const int x = 3;
const string y = "foo";
readonly Object obj = getObject();
</pre></td>
Another way is using multiple ` and <br>, but Syntax highlighting won't work .
|1|2|3
-|-|-
`const int x = 3;`<br>` const string y = "foo";`<br>`readonly Object obj =getObject();`|`def x : int = 3;`<br>`def y : string = "foo";`<br>`def obj : Object = getObject(); `|Variables defined with `def` cannot be changed once defined. This is similar to `readonly` or `const` in C# or `final` in Java. Most variables in Nemerle aren't explicitly typed like this.explicitly typed like this.
The trick is to use the backticks around your code, while wrapping it all with a <pre> tag, like so:
<pre lang=html>`<input readonly>`</pre>
Here's a screenshot of how it renders, from my own use case:
You can also :
A | B | C
-- | -- | --
x | y | Some code : <pre lang=php>function sayHello($someArg)</pre>
1 | 2 | 3

play framework chain multiple scala functions

I am writing my first application in Java. In one of my views, I have a couple of helper functions:
#**********************************
* Helper generating table columns *
***********************************#
#tableColumn(content:String) = {
<td>
#content
</td>
}
and
#**********************************
* Helper to convert boolean to string *
***********************************#
#convertBooleanToString(flag:Boolean) {
if (flag) {
"Yes"
} else {
"No"
}
}
I am trying to use these 2 functions as below but getting compiler error.
<tr>
<td>Completed</td>
#for(item <- items) {
#tableColumn(convertBooleanToString(item.isComplete))
}
</tr>
the error that i get is as below:
illegal start of simple expression
Can you please help?
While reproducing I don't get your error message. Please give more code.
But for now you can try:
#**********************************
* Helper generating table columns *
***********************************#
#tableColumn(content:String) = {
<td>
#content
</td>
}
#**********************************
* Helper to convert boolean to string *
***********************************#
#convertBooleanToString(flag:Boolean) = #{if (flag) "Yes" else "No"}
<tr>
<td>Completed</td>
#for(item <- items) {
#tableColumn(convertBooleanToString(item.isComplete))
}
</tr>

GroupBy with shared index or Play 2 repeated forms

Im trying to make an order form with Play 2 and Scala.
Here is what it was before grouping:
<table>
#items.zipWithIndex.map {
case (item, index) =>
#itemRow(item, index)
}
</table>
itemRow definition
#itemRow(index: Int, item: Item) = {
<tr>
<td>
#(index+1)
</td>
<td>
#item.name
</td>
<td>
<input type="hidden" name="#requestForm("items")("[" + index + "]")("itemId").name" value="#item.id">
<input type="text" name="items[#index].count" value="#requestForm("items")("[" + index + "]")("count").value">
</td>
</tr>
}
At first I tried naive implementation
#items.groupBy(item => item.category).map {
case (categoryId, itemsInCategory) =>
<table>
#itemsInCategory.zipWithIndex.map {
case (item, index) =>
#itemRow(item, index)
}
</table>
}
But there is a problem, indexes in each category starts with 0.
So, http request is something like that:
# category 1
items[0].id = 1
items[0].count = 1
items[1].id = 2
items[1].count = 2
# category 2
items[0].id = 3
items[0].count = 1
items[1].id = 4
items[1].count = 5
And it is causes to values being overriden.
I need my indexes for be consecutive within the form, like this:
# category 1
items[0].id = 1
items[0].count = 1
items[1].id = 2
items[1].count = 2
# category 2
items[2].id = 3
items[2].count = 1
items[3].id = 4
items[3].count = 5
So there is questions
For functional programmers:
Can I make index variable shared for all groups?
For Play 2.0 or web programmers:
Is there another way to make form with variable count of repeated values?
How to avoid sending this bunch of items with 0 count?
I have no experience with Play so I can't comment on the Play specific questions (maybe it already provides helpers for what you want), but on the scala librayr alone you can do something like this:
#items.sortBy(item => item.category).zipWithIndex.groupBy{ case (item, _) => item.category}.map {
case (categoryId, indexedItemsInCategory) =>
<table>
#indexedItemsInCategory.map {
case (item, index) =>
#itemRow(item, index)
}
</table>
}
The idea is to first sort the items by category and then zip them with the corresponding indexes. Then only you group them by category (which should be fast as the list is already sorted).

KnockoutJS - ViewModel Abstracion

*UPDATE* (see below)
I understand the basics of KnockoutJS. When creating a table viewmodel, one would use <tr data-bind="foreach: rows">
Now I'm trying to abstract the table viewmodel, so that I can create multiple tables with the same behaviour (sorting, editing, pagination, etc..). So what I'm aiming for is something like this:
HTML
<div class="table a" data-bind="myTableBinding: aTableViewModel"></div>
<div class="table b" data-bind="myTableBinding: anotherTableViewmodel"></div>
Main ViewModel
var MainViewModel = function () {
this.aTableViewModel = new AbstractTableViewModel({
columns: [...]
initialSort: [...]
});
this.anotherTableViewModel = new AbstractTableViewModel({
columns: [...]
initialSort: [...]
});
};
My first try was mimicking the example [simpleGrid] plugin (# http://knockoutjs.com/examples/resources/knockout.simpleGrid.1.3.js) that the KnockoutJS docs use for the [Paged grid] example.
I'm not really sure, but I think that the basic concept of abstraction isn't represented well in this plugin. When I tried to include css class into the <th> elements like so: <th class="col col-id">, <th class="col col-name">, etc, I found out this wasn't easy (impossible?) using data-bind attributes.
The data-bind attributes probably shouldn't be used for this stuff through, because these classes won't change -- they are part of a higher abstraction level: we should actually insert these classes with jQuery.tmpl or Underscore's templating system. But then I got an error saying that [This template system doesn't support use of the foreach binding] (or something like that).
My second try therefore was to implement the abstraction as it should be implemented: with the table properties (columns, etc) at another "abstraction level" than the table data:
Create the basic <tr data-bind="foreach: rows"> html at instantiation of a new specific table view model, using an "abstract" template -- this I simply did with Underscore's _.template.
Let this specific viewmodel use the above html as usual.
In CoffeeScript:
do ->
ko.dataTable =
ViewModel: (config) ->
#id = config.id
#columns = config.columns
#pageSize = config.pageSize ? 9999
#sortColumn = ko.observable (config.sortColumn ? #columns[0].col)
#sortOrder = ko.observable (config.sortOrder ? "asc")
#data = ko.observableArray (config.data ? [])
null
ko.bindingHandlers.dataTable =
init: (el, acc) ->
viewModel = acc()
$(el).find("div:first").html dataTableTemplateMaker viewModel
# ??? [A] ko.applyBindings viewModel, $(el).find("table")[0]
# ??? [B] controlsDescendantBindings: yes
null
update: (el, acc) ->
viewModel = acc()
# ??? [C]
null
And then:
<div data-bind="dataTable: groupTable">
and:
class ViewModel
constructor: ->
#groupTable = new ko.dataTable.ViewModel
id: "grouptable"
columns: [
{ col: "num", title: "Groep", editable: yes }
{ col: "subject", title: "Vak" }
{ col: "year", title: "Jaar" }
{ col: "level", title: "Niveau" }
{ col: "day", title: "Dag" }
{ col: "hour", title: "Uur" }
{ col: "place", title: "Lokaal", editable: yes }
]
pageSize: 10
sortColumn: "num"
sortOrder: "asc"
data: [] # [D]
... in which ??? marks the spot(s) where my confusion lies.
Say I do not insert lines [A] and [B]. Then of course KnockoutJS tells me that the bindings are all messed up within the html for my specific viewmodel (which is inserted into the <div>. If I do insert lines [A] and [B], then it does work for initial data (at [D]), but after that does not respond.
Alltogether: I'm quite confused about something simple as abstracting a viewmodel. Isn't there a standard solution to this in KnockoutJS? (I've googled but couldn't quite find anything...) Or am I just messing it up myself (quite possible)? ;)
*UPDATE*
I solved the problem (but maybe it's not the best / well at all -- what is your opinion?), for completeness' sake: (a condensed version -- of course you'd probably also want to observe the rows individually etc..)
HTML (yes, that is purposefully a string passed to the binding handler)
<div data-bind="myTableBinding: 'viewModelPropertyHoldingTableViewModel'"></div>
CoffeeScript
class MainViewModel
constructor: ->
#viewModelPropertyHoldingTableViewModel = new TableViewModel <options>
null
class TableViewModel
constructor: (options) ->
#columns = options.columns
#rows = ko.observableArray (options.rows ? [])
[...]
null
tableTemplateMaker = _.template '
<table>
<thead>
<tr>
[% _.map(tableViewModel.columns, function (column) { %]
<th>[%= column.title %]</th>
[% } %]
</tr>
</thead>
<tbody data-bind="foreach: rows">
<tr>
[% _.map(tableViewModel.columns, function (column) { %]
<td data-bind="text: [%= column.id %]"></td>
[% } %]
</tr>
</tbody>
</table>
'
ko.bindingHandlers.myTableBinding =
init: (element, viewModelPropertyNameAccessor, _, mainViewModel) ->
tableViewModelProperty = viewModelPropertyNameAccessor()
tableViewModel = mainViewModel[tableViewModelProperty]
$(element).html tableTemplateMaker
tableViewModelProperty: tableViewModelProperty
tableViewModel: tableViewModel
null
m = new MainViewModel
ko.applyBindings m
m.viewModelPropertyHoldingTableViewModel.data.push [...]
Why reinvent the wheel? :P
https://github.com/CogShift/Knockout.Extensions