0

I'm trying to paste a widget to my site. I'm currently using PUG as my template engine. I'm not sure how the syntax for a datablock should be written. Can someone help me point out what I'm doing wrong. Or maybe if there is a work around where I can call the async/data block in vanilla javascript? I have already tried to add a . after the script tag still not working.

<!-- TradingView Widget BEGIN -->
<div class="tradingview-widget-container">
  <div class="tradingview-widget-container__widget"></div>
  <div class="tradingview-widget-copyright"><a href="https://www.tradingview.com" rel="noopener" target="_blank"><span class="blue-text">Financial Markets</span></a> by TradingView</div>
  <script type="text/javascript" src="https://s3.tradingview.com/external-embedding/embed-widget-ticker-tape.js" async>
  {
  "symbols": [
    {
      "description": "BTC/THB",
      "proName": "BXTH:BTCTHB"
    },
    {
      "description": "ETH/THB",
      "proName": "BXTH:ETHTHB"
    },
    {
      "description": "XRP/THB",
      "proName": "BXTH:XRPTHB"
    },
    {
      "description": "EOS/THB",
      "proName": "BITFINEX:EOSTHB"
    },
    {
      "description": "LTC/THB",
      "proName": "BITFINEX:LTCTHB"
    },
    {
      "description": "BSV/THB",
      "proName": "BITFINEX:BSVTHB"
    }
  ],
  "theme": "dark",
  "isTransparent": false,
  "displayMode": "adaptive",
  "locale": "en"
}
  </script>
</div>
<!-- TradingView Widget END -->

This is what I get from https://html2jade.org/.

// TradingView Widget BEGIN
.tradingview-widget-container
  .tradingview-widget-container__widget
  .tradingview-widget-copyright
    a(href='https://www.tradingview.com', rel='noopener', target='_blank')
      span.blue-text Financial Markets
    |  by TradingView
  script(type='text/javascript', src='https://s3.tradingview.com/external-embedding/embed-widget-ticker-tape.js', async='')
    {
    "symbols": [
    {
    "description": "BTC/THB",
    "proName": "BXTH:BTCTHB"
    },
    {
    "description": "ETH/THB",
    "proName": "BXTH:ETHTHB"
    },
    {
    "description": "XRP/THB",
    "proName": "BXTH:XRPTHB"
    },
    {
    "description": "EOS/THB",
    "proName": "BITFINEX:EOSTHB"
    },
    {
    "description": "LTC/THB",
    "proName": "BITFINEX:LTCTHB"
    },
    {
    "description": "BSV/THB",
    "proName": "BITFINEX:BSVTHB"
    }
    ],
    "theme": "dark",
    "isTransparent": false,
    "displayMode": "adaptive",
    "locale": "en"
    }
// TradingView Widget END

It seems like the html is correct. If you look at the screenshotenter image description here

  • 2
    A few notes: [you can’t put content inside a ` – MTCoster Feb 21 '19 at 13:18
  • I directly copied from https://www.tradingview.com/widget/ticker-tape/ – Mak Suriya Jacobsen Feb 21 '19 at 13:21
  • And it works find if it is in raw html. But my project I'm only limited to use PUG. – Mak Suriya Jacobsen Feb 21 '19 at 13:23
  • 1
    All three of the questions I linked to contain references to HTML specifications - just because some instructions tell you something doesn’t make it correct. It’s likely they’re taking advantage of [undefined behaviour](https://en.wikipedia.org/wiki/Undefined_behavior) which Pug doesn’t handle the same way as common browsers – MTCoster Feb 21 '19 at 13:24

0 Answers0