No images in generated PDF document (from Asciidoc to PDF) - asciidoctor

I'm generating a PDF document from asciidoc with asciidoctor-web-pdf. So far most tasks work fine.
asciidoctor-web-pdf -a stylesheet="asciidoctor-pdf/css/asciidoctor.css,asciidoctor-pdf/css/document.css,assets/pdf-export/custom.css" \
-a stem \
--require asciidoctor-kroki \
docs/modules/ROOT/pdf.adoc
But my document does not include images or generated diagrams (plantuml).
The folder structure follows the layout of Antora because I mainly use Antora. The PDF is just a necessary side-product.
My folder structure looks like this (as said antora-layout):
project-folder
+ docs
| + modules
| | + ROOT
| | | + assets
| | | | + images
| | | | | - logo.png
| | | + pages
| | | | - index.adoc
| | | | - 01-intro.adoc
| | | | - some-other.adoc
| | | - nav.adoc
| | | - pdf.adoc
The pdf.adoc is just a list of includes to make sure every needed adoc file is part of the PDF.
According to the folder structure the correct path to my logo.png is docs/modules/ROOT/assets/images/logo.png (or absolute /home/sebastian/work/workspace/workspace-p/jira-ops-manual/docs/modules/ROOT/assets/images/logo.png).
When I generate the PDf with above command I get these errors:
normal image
Failed to load resource: net::ERR_FILE_NOT_FOUND at file:///home/sebastian/work/workspace/workspace-provinzial/jira-ops-manual/docs/modules/ROOT/logo-provinzial.png:1
plantuml diagram
asciidoctor: ERROR: pages/04-system-setup/index.adoc: line 8: include file not found: /home/sebastian/work/workspace/workspace-provinzial/jira-ops-manual/docs/modules/ROOT/pages/04-system-setup/image$04-system-setup/system-overview.puml
I guess the problem is that asciidoctor-web-pdf doesn't subsitute the image$... part of the path so the reference is wrong (or in general cannot resolve these references). Images and diagrams are embedded like this:
image::logo.png[Logo, align="center"]
[plantuml, system-overview-plantuml-image, svg]
----
include::image$04-system-setup/system-overview.puml[]
----
Does anyone have a hint how to solve my issue? I'm open to other solutions as well. Maybe there is a simpler way with antora so I don't need asciidoctor-web-pdf at all?
EDIT: I solved the problem with normal images by setting the images path at the top of the pdf-adoc.
= Operations Manual
:imagesdir: ./assets/images
include::pages/index.adoc[]
include::page1.adoc[]
include::page2.adoc[]
...
But the problem with the plantuml images still exists.
:imagesdir: ./assets/images

First, I would write a comment but I haven't 50 reputations - So I answer… sort of:
You have to know asciidoc-web-pdf is still under active development and I can't imagine it isn't well tested beside Antora. In this discussion you'll get some insights:
https://discuss.asciidoctor.org/Single-PDF-and-multiple-HTML-from-same-sources-td7640.html
That being said, I would reduce complexity (build my stuff out if Antora) and start building in little steps. Then succeed to the next step.

Related

Change the default folder structure in Azure Function project with Python

