Syntax highlighting doesn't work with reStructuredText - syntax-highlighting

I was using this directive but the html generated simply omitted my code. For example, if I use:
.. code:: python
def my_function():
"just a test"
print 8/2
The html generated just doesn't contain this block of code whatsoever.
I have Pygments installed on my machine. Also, I'm using Pandoc to generate the html file.
Any idea what I'm doing wrong?

The development version of pandoc understands the language specification on .. code:: and will generate highlighted code from your input. This feature will be in the next release.

Related

Need inline_macro example and help about file location

I like to add additional macros to asciidoctor for these types:
path:[some path value]
label:[some label text]
replace:[some value to become replaced by the user]
screen:[something the users sees on screen]
I mainly want to have it rendering some CSS classes while rendering to HTML5. I found several sources on how to write a macro for asciidoctor, but I do not get the point. Where to place or insert the ruby code and classes I write? Here is an example page I found: https://docs.asciidoctor.org/asciidoctor/latest/extensions/inline-macro-processor/
But I found no simple step-by-step information about where to place that?
Can someone tell me:
In which file(s) shall I add my macro code?
How to enable this in general for asciidoctor (so I can simply call it without the need to put it into the comandline call. Or do I have to register the macro in the call all the time?
I installed asciidoctor on Ubuntu 20.04 using apt-get install asciidoctor. Seems it works so far. But I found no files for the predefined macros btn, kbd and menu.
I'm a little lost here... Any help is appreciated.
PS. I know the syntax [.label]#some label text# to place CSS classes, but I want to have it generic and also usable for PDF generation later.
After many different tries and research I finally found it to be easy. Just point asciidoctor to the file you want to include by using the -r comandline parameter:
asciidoctor -r ~/tools/asciidoctor_patch/include_asciidoc.rb
Sadly, the whole asciidoctor documentation names this parameter only "require" and does not even mention this to be used for extensions. I also found no source that mentions the use of -r for including the macros.

Getting asciidoc to generate slides with embedded latex

I am interested in generating slides using asciidoc markup. Thus far I have been able to generate some slides using asciidoc tool by passing the flag -b slidy to the asciidoc executable as given here: https://www.methods.co.nz/asciidoc/slidy.html#(3)
However, when I try to embed Latex expressions like $\alpha + \beta$ it just gets rendered as is. I know there is a tool called asciidoctor-latex which can be used for generating "normal" HTML pages / PDF files containing the Latex symbols
but when I tried -b slidy flag with asciidoctor-latex I get the error
asciidoctor: FAILED: missing converter for backend 'slidy'. Processing aborted. (RuntimeError)
Use --trace for backtrace
How should I go about installing the necessary slidy backend?
As far as I am aware there is a backend for slidy included in the asciidoc program (python) distribution, but currently there is no such backend for asciidoctor (the ruby implementation of AsciiDoc).
You can generate LaTeX with asciidoc (python) LaTeX Backend, but that probably won't help with embedding formulas in slidy. I guess it is easier to write a preprocessor script that replaces your LaTeX-Code with an svg-image (external reference to a file generated by eg. dvisvgm).

Tutorial: How to use Zend i18n

I would like to use Zend Translation to translate my app into various languages. The problem I face is finding a tutorial that explains how to set it up clearly and without any ambiguity.
This is what I currently have:
In the language file I have:
And in my view I am calling:
<?php echo $this->translate('Skeleton Application') ?>
And I am expecting the output: "hello"
Instead the text: "Skeleton Application" is returned.
Now I assume I need to do some configuration to set this all up such as setting locale etc. However, I can not find any documentation on this or what to do and where...
In Application.Config.php the following modules are included:
Zend\I18n',
'Zend\Mvc\I18n',
Any help on this would be great!
You have everything setup right. Both modules are indeed required as one is the actual translator, and the other one is the integration in Zend MVC (view helpers and all).
In terms of what's not working, it is not ZF related, but rather po/mo related. The translation file you are editing is the .po file, the human readable format, which then needs to be compiled into a .mo file, a binary that is going to be used by your system.
In your specific case, you are missing the compilation to binary step, hence the value not changing (as the .mo file has not changed).
You can either use a command line tool for that compilation, or use a tool such as poeditor on you machine to edit your translation files.

Using rtags for indexing firefox source code

I am using rtags which is a C++ source code indexer based on clang. I have been able to play around with it and now I want to actually index the firefox source code. I am pretty new to this stuff and this tool uses cmake to generate a compile_commands.json file to pass over to the program that indexes code.
Is there a way I can generate a the compile_commands.json file for the firefox source code that provides the exact compilation line for each translation unit inside the firefox source?
You can generate compile_commands.json by
mozilla_cnetral/mach build-backend -b CompileDB
In my environment(Ubuntu 16.04), it was created at mozilla_cnetral/obj-x86_64-pc-linux-gnu/.
Reference:
https://developer.mozilla.org/en-US/docs/Developer_Guide/Editor_Configuration#rtags_(LLVMClang-based_Code_Indexing)
Not sure if I follow the part "Is there a way I can generate a the compile_commands.json file for the firefox source code that provides the exact compilation line for each translation unit inside the firefox source?". But I can offer simply that you can generate a compile_commands.json file from a make-based system using the bear utility (which I obtained from my package manager: brew). After a make clean, I do 'bear --append make' and it traces the make build process and produces the compile_commands.json. More can be learned here: https://vxlabs.com/2016/04/11/step-by-step-guide-to-c-navigation-and-completion-with-emacs-and-the-clang-based-rtags/
As the article referenced implies, my motivation was to be able to use the wonderful rtag system inside Emacs. Hope this helps a bit.

Adding Rust (programming language) syntax to Notepad++?

I would like to use Notepad++ as I learn Rust. Is it possible to do this? If it is, how do I do it?
You can use Notepad++ to edit the source files, nothing else is needed.
If you want syntax coloring, a syntax file is available, the README has an explanation on how to import the XML file.
For compiling and running the code, you can just use the command line.
I don't think there is a plugin for code completion yet, but it could be implemented with racer.
I like Notepad++, but there are more plugins for Sublime Text, Atom, or VS Code. You can also use Visual Studio.

Resources