How use variables from AsciiDoc in PlantUML diagrams? - asciidoc

I'm using AsciidocFX for creating documentation. Variables created in asciidoc need to be replaced in diagrams. An example which doesn't work:
== My title
:parent-class: Parent
:child-class: Child
[plantuml,"class-inheritence",svg,subs=attributes+]
....
class {parent-class}
class {child-class}
{parent-class} <|-- {child-class}
....
Instead of class diagram, following result is shown. What is wrong?

When I paste your Asciidoc snippet into Eclipse Asciidoctor Editor (v2.4.1) there is absolutely nothing wrong with your code (see next picture).
Just a note: I am the author of the mentioned eclipse plugin.
Looking at your error message, the problem seems to be not at Asciidoctor level but on plantuml: Those error info pictures are generated by plantuml.jar when it comes to errors.
An option is, that AsciidoctorFX (or the installed/used Asciidoctor version) does not replace the place holders (parent-class, child-class) correctly and just give plantuml the plain, unchanged plantuml code - looking at the error message this looks very likely to be the problem.
So I think AsciidoctorFX uses an incompatible or outdated plantuml version or an old Asciidoctor version (or you have installed an old one and AsciidoctorFX is using this).
Maybe you can just update your AsciidoctorFX installation or the used Asciidoctor installation? If this is not helping, you could add an issue at https://github.com/asciidocfx/AsciidocFX/issues so it can be fixed by the maintainers.

Related

Is there any extension in vscode to generate a stepdefinition file in java from a .feature file?

I want that when i create my .feature file, i want some extension in vscode which generates a step definition file in java. I have seen many such extensions for js but not for java.
I tried downloading many extensions but no one worked for java.
Please. Here you are. This plugin supports it.
Features
Autocomplete of Gherkin steps
Go to step definition
Generate step definition
Syntax highlighting
Formatting (pretty printing)
Language support
C#/SpecFlow
Go/Godog - help needed
Java
JavaScript
PHP
Python/Behave
Ruby
Rust
TypeScript
https://marketplace.visualstudio.com/items?itemName=CucumberOpen.cucumber-official#generate-step-definition
It works. I have checked

Where can I restore Pandoc's configuration

I have Pandoc 2.2.3.2 installed on my system via Anaconda. The Reveal.js slideshows I convert with it do not work, because the inserted links to the Reveal.js code seem to be wrong. The documentation states that the default URL should be 'https://unpkg.com/reveal.js#^4/'. However, in my generated slides they turn out as in for example <script src="reveal.js/js/reveal.js"></script>, so the base part of the URL seems to be missing.
Fixing the URL by setting the revealjs-url variable is unfortunately not enough, because the files seem to be located under 'dist' rather than the various prefixes 'js', 'css' that I find in my document now.
Where could this be configured in Pandoc? I have searched the documentation and grepped for possible configuration files on my hard drive, with no luck so far.
You should be able to fix this by using an URL pointing to a reveal.js 3.* version. The versioning issue has been fixed in newer versions (pandoc 2.10 and later). Instead of always using the latest reveal.js version, pandoc now pins a specific version.
See this pandoc issue for more details.

com.lowagie.text.DocumentException: Font 'STSong-Light' with 'UniGB-UCS2-H' is not recognized

a maven project ,when i want to ctreate a pdf ,happened this:com.lowagie.text.DocumentException: Font 'STSong-Light' with 'UniGB-UCS2-H' is not recognized.
Please take a look at the following fragment of the free ebook The ABC of PDF with iText:
As you can see, I create a font 'STSong-Light' with 'UniGB-UCS2-H' as encoding, and I use it to write the Chinese title of the movie "House of The Flying Daggers". You can see that this works perfectly by looking at the screen shot of the PDF.
If it doesn't work for you, then this is what may have gone wrong:
You didn't read the documentation (or you wanted to wait until somebody copy/pasted a snapshot of the documentation) which explains why you didn't include the itext-asian.jar into your CLASSPATH. This jar can be found in the extrajars-2.3.zip
Or you did read the documentation, but you didn't include the correct itext-asian.jar into your CLASSPATH. I see that you are using my name in your code (I am the Lowagie from com.lowagie.text). This means that you are using a version of iText that has been removed from all official servers years ago. That version should no longer be used!
In short: you can solve your problem by upgrading to the latest iText version and making sure that you include the itext-asian.jar.
iTextSharp.text.io.StreamUtil.AddToResourceSearch(
System.Reflection.Assembly.Load("iTextAsian")
)

Format code in Doxia Apt Format

I am currently starting to write a documentation for one of our projects. For reasons of simplicity we chose to use the Almost Plain Text (APT) Format, see more info here:
http://maven.apache.org/doxia/references/apt-format.html
APT is great documentation format, since it uses a minimal syntax and hence it is very easy to create and make changes to the documentation without knowing a lot about APT.
However, I couldn't find a way to format code in a nice way. Is there a code tag or similar, which can be used to include some source code? I'm aware I could use FML, but this would be less desirable.
Thanks
For those who are still wondering how to make a code snipped in APT:
This is regular text
+---------------------
This is a code snippet
+---------------------
More regular text
Apache Maven Fluido Skin highlights syntax out of the box. Here you can find an example. Information about syntax highlighting in Fluido: "Source code sections are enhanced by Google Code Prettify, users can optionally enable line numbers rendering (disabled by default)" from Fluido website.
The
+---------------------
code
+---------------------
syntax is correct. And Fluido does highlight using Prettify out of the box as others have mentioned.
However, a Doxia change in Site Plugin 3.3 broke Fluido. MSKINS-86 fixes this, but hasn't been released yet.
Workarounds
Use the site.xml workaround
<body>
<head>
<script type="text/javascript">
$(document).ready(function () {
$("div.source pre").addClass("prettyprint");
prettyPrint();
});
</script>
</head>
</body>
Use Site Plugin 3.2
Build the unreleased Fluido 1.4 that contains MSKINS-86 fix and use it instead of 1.3.1
I ended up using the snippet macro from the Doxia Macros Guide: http://maven.apache.org/doxia/macros/index.html#Snippet_Macro
It puts the code from the snippet file in a verbatim box. However it does not provide a syntax highlightning.
Version 1.0 of doxia include macro is not at maven central however the following versions are:
http://mvnrepository.com/artifact/org.tinyjee.dim/doxia-include-macro

Itextsharp documentation for xml

I am looking for documentation on the XML parser in ItextSharp, I heard there was a dtd years ago but this seems to be defunt. Does anyone know where I can find out all the valid tags and references?
I am using ItextSharp with Spark
Thanks
When in doubt, use the source. Poking around in my copy of the current iText source, I see that the only SimpleXMLDocHandler available is HTMLWorker.
And if you look at the source for HtmlTags.cs, you'll see all the tag and attribute constants HTMLWorker uses.
It's not exactly comprehensive, but is going to be getting some Enhancement in the immediate future.
I don't see a 4.1.2 tag, but there's one for 4.1.6 in the iTextSharp project on SF. It shows ITextHandler using a bunch of constants from ElementTag in HandleStartingTags(). It also uses ElementFactory to build the various supported tags. Looking at the source for each function will tell you which attributes it supports.

Resources