I'd like to create a Python project using Azure Functions. When creating, files are allocated into the default layout (as recommended in documentation), so currently my project has the following structure:
root
| - function_1
| | - __init__.py
| | - function.json
| - function_2
| | - __init__.py
| | - function.json
| - function_N
| | - __init__.py
| | - function.json
| - src
| | - __init__.py
| | - logic
| - host.json
| - local.settings.json
| - requirements.txt
| - tests
The problem is that N might be relatively big (>=10), so in this way the project will become messy very quickly. I'd like the project to be of the following format, with functions being grouped into folders (eg for versioning purpose and just to keep them separately from the code):
root
| - v0
| | - function_1
| | | - __init__.py
| | | - function.json
| | - function_N
| | | - __init__.py
| | | - function.json
| - v1
| | - function_1
| | | - __init__.py
| | | - function.json
| | - function_M
| | | - __init__.py
| | | - function.json
| - src
| | - __init__.py
| | - logic
| - host.json
| - local.settings.json
| - requirements.txt
| - tests
or something close to it, the main aim is to separate functions into separate folders.
However when I'm trying to run a project with such a layout, I get message saying that "No job functions found", or "Unable to find project root. Expecting to find one of host.json, local.settings.json in project root.", if I move host.json to functions folder.
Is there a way to configure project to work with this custom layout, so that functions are discoverable from their grouping directories?
All my functions are HttpTriggers.
I'm using Python3.9.7 and Visual Studio Code Version: 1.63.2 with Azure Functions extension for Visual Studio Code v1.6.0
One of the workaround I did to change the folder structure of the Azure Functions project is:
- Created the Azure Functions Project of1 Http Trigger and 1 Queue Trigger in a separate folder called QueueTriggerFuncs.
- When I Published this Azure Functions Project, got the same default folder structure shown in Microsoft documentation.
- I tried to create a folder manually in the wwwroot folder but it gave me an error called:
409 Conflict: Cannot delete directory. It is either not empty or access is not allowed. in Azure kudu
So, While publishing the project I unchecked the Run from package setting in Visual Studio Publish Profile:
And then published to Azure Function App.
- Going to Kudu Console (CMD) - seen the same folder structure but this time I'm able to create the folders manually without any error.
- Created the new folder as QueueTriggerFuncs.
- Used this command to move my Queue Trigger Functions to the the specific folder created.
mv FunctionsQ QueueTriggerFuncs
its kind of format
mv FunctionFolderName DestinationFolderName
And Now this is the modified folder structure as expected:
Where my QueueTriggerFuncs Folder contains only specific functions like Queue Trigger related functions.

Script to extract only the MaxMind GeoLite2 Country database from gzip containing multiple files

Recently MaxMind changed their download policy, and the old simple format is no longer available. The new file format looks like this: GeoLite2-Country_20191231.tar.gz, and inside we have a folder with the same name containing two additional files.
Although there is an option to delete the date parameter from the link, it seems that the downloaded file will still contain the date.
Now, the problem is to extract that GeoLite2-Country.mmdb from the gzip file having that variable name programmatically.
The unzip part existing in my old script was this:
gunzip -c "$1"GeoLite2-Country.mmdb.gz > "$1"GeoLite2-Country.mmdb
The question is how to modify the above part for the new situation. Or, maybe someone knows another way to solve the same problem. Thanks in advance.
The folder structure:
-+ Geolite2-Country_YYYYMMDD.tar.gz:
|-+ Geolite2-Country_YYYYMMDD
|- licence.txt
|- copyright.txt
|- Geolite2-Country.mmdb
What I need is Geolite2-Country.mmdb in the current folder of gzip file.
tar -tf /GeoLite2-City.tar.gz | grep mmdb | xargs tar -xf /GeoLite2-City.tar.gz --strip-components 1 -C /
Just fix source and destination paths

yocto defconfig not found

I'm attempting to create an image with yocto using a custom source (linux kernel 3.16). When I attempt to run 'bitbake myCustomRecipe', I get a warning and error like the following:
WARNING: Unable to get checksum for myCustomRecipe SRC_URI entry defconfig: file could not be found
I have several other warnings/errors, but I believe that these follow naturally due to the above warning. My layer structure is like this:
meta-mytestLayer
|
+--conf/
| |
| +--layer.conf
|
+--recipes-kernel/
|
+--linux/
|
+--myCustomRecipe_3.16/
| |
| +--defconfig
|
+--myCustomRecipe_3.16.bb
As you can see, there is a defconfig file within the myCustomRecipe_3.16/ directory. Why is this not being found? This file structure is very similar to the ones I have seen in several tutorials (like lab three of this document). My layer.config looks like this:
BBPATH .= ":${LAYERDIR}"
BBFILES += "${LAYERDIR}/recipes-*/*/*.bb \
${LAYERDIR}/recipes-*/*/*.bbappend"
BBFILE_COLLECTIONS += "myTestLayer"
BBFILE_PATTERN_myTestLayer = "^${LAYERDIR}/"
BBFILE_PRIORITY_myTestLayer = "6"
and my recipe looks like this:
inherit kernel
require recipes-kernel/linux/linux-yocto.inc
SRC_URI = "git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git;protocol=git;nocheckout=1;name=machine"
SRC_URI += "file://defconfig"
LINUX_VERSION ?= "3.16"
LINUX_VERSION_EXTENSION ?= ""
SRCREV_machine="f14680f1692a9ec2a5b1b716a7a0c03dd391106f"
PR = "r1"
PV = "${LINUX_VERSION}+git${SRCPV}"
COMPATIBLE_MACHINE = "qemux86"
I'm a total yocto newbie and am looking at a number of labs/reference manuals/tutorials but haven't found anything related to this specific problem. I'm mostly working with the link I provided earlier and using this section of the Yocto Project Linux Kernel Development Manual.
You have your defconfig file in a directory called myCustomRecipe_3.16/, while OpenEmbedded will look for the file in directories(1) named either of:
myCustomRecipe-3.16/
myCustomRecipe/
files/
Note the '-' instead of '_'.
If you look at the log.do_unpack for your failed recipe, you'll see which directories has been searched for your defconfig.
(1) Well, that's only part of the story. Those three directories will be appended with directories for all your OVERRIDES as well.

