I've found the following .travis.yml template.
I've noticed this:
repo: {GITHUB_USER}/{PROJECT_NAME}
Is this a special .yml variable syntax I'm not familiar with? Where can I set these values (GITHUB_USER, PROJECT_NAME)?
I know I can use environment variables, like so:
repo: $GITHUB_USER/$PROJECT_NAME
but this syntax looks different.
That is not a valid YAML file. After the first } the YAML parser will expect a block style continuation. This means either a key that aligns with repo or outdenting. Instead it finds a / and any YAML parser should throw an error on that.
This looks like a template for a YAML file, e.g. using something like the following in Python after loading the contents of the file in string templ:
templ.format(**dict(GITHUB_USER="Janez", PROJECT_NAME="test"))
On the other hand the recommended extension for YAML files has been .yaml for many more years than Travis exists, so maybe that is why they used the .yml extension.
Related
I try to write a map in y yaml file and want to use it in yaml file itself with a key. for example ->
in my yaml file I wrote -
pod_env_map:
pod1: "env1"
pod2: "env2"
pod3: "env3"
and in this yaml file itself I'm getting a var $pod_name.
So now i want to write stages with some command for all pod and correspond env.
So instead of putting multiple checks of $pod_name == 'pod1'....
I want to use above dict somehow in code like pod_env_map[$pod_name], please help me to know what should be the syntax for this? I tried to find but didn't get relavent info anywhere.
I would like to write line comments in lftp's include and exclude lists loaded from external files. Is there syntax for that, like using hash symbol or double slashes?
I'm thinking about files referred by the following options:
--include-rx-from=FILE
--exclude-rx-from=FILE
--include-glob-from=FILE
--exclude-glob-from=FILE
So the content of such files could look like this:
# This is a comment about the lines below
foo.bar
foobar/
Can I do it somehow?
I looked for it in the manual and googled it but found nothing.
I'm currently building a Shopify store and would like to use env variables in Themekit's config.yml file. What I'm confused about is how to connect the .env file to the yml file, since I don't think you can just require dotenv. I have my .env file, and the code below in the config.yml. Thanks!
password: ${DEV_PASSWD}
theme_id: ${DEV_THEMEID}
store: ${DEV_SHOP}
You can't include .env file inside a YAML one. However, you can interpolate variables into your config.yml file using the ${} notation.
To help you interpolate variables, there are special files that can be used to automatically to load environment variables for Theme Kit. The following table lists the file paths for each operating system:
macOs: ${HOME}/Library/Application Support/Shopify/Themekit/variables
Linux/BSD: ${XDG_CONFIG_HOME}/Shopify/Themekit/variables
Windows: %APPDATA%\Shopify\Themekit\variables
Even more, you can use the --vars flag in any command to provide a path to a file for loading variables. The variables file has the same format as most .env type files. But note, the .env file is not interpolated by YAML itself and it cannot be connected using standard YAML include directives. All magic is provided exclusively by shopify and its --vars flag.
I need to include the following code in a .tex file that is generated from a custom template via RMarkdown, in order to get rid of an error. However, if I try it as below in the YAML heading:
header-includes:
\newenvironment{CSLReferences}%
{}%
{\par}
it gets parsed into the .tex file as single line, like \newenvironment{CSLReferences}% {}% {\par}, thus commenting out everything after %. So how can I change the YAML part so that it correctly gets interpreted as 3 different lines?
Instead of worrying about the markdown parsing, you can write the command in a single line:
header-includes:
\newenvironment{CSLReferences}{}{\par}
Alternatively avoid all these annoying problems with markdown parsing and put your definition in a .tex file which you can include via
includes:
in_header: header.tex
After some trials & searching this works (found a solution while writing the question):
header-includes:
- "\\newenvironment{CSLReferences}%"
- "{}%"
- "{\\par}"
Interestingly, I couldn't find much in the official documentation.
EDIT:
As #samcarter mentioned in the comments & an answer, in this particular case a single line would've been enough, as
header-includes:
\newenvironment{CSLReferences}{}{\par}
I know reStructuredText has this directive:
.. code:: bash
gedit pohl.m
which renders a code block. Is there some way to get syntax highlighting for inline snippets like this:
Do edit the file, type ``gedit pohl.m`` into a terminal.
The backticks mark it as code, but I'd like to highlight it with pygments like the block. Is this possible?
Having looked into this some more I stumbled upon the document reStructuredText Interpreted Text Roles. From this document:
Interpreted text uses backquotes (`) around the text. An explicit role marker may optionally appear before or after the text, delimited with colons. For example:
This is `interpreted text` using the default role.
This is :title:`interpreted text` using an explicit role.
It seems that there is a code role, so you can simply type
:code:`a = b + c`
to render an inline code block. To get syntax highlighting you can define a custom role. For example
.. role:: bash(code)
:language: bash
which you can then use like so:
Here is some awesome bash code :bash:`a = b + c`.
Note that the role definition must be placed before references to the role.
Note, the document I link to makes no mention of the version of docutils to which it refers. The code role is not available in docutils 0.8.1 (which is the only version I have to test against).
For me I had to create a docutils.conf file in the Sphinx's configuration directory (where conf.py resides).
It had the following contents:
[restructuredtext parser]
syntax_highlight = short
See this answer for more information on the above
To set the role globally, in the conf.py file, I created a rst_prolog variable. The string inside it will be included at the beginning of every source file that is read.
rst_prolog = """
.. role:: python(code)
:language: python
:class: highlight
"""
In this highlight class was necessary for proper Python highlighting.
See this answer for more information on the above