ionide / Fornax

Scriptable static site generator using type safe F# DSL to define page templates.
MIT License
244 stars 44 forks source link

Only capitalise the Module name instead of changing its case completely #111

Open MangelMaxime opened 2 years ago

MangelMaxime commented 2 years ago

Describe the bug

Right now when loading a generator/loader Fornax transform the name of the file using textInfo.ToTitleCase meaning that if the user write postLoader.fsx it will be transformed into Postloader for the open instruction.

From what I see, when using #load "postLoader.fsx" the name of the module generated by the F# compiler is PostLoader meaning that it only capitalise the name of the file.

Can we change

let internal getOpen (path : string) =
    let filename = Path.GetFileNameWithoutExtension path
    let textInfo = (CultureInfo("en-US", false)).TextInfo
    textInfo.ToTitleCase filename

to

let internal getOpen (path : string) =
    let filename = Path.GetFileNameWithoutExtension path
    let textInfo = (CultureInfo("en-US", false)).TextInfo
    string (textInfo.ToUpper filename[0]) + filename[1..]

// or this one as I am not sure if the CultureInfo is required
let internal getOpen (path : string) =
    let filename = Path.GetFileNameWithoutExtension path
    (string filename[0]).ToUpperInvariant() + filename[1..]

Doing this change would allow the user have better naming for its files.