Is there a way to do inline conditional inclusion macros in AsciiDoc?
I would like to be able to do something like:
The control’s data source property is ifdef::wpf[DataContext] ifdef::web[dataSource] and accepts a collection of view model objects.
Is there a syntax variation that would make something like this possible?
It is possible when using asciidoctor, don't know about they python processor.
As of Here you can see how it is used in the test harness.
On our quest we go...
ifdef::holygrail[There is a holy grail!]
There was much rejoicing.
Related
I would like to redefine the backticks so that I can use them to type formulas in AsciiDoctor documents. For example, instead of typing
stem:[my formula]
I would like to type just
`my formula`
How can this be done?
As far as I know this is not possible. You have to tell ascidoc(tor) what you want. So you need the usual steps:
activate stem support with :stem:
write your equation either inline or as a block
See more details and examples here: https://asciidoctor.org/docs/user-manual/#activating-stem-support
I'm creating code for interfaces specified in IBM Rational Rhapsody. Rhapsody implicitly generates include statements for other data types used in my interfaces. But I would like to have more control over the include statements, so I specify them explicitly as text elements in the source artifacts of the component. Therefore I would like to prevent Rhapsody from generating the include statements itself. Is this possible?
If this can be done, it is mostly likely with Properties. In the feature box click on properties and filter by 'include' to see some likely candidates. Not all of the properties have descriptions of what exactly they do so good luck.
EDIT:
I spent some time looking through the properties as well an could not find any to get what you want. It seems likely you cannot do this with the basic version of Rhapsody. IBM does license an add-on to customize the code generation, called Rules Composer (I think); this would almost certainly allow you to customize the includes but at quite a cost.
There are two other possible approaches. Depending on how you are customizing the include statements you may be able to write a simple shell script, perhaps using sed, and then just run that script to update your code every time Rhapsody generates it.
The other approach would be to use the Rhapsody API to create a plugin/tool that iterates through all the interfaces and changes the source artifacts accordingly. I have not tried this method myself but I know my coworkers have used the API to do similar things.
Finally I found the properties that let Rhapsody produce the required output: GenerateImplicitDependencies for several elements and GenerateDeclarationDependency for Type elements. Disabling these will avoid the generation of implicit include statements.
Hey exist in asciidoc a way to create preprocessor macros?
The macros in asciidoc allow me generate custom commands for the different output formats. My goal is the creation of valid asciidoc.
for example:
preprocessormacro: #define pair() %1 and %2
use: i think pair("a", "b") are the same
result: i think a and b are the same
I hope you get the idea.
Attributes, specialwords and replacements don't fulfill this requirement. Or am i wrong?
Thanks for any kind of help.
What you are looking for is Jamal.
Jamal is a macro processor, which I created and it is also embedded as an asciidoc preprocessor.
I created Jamal for the very purpose you are looking for.
https://github.com/verhas/jamal
Currently, I'm writing something to do Unit testing for XSLT2 functions, the idea is very simple:
Create a custom-library.xsl, which contains some custom XSLT2 functions.
Create a data XML contains the test cases, as following XML Schema xslunit.xsd:
schema structure http://xml.bodz.net/schema/xslunit/xslunit.png
Run the test cases by transform it, using xslunit-xslt2.xsl, and get the test result html.
Now, the question is, there is function-call in the test cases, and I have to evaluate it in the XSLT (file xslunit-xslt2.xsl). But I can't find a way to evaluate an XPath.
Though, it may be easy to using some kind of Java extensions, but I really don't want to bring in another trouble. I hope everything can just work with-in XSLT2 only.
No, pure XSLT 2.0 does not have support do evaluate an XPath expression found in your XML data. Saxon 9 (in its commercial editions) however has an extension function: http://www.saxonica.com/documentation/extensions/functions/evaluate.xml. And AltovaXML Tools has a similar one: http://manual.altova.com/AltovaXML/altovaxmlcommunity/index.html?xextaltova_general.htm
Update a decade later: XSLT 3.0 has an instruction <xsl:evaluate> which evaluates an XPath expression supplied dynamically as a string.
I have one large project with components in multiple languages that each depend on some of the same enum values. What solutions have you come up with to unify enums across multiple arbitrary languages? I can think of a few, but I'm looking for the best solution.
(In my implementation, I'm using Php, Java, Javascript, and SQL.)
You can put all of the enums in a text file, then use a code generator to write out the appropriate syntax for each language from that common file so that each component has the enums. Make that text file the authoritative source of information.
You can express the text file in XML but I'd think a tab-delimited flat file would work just fine.
Make them in a format that every language can understand or has a library for. I am using JSON for this at the moment.
Then you can include it with two ways:
For development: Load it from a file/URL at runtime
good for small changes you want too see immediately
slow
For productive usage: Include it in the files
using a build script
fast
no instant feedback
I would apply the dry principle and using code generator as such you could add anew language easely even if it has not enum natively existing.