cognifloyd / Cognifire.Filefish

This used to be called "BuilderFoundation". A generic file editing framework designed to allow semantic file editing especially within "packages". The basic process is: Stuff gets copied from a boilerplate package into a derivative package. In the process, the files in the derivative package may be modified through this semantic editing framework.
cognifloyd.blogspot.com
0 stars 0 forks source link

Add a way to edit fluid files #1

Open cognifloyd opened 10 years ago

cognifloyd commented 10 years ago

I want to make editing/creating TYPO3.Fluid files scriptable in a semantic fashion. I do not want line based editing. It's got to be able to insert elements (html, fluid, etc) at particular positions without mangling the syntax/semantics and spacing of the file.

This is my design for the "script" on the backend:

Once I've got this down, then I'll extend my app to edit other filetypes, including php, typoscript, stylesheets (css, sass, less, etc), javascript, yaml, and whatever else people might want to edit. All they have to do is add a library that understands the semantics of the filetype and provides a fluent interface (or at least uses method chaining) for searching/editing the file in a jquery-like manner. It'll use the same DSL (FlowQuery in Eel in YAML). Hopefully, I'll be able to jump from editing one kind of document to editing another, as different documenttypes are embedded in each other (eg SVG, MathML, CSS, and JavaScript are all easily embedded in HTML)

cognifloyd commented 10 years ago

I'd like to make my approach generic enough (repeatable) so that I can reuse as much as possible and allow editing Twig and Twital templates as well. Twital uses namespaced attributes on regular html tags. Twig uses something like Fluid's inline syntax with curly braces.

I wonder how I'm going to detect and edit the curly brace syntax in Fluid, Twig and Twital?

cognifloyd commented 10 years ago

If masterminds/html5 doesn't include some kind of explicit namespace support we can (as suggested by @goetas) post-process the DOMDocument to add the namespaces like Twital does.

cognifloyd commented 10 years ago

https://github.com/cognifloyd/Cognifire.BuilderFoundation/issues/18#issuecomment-21960059

This is the original issue where I decided to use QueryPath.