Pass HTML element into Jade variable

3

Below I have a call from an include for an "alert", I would like to know if it is possible inside the message variable not to pass pure HTML () but rather a # # call Well done! - Jade processor.

- var type = 'success'
- var message = '<strong>Bem feito!</strong> Você lê com sucesso esta mensagem de alerta importante.'

div(class='alert alert-#{type} alert-dismissible', role='alert')
  button.close(type='button', data-dismiss='alert')
    span(aria-hidden='true') &#215;
    span.sr-only Fechar
  != message
    
asked by anonymous 19.10.2014 / 16:28

1 answer

3

The solution that occurs to me is to make this message an array and use it like this:

- var type = 'success'
- var message = ['Bem feito!', 'Você lê com sucesso esta mensagem de alerta importante.']

div(class='alert alert-#{type} alert-dismissible', role='alert')
    button.close(type='button', data-dismiss='alert')
        span(aria-hidden='true') &#215;
        span.sr-only Fechar
    strong #{message[0]}#{' '}
    | #{message[1]}

In this way it calls the 'Bem feito!' inside the strong and the rest is out. The HTML looks like this:

<div role="alert" class="alert alert-success alert-dismissible">
    <button type="button" data-dismiss="alert" class="close">
        <span aria-hidden="true">&#215;</span><span class="sr-only">Fechar</span>
    </button>
    <strong>Bem feito! </strong>Você lê com sucesso esta mensagem de alerta importante.
</div>
    
19.10.2014 / 20:00