Can |release| substitution work inside image directive in sphinx? - python-sphinx

I'm trying to make a badge in rst for the current version of documentation.
The text works fine:
Current version: |release|
shows the correct release number.
Then I try to plug in |release| into a directive and it does not go through:
.. image:: https://img.shields.io/badge/Version-|release|-blue
The badge looks like:
Is there a clever way to use |release| to build an image?

Related

How to use correct lang parameter?

I have a fresh Mediawiki installed into fresh UBUNTU 18 LTS... The ''SyntaxHighlight'' extension not works for Unix shell, lang="sh", lang="shell", lang="bash", ... no one is working. It is not at #Supported_languages, and there are no clues about how to install "Other markup".
At mediawiki.org/list there are no clues.
So, how to solve the problem? It is a config, env or syntax problem?
NOTES AND TESTS
Notes.
It is a corporative Wiki, no way to offer public URL... But it is a fresh, standard and controlled installation, all reproductive and standard.
The Wiki was configured with skin "Vector" and language "Brazilian Portuguese".
Tests.
Usage tests of mediawiki.org/Extension:SyntaxHighlight, the Python example.
1.1. With tag <syntaxhighlight>. Result: no highlight, same as <pre>.
1.2. With tag <source>. Result: no highlight, same as <pre>.
PHP example, fragment from wikipedia.org/PHP Syntax.
2.1. With tag <syntaxhighlight>. Result: no highlight, same as <pre>.
2.2. With tag <source>. Result: no highlight, same as <pre>.
The code fragments used in the tests:
def quickSort(arr):
less = []
pivotList = []
more = []
if len(arr) <= 1:
return arr
else:
pass
<title>PHP "Hello, World!" program</title>
<?php echo '<p>Hello World</p>'; ?>
MediaWiki Syntax highlighter used Pygments library, you should first download and install the extension:
Requirements
This version of the extension has been tested with Pygments 1.6, 2.0.2 and
MediaWiki 1.25 as of 2015-06-19. To get releases of this extension compatible
with earlier versions of MediaWiki, visit:
https://www.mediawiki.org/wiki/Special:ExtensionDistributor/SyntaxHighlight_GeSHi
Download
https://github.com/wikimedia/mediawiki-extensions-SyntaxHighlight_GeSHi/archive/master.tar.gz
Installation
Add this line to your LocalSettings.php:
wfLoadExtension( 'SyntaxHighlight_GeSHi' );
By default, this extension will use a bundled copy of Pygments 2.0.2. If you
would like to use a different copy of the library, you can set
$wgPygmentizePath to point to the path to the 'pygmentize' binary.
Usage
On the wiki page, you can now use "source" elements:
<source lang="php">
<?php
v = "string"; // sample initialization
?>
html text
<?php
echo v; // end of php code
?>
</source>
Parameters
For details information of these parameters, see the documentation of Pygments'
HtmlFormatter at http://pygments.org/docs/formatters/#HtmlFormatter.
lang; Defines the language.
line; Corresponds to linenos="inline" option.
start; Corresponds to linenostart opion.
enclose; If set to "none", corresponds to the nowrap=1 option.
inline; Corresponds to the nowrap=1 option.
highlight; Corresponds to hl_lines option (comma separated).
Note
Pygments is generous about creating HTML elements: highlighting large blocks of
code can easily generate enough of them to crash a browser. As a guard, syntax
highlighting is turned off for code fragments larger than 100 kB.

How to convert asciidoc to pdf?

