Include 指令支持矩阵

本文档描述了在以下环境中如何解析 include 指令:

  • 浏览器(XMLHttpRequest IO 模块)

  • Node.js

  • MRI(Ruby)

path Base dir Browser Node.js MRI

path/to/file.adoc

file:///root

👌

👌

❌ The resolved path is /root/file:/root/path/to/file.adoc.

path/../path/to/file.adoc

file:///root

👌

👌

❌ The resolved path is /root/file:/root/path/to/file.adoc.

file:///root/path/to/file.adoc

👌

👌

❌ include uri not readable: file:///root/path/to/file.adoc.

file:///root/path/../path/to/file.adoc

👌

👌

❌ include uri not readable: file:///root/path/../path/to/file.adoc.

path/to/file.adoc

❌ Unable to get the current directory in a reliable way.

👌

👌

file:///root/path/to/file.adoc

file:///root/path/to

👌

👌

❌ include uri not readable: file:///root/path/to/file.adoc.

https://raw.com/main/file.adoc

https://raw.com/main

👌

👌

👌

https://raw.com/main/file.adoc

👌

👌

👌

file.adoc

https://raw.com/main

👌

❌ SecurityError: Jail is not an absolute path: https://raw.com/main

❌ include file not found: {local_pwd}/https:/raw.com/main/file.adoc.

../v1.5.0/file.adoc

https://raw.com/main

👌

❌ SecurityError: Jail is not an absolute path: https://raw.com/main

❌ include file not found: {local_pwd}/https:/raw.com/main/file.adoc.

https://raw.com/main/../v1.5.0/file.adoc

👌

❌ The xmlhttprequest module does not expand path and therefore returns a 404.

👌