Linux compare diff / meld

I have this strange issue. I have created an algorithm that compresses Inverted Files. I have the original file (in my example it's 198.3Mb) and the decompressed file (which is 198.0 Mb). File sizes are viewed by Nautilus. I ran meld and it returns identical files. Format of both files is exactly the same. What is wrong ?!?!
Example (i ran sdiff (-s mode) and i got this, the exact same data):
170832 | 170832
170833 | 170833
170834 | 170834
170835 | 170835
170836 | 170836
How are these not identical by sdiff ?
use e.g. od -c to analyze the lines that are reported different.
Each character is displayed, including \r \t and such, so you can see exactly where differences are.

Installing Patches in linux

I have a patch file that I want to install in linux. I know there is a patch command, And I tried to use it like this:
patch -i file --verbose
where file is the patch file. But it asks me for the file to be patched(to be changed):
Hmm... Looks like a unified diff to me...
can't find file to patch at input line 17
Perhaps you should have used the -p or --strip option?
The text leading up to this was:
--------------------------
|From 13fac179aa50556ba3c60790a9beb6ca9d0b1b8b Mon Sep 17 00:00:00 2001
|From: Andrey Vagin <avagin#openvz.org>
|Date: Fri, 28 Jan 2011 23:31:20 +0300
|Subject: [PATCH rh5] vdso: export vdso_sysctl_vsyscall
|
|Signed-off-by: Andrey Vagin <avagin#openvz.org>
|---
| arch/x86_64/vdso/vclock_gettime.c | 4 ++--
| arch/x86_64/vdso/vextern.h | 1 +
| include/asm-x86_64/vsyscall.h | 1 +
| 3 files changed, 4 insertions(+), 2 deletions(-)
|
|diff --git a/arch/x86_64/vdso/vclock_gettime.c b/arch/x86_64/vdso/vclock_gettime.c
|index 5e15d01..3e586bf 100644
|--- a/arch/x86_64/vdso/vclock_gettime.c
|+++ b/arch/x86_64/vdso/vclock_gettime.c
--------------------------
File to patch:
I don't know what file should be changed so I tried to get that from the patch file itself. But of course there is no directory arch/x86_64/vdso/
This is the full patch file. Any help on how to install it?
A patch file like this contains the differences between two versions of text files.
This one contains changes to these source files:
arch/x86_64/vdso/vclock_gettime.c | 4 ++--
arch/x86_64/vdso/vextern.h | 1 +
include/asm-x86_64/vsyscall.h | 1 +
You can't install it. You can use it to patch the source code (if you have it), compile it and install the results. But I don't think that is what you want.
If you want to install bugfixes use your package manager (I guess it's 'yum' for RedHat).
I'm not good with patch files, but it seems to be a patch file in the 'git format'.
The easiest way to apply such files would be to
1) git clone <path_to_kernel_sources>
2) git checkout 13fac179aa50556ba3c60790a9beb6ca9d0b1b8b
3) git apply <patch_file>
That should take care of automatically applying it for you.
I'm not entirely sure if the commit ID 13fac179aa50556ba3c60790a9beb6ca9d0b1b8b is the correct one. I just picked that up from the e-mail part of your post.
You probably need some more arguments to patch(1). In particular, try
patch -p1 --verbose -i file

Resources