为什么注释HTML的代码不转换为玉转换

时间:2014-07-17 06:12:46

标签: html css templates pug

我正在尝试使用一些在线工具将HTML代码块转换为jade,但似乎没有一个对我有用,现在让我告诉我在这里做错了,因为我是新手,因此使用这些工具。< / p>

HTML代码 -

<!DOCTYPE html>
<!--[if lt IE 7]>      <html class="no-js sidebar-large lt-ie9 lt-ie8 lt-ie7"> <![endif]-->
<!--[if IE 7]>         <html class="no-js sidebar-large lt-ie9 lt-ie8"> <![endif]-->
<!--[if IE 8]>         <html class="no-js sidebar-large lt-ie9"> <![endif]-->
<!--[if gt IE 8]>      <html class="no-js sidebar-large"> <![endif]-->

退回的玉码 -

doctype html
html.no-js.sidebar-large
  // <![endif]

由于我的html文件太大,我正在按块转换此块,因此在使用时超出了单词/字符限制。

使用的工具 -

  1. http://html2jade.vida.io/
  2. http://html2jade.aaron-powell.com/

1 个答案:

答案 0 :(得分:0)

除非您为他们提供带有正确开头和结尾标记的干净标记,否则这些工具不会给您合适的结果。

在我上面提到的示例中,它不起作用,因为我在<html>之后没有包含<!DOCTYPE html>

所以正确的代码是 -

<!DOCTYPE html>
<html>
<!--[if lt IE 7]>      <html class="no-js sidebar-large lt-ie9 lt-ie8 lt-ie7"> <![endif]-->
<!--[if IE 7]>         <html class="no-js sidebar-large lt-ie9 lt-ie8"> <![endif]-->
<!--[if IE 8]>         <html class="no-js sidebar-large lt-ie9"> <![endif]-->
<!--[if gt IE 8]>      <html class="no-js sidebar-large"> <![endif]-->

JADE 结果 -

!!! 5
html
//if lt IE 7
  //if IE 7
  //if IE 8
  //if gt IE 8