Generating RDoc to LaTeX - ruby

Is it possible to generate RDoc in LaTeX format? I looked at RDoc and YARD, but didn't find what I need.
I am writing a documentation in LaTeX for my project in Ruby, and I need a way to easily embed the API reference, as an appendix or as a chapter, in the final PDF. The most convenient, for me, would be to generate LaTeX source from Ruby source files and include it where appropriate.

I have no experience with it, but a short google-search shows:
https://github.com/Quintus/rdoc_pdf-latex (link broken, see below)
http://www.ruby-doc.org/core-1.9/classes/RDoc/Markup/ToLaTeX.html (link broken)
Another possibility:
DO you know the listings-package in LaTeX? There is also a ruby support.
You would get no rdoc-commands, but maybe you could make LaTeX-commands in your code?
Papyrus is a plugin for RDoc that enables RDoc to generate PDF files. It's based on LaTeX. So there should be a intermediate TeX-file.
From the readme.rdoc of the github repository for papyrus:
This library is a plugin for Ruby’s documentation generator RDoc. It provides both a generator for outputting PDF (Portable document format) (the RDoc::Generator::Papyrus class) files and a formatter for turning the parsed RDoc markup into LaTeX code (RDoc::Markup::ToLaTeX; RDoc::Markup::ToLaTeX_Crossref adds cross-reference facilities).

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).

Create type links to other version of the standard library with Sphinx napoleon

I document a Python project using Sphinx and the Napoleon and the autodoc extension to parse Google style docstrings. As the Google style involves specifying the type of the arguments, Sphinx automatically creates links to the documentation of the standard types in the standard library. Intersphinx However, by default it links to the 2.7 version of the documentation, whereas I want to link to a 3.x version. How can I control this behaviour?
How the Python library is linked is controlled by the intersphinx extension. Set
intersphinx_mapping = {'python': ('https://docs.python.org/3.4', None)}
in conf.py and the links should link to the Python 3 standard library.
See intersphinx docs for more information on how to use intersphinx.

Is Asciidoc markup programmatically extendable (by existen implementation, like RST)?

reStructuredText allow you extend/rewrite writer for its markup. So you can add new type of embedded objects or introduce new sub-language by defined API.
Is this possible with Asciidoc (original Python implementation or Ruby asciidoctor)?
Yes to both, though the ways to extend each are different. In the Python implementation there's a conf file you use to create additional regex matchers. In asciidoctor (ruby) there is a full extension system built into versions starting at 0.1.4 (though it was at preview level in 0.1.4). Visit http://asciidoctor.org/docs/user-manual/#extension-points for more information about extensions in asciidoctor. http://asciidoc.org/userguide.html#X7 for asciidoc.

Syntax highlighting doesn't work with reStructuredText

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.

Resources