How to include application version number in HTML documentation genertated by Spring Rest Docs? - spring-restdocs

I would like to include application version number (version from build.gradle).
I see no way to pass some custom variables to ascidoc and use them in generated documentation. Is it possible?

Passing custom variables from gradle can be done using
asciidoctor {
attributes "build=${build}"
}
Then defined attribute may be refered in adoc file as {build}

Related

DITA-OT 4.0.1 [DOTA015F][FATAL] Internal property preprocess.copy-html.skip may not be set directly. Use property build-step.copy-html instead

jdk-17.0.3.1,
DITA-OT v.4.0.1, com.elovirta.ooxml DITA to Word plug-in
Error while converting to DOCX:
dita --input=phase.ditamap --format=docx
[DOTA015F][FATAL] Internal property preprocess.copy-html.skip may not be set directly. Use property build-step.copy-html instead.
Please explain how to fix.
DITA-OT v.3.7.4 does not have this problem.
The Word to DITA plugin does not seem to be compatible with DITA OT 4.0 and newer, I added an internal issue for this on the project GitHub issues list and gave there a hint about how the build file can be modified to make things work again:
https://github.com/jelovirt/com.elovirta.ooxml/issues/101

Is there a detailed documentation on how to create own jsdoc templates?

Short version:
If I wanted to develop a completely new jsDoc template from scratch, what would I have to read to understand what jsDoc does, what interface my template must provide and what data I get to work with?
Long version:
I've been using jsDoc for a while now and have come across some tags that I would like to add and overview pages that I would like to have generated out of my documentation. Up to now I solved all my "user problems" with usejsdoc.org. I even managed to add a new jsdoc plugin that adds some tags. However, I can't find any developer documentation on how to create templates for jsdoc. I use ink-docstrap so I clicked my way through the template-folder (publish.js, /tmpl, etc.) and somehow got the idea of how everything works. But its very very time consuming.
What should I read to become a jsDoc template pro?
These instructions are the closest I could find:
To create or use your own template:
Create a folder with the same name as your template (for example, mycooltemplate).
Within the template folder, create a file named publish.js. This file must be a CommonJS module that exports a method named publish.
For example:
/** #module publish */
/**
* Generate documentation output.
*
* #param {TAFFY} data - A TaffyDB collection representing
* all the symbols documented in your code.
* #param {object} opts - An object with options information.
*/
exports.publish = function(data, opts) {
// do stuff here to generate your output files
};
To invoke JSDoc 3 with your own template, use the -t command line option, and specify the path to your template folder:
./jsdoc mycode.js -t /path/to/mycooltemplate
Failing that, you can read the source code!
I am running into a similar difficulty with lack of documentation. There is a GitHub issue that has been open for 7 years on this: Provide docs that explain how templates work.
The only example I've found so far of a custom template that doesn't look like just a modified version of the default is Ramda's documentation. It looks like they use a completely custom publish.js script that uses handlebars.js instead of underscore.js templates, constructs a non-hierarchical nav, pulls info from #sig and #category tags, and uses links to github for 'view source' instead of rendering its own html pages for source code.
Some of their code will be difficult to understand unless you are familiar with Ramda and functional programming (they use Ramda itself in their version of publish.js) but dumping out the values of data and docs during execution should help provide insight into what is going on.
It is helpful as well that their template is a single file so you don't have to jump between a lot of partial template files to follow how the doc is constructed.
I've just published my own new jsdoc theme. What I did is I simply copied the default template: https://github.com/jsdoc3/jsdoc/tree/master/templates/default, and worked on that.
I also managed to add grunt with the following features:
* transcompile + minify js files
* parse sass styles and minify them
* refresh the docs when you change something
You can see how it works here: https://github.com/SoftwareBrothers/better-docs
you can customize one of existing templates (default, haruki or silent):
go into node_modules/jsdoc/template and grab on of them into your app directory outside node_modules.
feel free to rename the dir ex: jsdoc-template.
open jsdoc-template update/customize the content as you want. ex: open publish.js find Home and replace My Js App.
update jsdoc.json by adding:
"opts": {
"template": "jsdoc-template"
}
another option to use one of those templates too: jsdoc3 template list examples
Followup to my previous comment about Ramda's JSDoc template. I've since created a customized version of it and published it on GitHub at https://github.com/eluv-io/elv-ramdoc
This is tailored for my company's projects, but it may be helpful as another learning tool. It adds a 'Show private' checkbox, updates Bootstrap to v5.13, replaces Handlebars with Pug, adds JSDoc comments to the publish.js script itself, and supports setting an environment variable to dump data to console during doc generation.

Configuring CodeNarc in Gradle

I am trying to wrap my head around using CodeNarc inside of Gradle.
According to the CodeNarc docs, my project needs to have a config/codenarc/codenarc.xml config file defined. But then I see plenty of example config files (such as this StarterRuleSet) that seem to use a Groovy DSL.
So I ask:
Is it possible to use a Groovy DSL, and if so what does the name of the file have to be, where does it have to be located in my project, and how do I wire it up to my Gradle build?; and
Where is the documentation on the Groovy DSL?; and
By default, CodeNarc outputs a report called main.html; how could I change the name of this file to, say, codenarc.html?
It looks like in your build.gradle you can just put:
codenarc {
toolVersion = "0.20"
}
codenarcMain {
configFile = rootProject.file("path/to/CodeNarcMain.groovy")
}
codenarcTest {
configFile = rootProject.file("path/to/CodeNarcTest.groovy")
}
Where the file names (CodeNarcMain, CodeNarcTest) are whatever you want them to be.
Groovy DSL documentation is here. If you need to configure a specific rule, look it up in the documentation and if the rule has public properties that it exposes, they'll be listed in a table under the specific rule's documentation.
And it looks like you can only change the report file format (HTML, XML, text, console) but not the actual file name produced.

Replace éàçè... with equivalent "eace" In GWT

I tried
s=Normalizer.normalize(s, Normalizer.Form.NFD).replaceAll("[^\\p{ASCII}]", "");
But it seems that GWT API doesn't provide such fonction.
I tried also :
s=s.replace("é",e);
But it doesn't work either
The scenario is I'am trying to générate token from the clicked Widget's text for the history management
You can take ASCII folding filter from Lucene and add to your project. You can just take foldToASCII() method from ASCIIFoldingFilter (the method does not have any dependencies). There is also a patch in Jira that has a full class for that without any dependencies - see here. It should be compiled by GWT without any problems. License should be also OK, since it is Apache License, but don't quote me on it - you should ask a real lawyer.
#okrasz, the foldToASCII() worked but I found a shorter one Transform a String to URL standard String in Java

How pass the variable form config file form one plugin to another in Symfony?

I am new to Symfony 1.4
And I have a project in which I have 2 plugins. In first plugin named myPlugin1 I have the config folder and in him the app.yml file, in which I have set a predefined "variable" like that:
all:
carriage:
cost:
prepaid: 10
What I need is to pass this "variable" in a class from my other plugin, myPlugin2, which actually handle the payments costs.
How can I pass this "variable" to my class?
UPDATE:
Can I do this like that? Or this can be used only in current plugin?
sfConfig::get('all_carriage_cost_prepaid')
the actual call must be:
sfConfig::get('app_carriage_cost_prepaid')
The starting prefix is related to the configuration file name. Source here.
Regards.
I have found finally how to do it. Is like that:
$myarray = sfConfig::get('all_carriage_cost');
$thevalue = $myarray['cost'];
Here is the source.