I attempted to convert my mybook.adoc to mybook.pdf using pandoc, and got the following error.
$ pandoc -s mybook.adoc -t asciidoc -o mybook.pdf
pandoc: cannot produce pdf output with asciidoc writer
Is there another tool that I should use instead of or in concert with pandoc?
How can I convert asciidoc to pdf?
Prerequisites: all that’s needed is Ruby (1.9.3 or above)
Install a native PDF converter for AsciiDoc - Asciidoctor PDF:
gem install asciidoctor-pdf --pre
Run:
asciidoctor-pdf mybook.adoc
You should get the file mybook.pdf in the same directory.
If you're using Visual Studio Code with AsciiDoc extension, Ctrl + SHFT + P (or Shift ⇧ + Cmd ⌘ + P in macOS) and type AsciiDoc: Export document as PDF.
You will need to have asciidoctor-pdf or wkhtmltopdf installed according to the command instructions.
If you have Docker installed, you can use the AsciiDoctor Docker Image. Then you can use the image interactively or in batch mode as explained below:
Prerequisites
Install Docker
Install the Docker image:
$ docker pull asciidoctor/docker-asciidoctor
Create the pdf by executing the following command:
$ cd [directory to where my book.adoc is located]
$ docker run --rm -v $(pwd):/documents/ asciidoctor/docker-asciidoctor asciidoctor-pdf mybook.adoc
Explanation
docker run starts a Docker container
--rm cleanup - removes the Docker container after the command has been executed
-v mount a volume to the image
$(pwd) get the path to the current directory, e.g. the value of [directory to where my book.adoc is located] above
documents the name of the mounted volume in the running container
asciidoctor/docker-asciidoctor the name of the Docker image that is used to create the Docker container
asciidoctor-pdf the command that actually triggers the pdf generation
mybook.adoc the name of the AsciiDoc source file to generate the pdf from
See also the docker run documentation
AsciiDoc has a couple of toolchains that will render PDFs from AsciiDoc source. You can use the Ruby-based AsciiDoc -> Prawn -> PDF toolchain developed by Asciidoctor, or you can use the older AsciiDoc -> DocBook -> FOP toolchain. These are rendering/publishing procedures, whereas Pandoc mainly provides for conversion and is best for converting from one o another type of source format.
I now realize the ideal route from asciidoc to pdf is to first convert the asciidoc to docbook. This employs the intended sphere of asciidoc and a docbook->pdf converter using each in its separate area of concern.
Furthermore, instead of pandoc I have found that when mathematical formulas are included, it was easier to use dblatex for docbook->pdf conversion. Thus my conversion pipeline is the following:
asciidoc -> asciidoctor -> docbook -> dblatex -> pdf
A sample make file:
make: my.adoc
asciidoc -b docbook my.adoc
dblatex my.xml
This discussion page suggests that asciidoc is primarily designed to compile to docbook.
The easiest way to convert AsciiDoc document to PDF is as follows -
Open AsciiDocLive
Paste your document in the editor and see the preview
save it as HTML
Open any online HTML to PDF convertor
Upload your newly generated HTML file
Convert to PDF and download it.
Done.
Following #Remis's answer, I used asciidoctor's pdf backend.
I could not figure out how to install asciidoctor-pdf on nixos, but managed to find the following alternative which worked:
asciidoctor -r asciidoctor-pdf -b pdf or asciidoctor-pdf
Another workflow, which I use a lot, is to create HTML from your AsciiDoc file using the AsciiDoctor processor, linking a custom CSS stylesheet with print styling rules:
asciidoctor -a stylesheet=path-to-stylesheet.css file.adoc
You can then open the HTML file in your browser and print to PDF.
For more advanced styling, such as page numbering, headers, footers, page breaks and columns, you can use PrinceXML (or other similar products). This is a commandline processor that will convert the HTML file to PDF using the styling rules in the CSS used by the HTML file. PrinceXML applies styling rules that are in the CSS3 standard but which aren't yet supported by browsers, allowing you to create finely styled layouts.
In case if you have AsciiDoc plugin in Intellij, here is the way you can generate -
create the adoc file ex - "tktds-dhs-e2e-gcp.adoc" and write your content.. or you may already have adoc file..
At top where file is opened in editor, click on PDF or HTML button to generate .pdf or .html files {need to click 1 at a time} refer below image -
Further you can find pdf / html file in same directory, refer below image -

Generated markdown file with rake post command

I am deploying my github blog using jekyll-bootstrap.I try to modify Rakefile to change the result of $rake post title="test" and then this command will generate a file named test.md(without date) in _posts directory,but unfortunately,when I run
$jekyll serve
locally,it seems that jekyll do not think test.md is an available post,what shoul I do?
I think that what you want it's custom url for your posts.
Leave alone the rake task, because the final post filename is generated in accordance with a permalinks pattern see permalinks documentation
By default you posts are generated following the default pattern /:categories/:year/:month/:day/:title/index.html
If you want to change this pattern, in your _config.yml, use permalink key :
permalink: /blog/:year/:month/:day/:title/filename.html

How can I debug plugins that are being silently ignored?

