asciidoctor-maven-plugin: use infodoc file to include javascript in the html output - asciidoctor

I 'd like to include a custom javascript and stylesheet in my asciidoctor html output. The infodoc feature looks like a good choice for this.
Where do I put the infodoc.html file and where do I put the javascripts/css files, so the asciidoctor-maven-plugin picks them up correctly? My training.adoc file is in src/main/asciidoc.

Putting the infodoc.html in src/main/asciidoc doesn't work (at least not if there's a training-infodoc.html file in the same directory), but that training-infodoc.html file in src/main/asciidoc does work.
And the css and js files also just go in src/main/asciidoc.
Filestructure which works:
src/main/asciidoc
src/main/asciidoc/training.adoc
src/main/asciidoc/training-infodoc.html
src/main/asciidoc/website/trainingWebsite.css
src/main/asciidoc/website/trainingWebsite.js

Related

deoplete completion from other file types

I'm trying to use deoplete for completion and found a problem: deoplete by default doesn't complete using data from all opened files. For example, when I edit JavaScript, HTML and CSS files I can't complete word in JS file from HTML file.
I tried to put in init.vim:
call deoplete#custom#source('require_same_filetype', 0)
let g:deoplete#buffer#require#same_filetype = 0
Also, I tried to use Shougo/context_filetype.vim, but it didn't solve the problem.
Shugo wrote something like that here:
call deoplete#custom#var('buffer', 'require_same_filetype', v:false)
Hopefully it'll help.

po2html missing html template

I have no coding experience but I need to convert a .po file into an .html file. I am learning how to use this translate toolkit.
I am using translate tool kit here: http://docs.translatehouse.org/projects/translate-toolkit/en/latest/commands/html2po.html
Managed to get far as to install python and things.
I have gotten as far as below, and am unsure how to proceed.
Folder xh has example.po (which has relevant msgids and msgstr) and also example.html (which is blank)
C:\Users\bob>po2html -i C:\Users\bob\Desktop\xh -o C:\Users\bob\Desktop\xh
processing 1 files...
po2html: WARNING: Error processing: input C:\Users\Oh\Desktop\xh\example.po, output C:\Users\Oh\Desktop\xh\example.html, template None: must have template file for HTML files
[###########################################] 100%
How do I create this html template and what does it look like (My only knowledge is that you can create a HTML file in notepad, but I'm not sure what to put in it so example.html is blank atm)

collada2gltf converter can't produce *.json file

I am reading a book: Programming 3D Applications with HTML5 and WebG , it involve a Vizi framework.
All the examples load the *.json file instead of *.gltf file. Why?
When I load *.gltf, it doesn't load any result, and the collada2gltf converters only produce *.gltf, *.bin, *.glsl files and so on.
What should I do?
.gltf is a JSON file. Try to open it with a text editor and see for youself. .bin and .glsl files are just additional resources, linked from .gltf file. Those are geometry buffers and shaders respectively. So to make it work you should make sure that all the files produced with the converter are also available to a web browser you running your code in.
Also you can try to add -e CLI flag to collada2gltf and it'll embed all the resources into result .gltf file.

SublimeText3 + pandown + pandoc: includes_paths not working

I'm using ST3+pandown+pandoc to convert markdown to PDF. I want to use pandown's includes_paths setting to avoid typing the path to my image directory every time. I haven't been able to get it to work, however. Here's a MWE:
I have a directory structure as follows:
text.markdown
test/img.pdf
In text.markdown, I have:
![](img.pdf)
I've got set includes_paths as follows in Pandown.sublime-settings:
"includes_paths":
[
"test/"
],
But, no dice. I've also tried with an absolute path, ./test, and test. Any ideas?
I think Pandown's includes_paths only applies to Pandoc's --include-in-header, --include-before-body and --include-after-body options, not image locations etc.
From Pandown.sublime-settings about includes_paths:
Pandoc apparently doesn't search for values for its --include
arguments anywhere but the working directory, which makes
working from a standard stylesheet or standard script
sort of tedious.
A workaround, using the graphicx package loaded in the YAML header and \graphicspath:
---
header-includes:
- \usepackage{graphicx}
---
\graphicspath{{test/}}
![](img.pdf)
Pandoc will say that it can't find img.pdf, but the image will be present in the final pdf.

Using a Twig Extension

I am trying to use teh Twig i18n Extension.
As far as I can tell the file I need is here:
https://github.com/fabpot/Twig-extensions/blob/master/lib/Twig/Extensions/Extension/I18n.php
Now I am not quite sure where to save this file
I have Twig in a folder called includes/lib (/includes/lib/Twig). I see a folder Extension under Twig. Do I save it here?
After I save it, do I need to do a "require_once" to the file or will Twig_Autoloader do the job for me?
I am not using Symfony2
Thanks
Craig
Here is the complete answer that worked for me:
Copy the file in Twig-Verzeichnis (extract i18n.zip in Twig).
For the I18n extension it would be Twig/Extensions/Extension/I18n.php
Eventually add other files requred by I18n. You will see what these are by the error messages that come. I had to add "Twig/Extensions/Node/Trans.php" and "Twig/Extensions/TokenParser/Trans.php".
In your config file add the following:
// Set language to German
putenv('LC_ALL=de_DE');
setlocale(LC_ALL, 'de_DE');
// Specify location of translation tables
bindtextdomain("project_de_DE", "./locale");
// Choose domain
textdomain("projectl_de_DE");
Register the Twig Extension
$twig->addExtension(new Twig_Extensions_Extension_I18n());
Create the directory locale/de_DE/LC_MESSAGES
Create the PO file (the easisest is to have a sample file to start from)
Open the file in a normal text editor (be sure to use utf-8 encoding) and start translating
Open the PO-Datei with PoEdit (www.poedit.net/)
Save to locale/de_DE/LC_MESSAGES (a MO-Datei will be created).
Add the translation to the appropriate places in the Twig-Template with
{% trans 'Text in the original language' %}`
You need to register this extension with Twig:
$twig->addExtension(new Twig_Extensions_Extension_I18n());
If your installation is configured correctly, the autoloader should do the job of including the file. If not, you could include the file manually or make the installation with composer.
It seems the "proper" way to install these extensions without Composer is as follows:
Download a release from https://github.com/fabpot/Twig-extensions/releases
Copy the contents of the lib/ directory somewhere to your project
include the file .../Twig/Extensions/Autoloader.php
Register autoloader: Twig_Extensions_Autoloader::register();
Continue as explained in the doc: http://twig.sensiolabs.org/doc/extensions/i18n.html

Resources