Giter VIP home page Giter VIP logo

Comments (9)

tpetricek avatar tpetricek commented on July 20, 2024

The current templating mechanism is quite weak and cannot really do that. At the moment, the idea is that a template is just something (fairly static) that you can put around a single *.fsx or *.md file.

I also find this a bit limiting - I played with reimplementing Jekyll style templating (to have F# runner for fsfoundation - see here) and I wrote a more complex processing for FunScript (see here).

I do not think there is easy way to get what you suggest (I think there is no overload that returns the file as a string - this would make it easier). If you can submit a pull request that adds this (overloads returning a string & an API like your BuildHTML) that would be cool!

from fsharp.formatting.

colinbull avatar colinbull commented on July 20, 2024

I maybe way off here, but it feels like RazorEngine could be a solution to this problem. You could then do something like,

 <html>
        <body>
            <div id="main">
                 @Html.Raw(m => m.["main"])
             </div>
            <div id="left">
                  @Html.Raw(m => m.["left"])
             </div>
             .......
        <body>
 </html> 

So essentially you could parse and transform the *.fsx *.md files as you currently do, bind the resulting strings into a dictionary and then use the razor engine to actually handle the template side of things.

I meant to have ago at this a couple of weeks back but with a newborn my time is somewhat limited. I guess the other problem is cross-platform support, I have never tried to run razor engine on mono.

Cheers

Colin

from fsharp.formatting.

sergey-tihon avatar sergey-tihon commented on July 20, 2024

@colinbull, Thanks. Interesting idea.
It looks like RazorEngine works on Mono - see this.

from fsharp.formatting.

dungpa avatar dungpa commented on July 20, 2024

I think tilde project has done some work in combining FSharp.Formatting and RazorEngine. It would be nice to contribute and improve the project further.

from fsharp.formatting.

colinbull avatar colinbull commented on July 20, 2024

Tilde - is exactly what I was talking about.. :).

On Thu, Jul 11, 2013 at 8:26 AM, Anh-Dung Phan [email protected]:

I think tilde https://github.com/aktowns/tilde project has done some
work in combining FSharp.Formatting and RazorEngine. It would be nice to
contribute and improve the project further.


Reply to this email directly or view it on GitHubhttps://github.com//issues/18#issuecomment-20794623
.

from fsharp.formatting.

tpetricek avatar tpetricek commented on July 20, 2024

Yes, tilde looks very interesting (cc @aktowns)!

I did not have much time to play with it, but I certainly think that could be much better way to do more complex templating based on F# Formatting. (When I have a bit of time, I'll try to use it for my blog..)

from fsharp.formatting.

aktowns avatar aktowns commented on July 20, 2024

Wow, glad to see so much interest!
tilde is quite messy (a late night hack), i've attempted to copy jekyll's site folder structure (_posts etc) and templating as much as possible (within reason).
hoping to get more time to work on it (and learn more F#/.Net!), would love to know how you go with it

from fsharp.formatting.

7sharp9 avatar 7sharp9 commented on July 20, 2024

Mustache would also be a good fit here.

from fsharp.formatting.

tpetricek avatar tpetricek commented on July 20, 2024

For those interested in follow up, I'm using F# Formatting & RazorEngine (with some parts of Tilde) in the new version of my blog: https://github.com/tpetricek/TomaspNet.Website I think this is trying to do some of the things discussed here.

from fsharp.formatting.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.