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
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
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.
Can someone give some general guidelines about when to use Scheme or Racket macros and when to use functions.
If you're not creating new syntax and you're not creating side effects on variables are there cases where you would either have to (or it would be more appropriate) to use macros instead of functions?
Macros allow you to use completely different syntax. A macro invocation doesn't have to look like a function call at all, although the simplest macros often do. Also, macros are performed in a separate phase before runtime. So, if you need different syntax, or if you want macro expansion before runtime, then, well, use a macro.
In general, I'd say that if you can do it cleanly with a function, then use a function.
Matthias Felleisen has a brief discussion of this question in his Racket style guide.
I know i just need a file like /usr/share/gtksourceview-2.0/language-specs/javascript.lang. Where can i find a language definition like this for lex ?
You can find extra language definitions here, but it doesn't look like lex is among them. I think there may not be one yet. Here is a guide to writing your own.
I want to create a "terminology" section with definitions for terms that I'm using such that every time I use the terms in this terminology section, a link is created that points to the definition.
Currently, the best I can think up is:
.. |flavor| replace:: `:ref:flavor`
.. _flavor:
flavor
------
blah blah blah
Then later, in the other text I have to do:
''' This is a usage of the word |flavor|.'''
I find the above syntax to be very cumbersome. I know I could use yet another layer of scripting or m4 to auto-generate this syntax, but I'm hoping there's a better way..
Not so different, but you can use:
.. glossary::
This directive must contain a reST definition list with terms and definitions. The definitions will then be referencable with the 'term' role.
:term:
Reference to a term in the glossary. The glossary is created using the glossary directive containing a definition list with terms and definitions. It does not have to be in the same file as the term markup, for example the Python docs have one global glossary in the glossary.rst file.
If you use a term that’s not explained in a glossary, you’ll get a warning during build.
[pasted from official sphinx documentation]