Jade 中的文档类型声明
doctype declaration in Jade
我试图在 Jade 中重新生成输出代码(包括回车 returns)但没有成功:
正在尝试输出以下内容:
<?xml version="1.0"?>
<!DOCTYPE j:jelly
[
<!ENTITY aacute "á">
<!ENTITY Aacute "Á">
<!ENTITY ordm "º">
<!ENTITY euro "€">
<!ENTITY amp "&">
<!ENTITY iquest "¿">
<!ENTITY iexcl "¡">
<!ENTITY copy "©">
]>
在玉码我有:
<?xml version="1.0"?>
doctype j:jelly[<!ENTITY aacute "á"><!ENTITY Aacute "Á"><!ENTITY eacute "é"><!ENTITY ordm "º"><!ENTITY euro "€"><!ENTITY amp "&"><!ENTITY iquest "¿"><!ENTITY iexcl "¡"><!ENTITY copy "©"> ]
只输出一行(工作但凌乱,没有回车returns):
<?xml version="1.0"?>
<!DOCTYPE j:jelly [<!ENTITY aacute "á"><!ENTITY Aacute "Á"><!ENTITY ordm "º"><!ENTITY euro "€"><!ENTITY amp "&"><!ENTITY iquest "¿"><!ENTITY iexcl "¡"><!ENTITY copy "©">]>
所以只需在原始文本中添加换行符:
<?xml version="1.0"?>
| < doctype j:jelly
| [
| <!ENTITY aacute "á">
| <!ENTITY Aacute "Á">
| <!ENTITY eacute "é">
| <!ENTITY ordm "º">
| <!ENTITY euro "€">
| <!ENTITY amp "&">
| <!ENTITY iquest "¿">
| <!ENTITY iexcl "¡">
| <!ENTITY copy "©">
| ]>
得到
<?xml version="1.0"?>
< doctype j:jelly
[
<!ENTITY aacute "á">
<!ENTITY Aacute "Á">
<!ENTITY eacute "é">
<!ENTITY ordm "º">
<!ENTITY euro "€">
<!ENTITY amp "&">
<!ENTITY iquest "¿">
<!ENTITY iexcl "¡">
<!ENTITY copy "©">
]>
因为这仅使用原始文本,您可以考虑使用 include 语句。
与
start.jade:
include ./other.jade
和
other.jade:
<?xml version="1.0"?>
< doctype j:jelly
[
<!ENTITY aacute "á">
<!ENTITY Aacute "Á">
<!ENTITY eacute "é">
<!ENTITY ordm "º">
<!ENTITY euro "€">
<!ENTITY amp "&">
<!ENTITY iquest "¿">
<!ENTITY iexcl "¡">
<!ENTITY copy "©">
]>
你会得到
/usr/lib/node_modules/jade/lib/runtime.js:240
throw err;
^
Error: other.jade:3
1| <?xml version="1.0"?>
2| < doctype j:jelly
> 3| [
4| <!ENTITY aacute "á">
5| <!ENTITY Aacute "Á">
6| <!ENTITY eacute "é">
unexpected text [
<!
at Object.Lexer.fail (/usr/lib/node_modules/jade/lib/lexer.js:887:11)
at Object.Lexer.next (/usr/lib/node_modules/jade/lib/lexer.js:947:15)
at Object.Lexer.lookahead (/usr/lib/node_modules/jade/lib/lexer.js:113:46)
at Parser.lookahead (/usr/lib/node_modules/jade/lib/parser.js:102:23)
at Parser.peek (/usr/lib/node_modules/jade/lib/parser.js:79:17)
at Parser.parse (/usr/lib/node_modules/jade/lib/parser.js:117:26)
at Parser.parseInclude (/usr/lib/node_modules/jade/lib/parser.js:616:22)
at Parser.parseExpr (/usr/lib/node_modules/jade/lib/parser.js:223:21)
at Parser.parse (/usr/lib/node_modules/jade/lib/parser.js:122:25)
at parse (/usr/lib/node_modules/jade/lib/index.js:104:21)
因为要包含的文件被解释为玉模板。只需重命名即可。
与
start.jade:
include ./other.inc
和
other.inc:
<?xml version="1.0"?>
< doctype j:jelly
[
<!ENTITY aacute "á">
<!ENTITY Aacute "Á">
<!ENTITY eacute "é">
<!ENTITY ordm "º">
<!ENTITY euro "€">
<!ENTITY amp "&">
<!ENTITY iquest "¿">
<!ENTITY iexcl "¡">
<!ENTITY copy "©">
]>
你会得到预期的
<?xml version="1.0"?>
< doctype j:jelly
[
<!ENTITY aacute "á">
<!ENTITY Aacute "Á">
<!ENTITY eacute "é">
<!ENTITY ordm "º">
<!ENTITY euro "€">
<!ENTITY amp "&">
<!ENTITY iquest "¿">
<!ENTITY iexcl "¡">
<!ENTITY copy "©">
]>
我试图在 Jade 中重新生成输出代码(包括回车 returns)但没有成功:
正在尝试输出以下内容:
<?xml version="1.0"?>
<!DOCTYPE j:jelly
[
<!ENTITY aacute "á">
<!ENTITY Aacute "Á">
<!ENTITY ordm "º">
<!ENTITY euro "€">
<!ENTITY amp "&">
<!ENTITY iquest "¿">
<!ENTITY iexcl "¡">
<!ENTITY copy "©">
]>
在玉码我有:
<?xml version="1.0"?>
doctype j:jelly[<!ENTITY aacute "á"><!ENTITY Aacute "Á"><!ENTITY eacute "é"><!ENTITY ordm "º"><!ENTITY euro "€"><!ENTITY amp "&"><!ENTITY iquest "¿"><!ENTITY iexcl "¡"><!ENTITY copy "©"> ]
只输出一行(工作但凌乱,没有回车returns):
<?xml version="1.0"?>
<!DOCTYPE j:jelly [<!ENTITY aacute "á"><!ENTITY Aacute "Á"><!ENTITY ordm "º"><!ENTITY euro "€"><!ENTITY amp "&"><!ENTITY iquest "¿"><!ENTITY iexcl "¡"><!ENTITY copy "©">]>
所以只需在原始文本中添加换行符:
<?xml version="1.0"?>
| < doctype j:jelly
| [
| <!ENTITY aacute "á">
| <!ENTITY Aacute "Á">
| <!ENTITY eacute "é">
| <!ENTITY ordm "º">
| <!ENTITY euro "€">
| <!ENTITY amp "&">
| <!ENTITY iquest "¿">
| <!ENTITY iexcl "¡">
| <!ENTITY copy "©">
| ]>
得到
<?xml version="1.0"?>
< doctype j:jelly
[
<!ENTITY aacute "á">
<!ENTITY Aacute "Á">
<!ENTITY eacute "é">
<!ENTITY ordm "º">
<!ENTITY euro "€">
<!ENTITY amp "&">
<!ENTITY iquest "¿">
<!ENTITY iexcl "¡">
<!ENTITY copy "©">
]>
因为这仅使用原始文本,您可以考虑使用 include 语句。
与
start.jade:
include ./other.jade
和
other.jade:
<?xml version="1.0"?>
< doctype j:jelly
[
<!ENTITY aacute "á">
<!ENTITY Aacute "Á">
<!ENTITY eacute "é">
<!ENTITY ordm "º">
<!ENTITY euro "€">
<!ENTITY amp "&">
<!ENTITY iquest "¿">
<!ENTITY iexcl "¡">
<!ENTITY copy "©">
]>
你会得到
/usr/lib/node_modules/jade/lib/runtime.js:240
throw err;
^
Error: other.jade:3
1| <?xml version="1.0"?>
2| < doctype j:jelly
> 3| [
4| <!ENTITY aacute "á">
5| <!ENTITY Aacute "Á">
6| <!ENTITY eacute "é">
unexpected text [
<!
at Object.Lexer.fail (/usr/lib/node_modules/jade/lib/lexer.js:887:11)
at Object.Lexer.next (/usr/lib/node_modules/jade/lib/lexer.js:947:15)
at Object.Lexer.lookahead (/usr/lib/node_modules/jade/lib/lexer.js:113:46)
at Parser.lookahead (/usr/lib/node_modules/jade/lib/parser.js:102:23)
at Parser.peek (/usr/lib/node_modules/jade/lib/parser.js:79:17)
at Parser.parse (/usr/lib/node_modules/jade/lib/parser.js:117:26)
at Parser.parseInclude (/usr/lib/node_modules/jade/lib/parser.js:616:22)
at Parser.parseExpr (/usr/lib/node_modules/jade/lib/parser.js:223:21)
at Parser.parse (/usr/lib/node_modules/jade/lib/parser.js:122:25)
at parse (/usr/lib/node_modules/jade/lib/index.js:104:21)
因为要包含的文件被解释为玉模板。只需重命名即可。
与
start.jade:
include ./other.inc
和
other.inc:
<?xml version="1.0"?>
< doctype j:jelly
[
<!ENTITY aacute "á">
<!ENTITY Aacute "Á">
<!ENTITY eacute "é">
<!ENTITY ordm "º">
<!ENTITY euro "€">
<!ENTITY amp "&">
<!ENTITY iquest "¿">
<!ENTITY iexcl "¡">
<!ENTITY copy "©">
]>
你会得到预期的
<?xml version="1.0"?>
< doctype j:jelly
[
<!ENTITY aacute "á">
<!ENTITY Aacute "Á">
<!ENTITY eacute "é">
<!ENTITY ordm "º">
<!ENTITY euro "€">
<!ENTITY amp "&">
<!ENTITY iquest "¿">
<!ENTITY iexcl "¡">
<!ENTITY copy "©">
]>