Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

158
Vistas
Pug template + interpolation from a function

I have a utility function which takes some text, and inserts hyperlinks via pug templating. For example:

function toPugLink(text, url) { ... }

toPugLink('test', 'stackoverflow.com') -> #[a(href='stackoverflow.com) test]

However, when I want to consume this, Pug does not seem to recognise it.

mixin body(data, utils)
  p #{utils.toPugLink(data.text, data.urlTokens)}

Instead, what is output is the literal value, rather than the tokenised template.

How can I tell pug to render my output as a pug template rather than a literal string?

This is a simplified version of my code. The full version contains large amounts of text, the function replaces multiple tokens, etc, so quick workarounds sadly can't be used here.

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda