I have these delimiters but I would like to see other options?
"{{", "}}"
"((", "))"
"[[", "]]"
"#{", "}"
I have these delimiters but I would like to see other options?
"{{", "}}"
"((", "))"
"[[", "]]"
"#{", "}"
Are you saying that your template has “{{”, “}}”? You can fill in these delimiters as variables, and this will not affect the overall template resolution.
I just want alternatives to those delimiters I mentioned, I’m just out of ideas.
I’m not sure what you’re trying to express? I think you’re having an issue with not being able to output delimiters? Maybe you should write some sample code to let others know about your problem? If it’s a problem that you can’t output a delimiter, you can try this:
t2 := template.New("")
parse, err := t2.Parse("abc{{.x}}d")
if err != nil {
panic(err)
}
bs := new(bytes.Buffer)
parse.Execute(bs, map[string]string{
"x": "{{",
})
fmt.Println(bs.String())
If you’re just thinking about func (t *Template) Delims(left string, right string) *Template? Then I think it’s irrelevant, you should consider the issue of the hit rate of the template text.
For example, if you have a lot of “{{” in a text, then obviously you shouldn’t use the “{{” separator, if it’s just a small number of triggers, then it doesn’t matter.
I don’t have any bugs, here’s another alternative: "#{"
and "}"
I’m just looking for ideas for delimiters to use in my templates, and yes, it’s irrelevant but it gives me creativity.
Here’s another one: "«", "»"
I think this matter, the main consideration is the probability of your template text hitting the delimiter, the template I use at the moment basically does not change the default delimiter, because the template is generated by me.
If this template text is uncontrollable, I guess you should need statistical probability.
You’re making it too complicated, the question is simple, I just want two strings as ideas, why are you making it too complicated?
For example, I’m not going to use these two strings as delimiters “aa” and “bb”, I have to use characters that make sense, and I just asked a simple question here, what other characters could I use as delimiters?
Tell me you’re trolling because the question is too simple.
emmm, that’s the simple question? I think that changing this delimiter does need to consider the problem of template text, and if the template text always has a delimiter, then it needs to be handled frequently. For example, “</” and “>” in html.
As someone who writes code, I would consider whether this separator would always interfere with the freedom of writing the template text. As for other things, of course, how to facilitate and how to come.
If you think I’m talking nonsense, then I’m sorry to bother you.
I use {% %} from the jinja syntax.
I like it! Other ideas:
{[ ]}
{( )}
[{ }]
[( )]
([ ])
({ })
etc…
This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.