Newcomer to Jekyll here (previously on Hyde).
Ruby files placed in the _plugins/ directory are apparently silently ignored.
I am using version 0.11.2 of Jekyll, with ruby 1.8.7 on Ubuntu 12.04.
Should an extra config parameter be added to load these plugins? The doc doesn't say so - the sane default should be to look into _plugins, and they should be required automatically. How can one debug the loading of Jekyll plugins?
For my instance of jekyll (also 0.11.2, but with ruby 1.9.2p290 on a Mac), I don't have to add any extra configuration, but you can try adding the following line to your top level "_config.yml" file.
plugins: _plugins
or, possibly,
plugins: ./_plugins
The simplest way to test that your plugins are working is to remove all of them except for one that you know will work. I've put together the following which works as expected on my install.
Create a new file in the root of your jekyll source directory called "plugin_test.md" with the following contents:
---
layout: default
title: Plugin Test
---
the quick brown fox jumps over the lazy dog.
Testing plugin output of '_plugins/testplugin.rb': {% testplugin %}
Note that you may need to change "layout: default" to whatever you are actually using.
Create a new file at "_plugins/testplugin.rb" with the following contents:
module Jekyll
class TestPlugin < Liquid::Tag
def render(context)
"It's Working!"
end
end
end
Liquid::Template.register_tag('testplugin', Jekyll::TestPlugin)
Run jekyll on your source dir.
All that testplugin.rb does is replace instances of the liquid tag {% testplugin %} with the text "It's Working!". If your plugins are triggering, you'll see the output
Testing plugin output of '_plugins/testplugin.rb': It's Working!"
on the page "plugin_test.html" at your output site root. If you see:
Testing plugin output of '_plugins/testplugin.rb':
that means that the plugin didn't trigger. If you run into that, I think it's a sign that something is pretty out of whack and would advise reinstalling jekyll.
I know I'm little bit late but for others who still come across this question I would like to add my resolution:
Restart the server to get the newly added plugin working. So stop jekyll serve (Ctrl C) and restart it again with jekyll serve.

symfony2 assetics yui compressor on windows (path syntax)

I'm trying to get assetics running with the yui compressor and, if this is running, sass. Right now, both don't work. When removing all filters from config.yml and the twig template, it works and php app/console assetic:dump does copy the css and js files.
Now I want to add the yui compressor and my config.yml looks like this:
assetic:
debug: %kernel.debug%
use_controller: false
filters:
yui_js:
jar: %kernel.root_dir%/Resources/java/yuicompressor-2.4.6.jar
Adding the filter to the template and running assetic:dump again ends in the following error (translation of message by me):
[RuntimeException]
The syntax for filename, directory name or drive name is wrong
I found an article telling me to specify the path to java.exe, so I add this to config.yml:
assetic:
..
java: C:/Program Files (x86)/Java/jre6/bin/java.exe
..
Now assetic:dump tells me:
[RuntimeException]
The COMMAND "C:/Program" is either written wrong or
I tried playing around with both variables (using \ or \ instead of /, adding single or double quotes, working with short alias Progra~1 or Progra~2) in the config, but I didn't get anywhere. The both errors comming up all the time. Maybe someone can point me in the right direction.
Ok, I figured it out. Man, this one was brutal.
Let's start with the easy stuff. A working version of the config.yml can look like this:
assetic:
debug: false
use_controller: false
java: C:\Program Files (x86)\Java\jre6\bin\java.exe
sass: C:\Program Files (x86)\Ruby192\bin\sass.bat
filters:
scss: ~
yui_js:
jar: %kernel.root_dir%\Resources\java\yuicompressor-2.4.6.jar
For some reason, assetic is always importing a whole directory for scss, so I had to make a combine.scss which imports the other scss files in the correct order.
And now it gets ugly, as one have to change the assetics core in order to get this working. The developers of assetic know this bug and I think it is fixed in some development trunk/branch but not the stable one.
The Assetic\Util\ProcessBuilder has to be changed on line 95
if (defined('PHP_WINDOWS_VERSION_MAJOR')) {
,line 103
$script .= ' '.implode(' ', array_map('escapeshellarg', $args));
and line 110
return new Process($script, $this->cwd, null, $this->stdin, $this->timeout, $options);
I hope this bug get fixed soon and till then anybody trying to get it working finds this thread... Took me like 8 hours of debuging, reading and trying different approaches.
Answer by Boo Nov 19 at 22:53 did work for me by changing everything he mentioned in Assetic\Util\ProcessBuilder (I ignored line 95 as it looks the same as in my file)
Now it works on windows. Thanks!
Just to confirm. Im using Symfony 2.0.7 and yuicompressor-2.4.7
For other users who use window server 2008 r2 :
Maybe you should change the C:\windows\Temp folder property to 777 (read/write) for the IIS user / or the machine's normal user
please unpack the ruby.7z from rubyinstaller.org , and go to C:\_ruby193\bin , in this unpack position you should exec the CMD prompt , type :
ruby -S gem install sass
so that you will get the sass.bat in that position
It's time to use Boo's best answer , and please notice that in symfony2 dev env maybe it's not necessary to change the use_controller to false (in the config.yml) , because there's another use_controller in the config_dev.yml (set to true) , and in routing_dev.yml there's also a _assetic router , they're perhaps associated.

Resources