N
N
Nikita Nafranets2016-09-22 07:02:18
Node.js
Nikita Nafranets, 2016-09-22 07:02:18

Why does the method handle parameters incorrectly?

I made this thing for myself https://html2pug.herokuapp.com/ , just because.
But I can't figure out why the html2jade plugin has a method

html2jade.convertHtml(html, {}, function (err, jade) {
  // do your thing
});

takes the tabs parameter once, and then hangs on it. And until you reload the page, it does not stop displaying the code with tabs. I displayed the parameters that I pass through the post to the console and they are what I expect, but the method still gives a response with tabs, even if tabs: false. Why is that? Thanks in advance.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alexey Ukolov, 2016-09-22
@Dimensi

You have code like this:

useTabs = false // дефолтное значение
...
useTabs = true if options.tabs // должно браться из настроек,
// но вы проверяете только true. False ваши настройки никогда не передадут

Should always be taken from the settings:
Or, if the default should be, for example, true , then like this:
useTabs = if options.tabs is false then false else true

A
Andrey Dyrkov, 2016-09-22
@VIKINGVyksa

In jade, tabs are nested, it is impossible to get rid of them, not valid code. The tabs parameter is responsible for the size of the tabs in spaces, most likely. Pass a size to tabs, like 2.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question