Awestruct:生成列出目录中所有文件的 html 页面

Awestruct: generate html page that lists all files in a directory

在我们的 Awestruct 网站中,我们有一个这样的目录:

/xsd
    /foo_1_0.xsd
    /foo_1_1.xsd
    /foo_1_2.xsd
    /foo_1_3.xsd
    ...
    /index.haml

index.haml 提供了一些有关如何使用 foo*.xsd 文件的信息。我希望 index.haml 也列出所有 xsd 文件,而不对它们进行硬编码。这可能吗?

试试这个,它会将所有目录内容列为一个数组:

 Dir.entries(".")
     #=> [".", "..", "file1", "file2"]

您可以将 . 更改为您的目录路径。