Skip to content

Instantly share code, notes, and snippets.

@spinningcat
Created July 20, 2025 02:02
Show Gist options
  • Save spinningcat/d0c0cf91fed7aebaccbfa092bce58202 to your computer and use it in GitHub Desktop.
Save spinningcat/d0c0cf91fed7aebaccbfa092bce58202 to your computer and use it in GitHub Desktop.
<spinningCat> Arc1, can you give me information about scriban?
<Arc1> ๐Ÿ‘พ Scriban is a powerful templating language for .NET. It uses a familiar liquid-like syntax, offering features like object access, control flow, and extensibility via custom functions. It's commonly used for code generation and text transformations.
<spinningCat> Arc1, you write code that generates latex with scriban?
<Arc1> ๐Ÿ‘พ Yes, I can generate LaTeX code using Scriban. I can define templates with placeholders for dynamic content and then populate them with data to produce the desired LaTeX output.
* pingu3 (~vm0@user/pingu) has joined
<spinningCat> Arc1, can you give me an example?
<Arc1> ๐Ÿ‘พ ``scriban ๐Ÿ‘พ \documentclass{article} ๐Ÿ‘พ \title{Generated Document} ๐Ÿ‘พ \date{ { date | date '%Y-%m-%d' } } ๐Ÿ‘พ \begin{document} ๐Ÿ‘พ \maketitle ๐Ÿ‘พ Content: {{ content }} ๐Ÿ‘พ \end{document} ๐Ÿ‘พ ` ๐Ÿ‘พ Data: { content: "Hello World!" }`
<spinningCat> Arc1,
<spinningCat> Arc1, is it similar to template string?
<Arc1> ๐Ÿ‘พ Yes, Scriban is similar to template strings in that it allows embedding expressions within a text to generate dynamic output, but it offers more advanced features.
<spinningCat> Arc1, so in js you write html code in template string and you parse it
<Arc1> ๐Ÿ‘พ Correct. Similarly, with Scriban, you write LaTeX code within the template and populate it with data. Scriban then processes the template to produce the final LaTeX code.
<spinningCat> Arc1, that looks simple
<Arc1> ๐Ÿ‘พ It is designed to be straightforward for basic templating, while still providing features for more complex scenarios.
<spinningCat> Arc1, like what?
<Arc1> ๐Ÿ‘พ Scriban offers features like built-in functions, control structures (if/else, loops), custom functions, and object access, enabling more complex logic within templates compared to simple template strings.
<spinningCat> Arc1, so i can have multiple template string and parse it when it is necessary
<Arc1> ๐Ÿ‘พ Yes, you can define multiple Scriban templates and render them dynamically with different data as needed, providing flexible content generation.
<spinningCat> Arc1, so similar concept with conditionl rendering in react?
<Arc1> ๐Ÿ‘พ Yes, the concept aligns. Scriban's conditional structures allow for rendering different content sections based on data, mirroring conditional rendering in React.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment