template-variables Questions
9
Solved
I am trying to get list of all variables and blocks in a template. I don't want to create my own parser to find variables. I tried using following snippet.
from jinja2 import Environment, PackageL...
Gocart asked 24/11, 2011 at 17:5
8
Solved
Python has a feature called template strings.
>>> from string import Template
>>> s = Template('$who likes $what')
>>> s.substitute(who='tim', what='kung pao')
'tim like...
Ling asked 7/10, 2011 at 4:44
4
Solved
Is there a way to use placeholders in YAML like this:
foo: &FOO
<<propname>>:
type: number
default: <<default>>
bar:
- *FOO
propname: "some_prop"
def...
Lianaliane asked 12/1, 2017 at 18:44
4
Solved
I have the following Python code (I'm using Python 2.7.X):
my_csv = '{first},{middle},{last}'
print( my_csv.format( first='John', last='Doe' ) )
I get a KeyError exception because 'middle' is no...
Haversine asked 13/6, 2012 at 20:15
5
Solved
In Perl I can do something like the following:
my $home = "/home";
my $alice = "$home/alice";
Can I do something like the following in YAML:
Home: /home
Alice: $Home/alice
So "Alice" is effec...
Lyra asked 3/4, 2013 at 2:42
3
So yet another question in this saga. Guillaume Racicot has been good enough to provide me with yet another workaround so this is the code I'll be basing this question off of:
struct vec
{
double...
Demiurge asked 19/6, 2019 at 12:38
1
Solved
Guillaume Racicot gave an excellent answer to this question on how I could specialize template variables. But I'm having trouble in visual-studio-2017 with creating a templated array of function po...
Dauphin asked 18/6, 2019 at 12:44
1
Solved
I want to declare something like this:
template <typename T>
constexpr enable_if_t<is_integral_v<T>, int[]> foo = { 1, 2 };
template <typename T>
constexpr enable_if_t<...
Kara asked 14/6, 2019 at 12:44
1
Another question of type "who's right between g++ and clang++?" for C++ standard gurus.
Suppose we want apply SFINAE to a variable template to enable the variable only if the template type fulfill...
Sunglass asked 10/2, 2018 at 13:56
2
Solved
I am trying to substitute variables in the format {{var}} with Python's Template.
from string import Template
class CustomTemplate(Template):
delimiter = '{{'
pattern = r'''
\{\{(?:
(?P<esc...
Cheboksary asked 18/12, 2015 at 17:8
1
Solved
A class can contain a member template variable which must be static:
class B
{
public:
template <typename X>
static X var;
B() { std::cout << "Create B " << __PRETTY_FUNCTI...
Karli asked 8/9, 2016 at 14:7
1
Is it possible in .yml config to have dynamic properties in variables that are set depending on a particular case. For example:
MY_VAR: &MY_VAR
keys:
key2: blahblahblah
key3: blahblahblah #...
Inspirit asked 18/6, 2015 at 1:32
1
Solved
Consider the code below:
#include <iostream>
template<typename T>
T n;
int main()
{
n<int> = 42;
std::cout << n<int> << std::endl;
}
It compiles and links...
Pyrotechnics asked 17/6, 2015 at 15:50
1
© 2022 - 2024 — McMap. All rights reserved.