stencilproject / Stencil

Stencil is a simple and powerful template language for Swift.
https://stencil.fuller.li
BSD 2-Clause "Simplified" License
2.34k stars 223 forks source link

Documentation out of date #115

Closed KingOfBrian closed 7 years ago

KingOfBrian commented 7 years ago

Just learning stencil, and I noticed that a lot of the docs are out of date. I don't know the language very well, so I'm not the best to audit it, but I ran into these two issues:

http://stencil.fuller.li/en/latest/builtins.html

kylef commented 7 years ago

Can I just confirm which version of Stencil you are running @KingOfBrian ?

KingOfBrian commented 7 years ago

Ah sorry about that, good catch -- 0.8. Looks like 0.9 adds the elif support. No note on forloop.last though. Close if out if it reflects 0.9 properly.

bladebunny commented 7 years ago

The documentation also shows creating paths and extensions via string arrays, but it seems those have been replaced by "Path" and "Extension" types. Very confusing. I'm sure I'll sort it out but pretty frustrating. Especially as "Path" is not even a type from Stencil but rather seems to come from "PathKit". Not sure I understand the decision to not use Foundation types for file system objects. Was this for cross platform compatibility? Anyway, the library seems to have a lot of potential so I am forging on.

kylef commented 7 years ago

@bladebunny Path is string convertible so you can provide strings directly where Path is allowed, which is what the documentation does. You may need to import PathKit.

Was this for cross platform compatibility?

Yes, and to encapsulate the file reading/writing. When this was written Open Foundation was rather incomplete and raised fatalErrors because features were missing.

decision to not use Foundation types for file system objects

You may also use Foundation types if you desire, you can pass in a URL from foundation.

Sources/Template.swift:  public convenience init(URL:Foundation.URL) throws {