.bib; .csl and reference file in root folder, .md file in subfolder. Pandoc give back error - pandoc

Till now, I have just one project and all pandoc related files and .md files are in one, root folder (D:\My Documents\Notes) And everything works great.
Now, I have another project, so I try to make subfolder in D:\My Documents\Notes\Project2
I'm writing in VSCode, so I change pandoc-extension settings from
--lua-filter=noexport-subtrees.lua -s -f markdown --reference-doc=my-reference.docx --citeproc --csl=apa-single-spaced.csl -t docx
to
--lua-filter="D:\My Documents\Notes\noexport-subtrees.lua" -s -f markdown --bibliography="D:\My Documents\Notes\bibfile.bib"--reference-doc="D:\My Documents\Notes\my-reference.docx" --citeproc --csl="D:\My Documents\Notes\apa-single-spaced.csl" -t docx
And pandoc gives error
exec error: Error: Command failed: pandoc "d:\My Documents\Notes\ruspostmodernism\try.md" -o "d:\My Documents\Notes\ruspostmodernism\try.docx" --lua-filter="D:\My Documents\Notes\noexport-subtrees.lua" -s -f markdown --bibliography="D:\My Documents\Notes\bibfile.bib"--reference-doc="D:\My Documents\Notes\my-reference.docx" --citeproc --csl="D:\My Documents\Notes\apa-single-spaced.csl" -t docx pandoc: D:\My Documents\Notes\bibfile.bib--reference-doc=D:\My Documents\Notes\my-reference.docx: openBinaryFile: invalid argument (Invalid argument)
I suspect that there is something wrong with space in "My Documents"
Any help, please?

Related

Is it possible for Pandoc to take text as an input argument rather than an input file?

I can't seem to figure out if this is possible. Still trying to learn the tool - I've figured out how to run it on an input file and generate outputs, but would it be possible for it to, for example, take a text as an input and generate an output file.
For e.g., instead of
pandoc -i somefile.md -o -f markdown -t docx output.md
could I do
pandoc "# hello there! \n\nI went to the market" -o -f markdown -t docx output.md
Am I missing some option in the doc?
You can pass text input to pandoc. I did so by using the pipe operator:
echo "# hello there! \n\nI went to the market" | pandoc -f markdown -t docx -o foo.docx
This works with other text markups:
echo "* hello there! \n\nI went to the market" | pandoc -f org -t docx -o foo.docx
If you are targeting another text-based markup, you can even get it to print out text:
echo "# hello there! \n\nI went to the market" | pandoc -f markdown -t org
* hello there!
:PROPERTIES:
:CUSTOM_ID: hello-there
:END:
I went to the market

wget with bash command and save to other folder

I am downloading bulk images from with bash command and here is my sample file list.sh
wget https://www.japanesebuyers.com/jct/vehicle_image/2223787_a.jpg -O image1.jpg
wget https://www.japanesebuyers.com/jct/vehicle_image/1_15450940845c1843c49b959.jpeg -O image2.jpg
when I run this command in terminal ./list.sh it download file in the same folder.
I want to save files in /images/ folder
You have to tell the wget command you want to download your images in the images folder. The -O is the output. If you add -O ./images/image1.jpg it should work.
Alternatively, if you don't want to add the folder in each command, you can cd in the appropriate folder with cd images before calling wget.

Looping through files defined by `*` in a variable in BASH

I want to be able to specify a directory with fastq files with a script that will loop through all the files and do some stuff. Here is my attempt:
threads=24
current_path=`pwd`
input_file=${current_path}/raw/
files=${current_path}/raw/*
for file in ${files}; do
output_file=${current_path}/${file}_out/
mkdir -m gu=wrx,o=rx ${output_file}
spades.py \
--s1 ${input_file}${file} \
-t ${threads} \
--plasmid \
--careful \
-o ${output_file}
done
So in this script I get an error: cannot make directory, directory does not exist The script generates a /home folder. I don't know if I am specifying the files incorrectly or if I am using the for loop incorrectly.
Thank you!
you concatenate full path to file with folder in line
output_file=${current_path}/${file}_out/
it should be
output_file=${file}_out/

Using CURL to download file is having issue

I am trying to download a file from remote server using curl
curl -u username:password -O https://remoteserver/filename.txt
In my case a file filename.txt is getting created but the content of file says virtaul user logged in. It is not downloading the actual file.
I am not sure why this is happening. Any help on why the download is not working.
Try this in terminal:
curl -u username:password -o filedownload.txt -0 https://remoteserver/filename.txt
This command with -o will copy the contents of filename.txt to filedownload.txt in the current working directory.

wget to download images from retrieved file

I've got a file I need to retrieve, then I need to go through that file and download all the images listed. The format is xml, but I don't want to use an xml parser.
When I use
sudo wget --restrict-file-names=windows -nH -nd -r -i -P images \ -A jpeg,jpg,gif,png https://url.com/api/ojgnvhy75hGvcf36dnJO0947bsh62gbs?_=1361842359357
I get the xml file downloaded, but I need the images which are referenced in that file.
What am I doing wrong here?
I ended up with the following code, get the xml file and save it to text, then I get the links form the text file using sed and write those into another file, then use wget on that file to download the images.
#!/bin/dash
wget -O xml.txt 'https://url_to_download_from'
links=$(sed -n "/image>/s/^ .\([^>]*\)<\/image>.*/\1/gpw links.txt" xml.txt)
wget -N -P images -A png -i $links
Sadly, this results a bunch of files which are not images, even though I'm requesting only images.
After this script has completed, I run the following commands to clean up the folder.
cd images
shopt -s extglob nocaseglob
rm !(*.png)

Resources