[Spark View Engine] #57: Import directive

16 views
Skip to first unread message

Spark View Engine

unread,
Sep 10, 2008, 1:41:11 AM9/10/08
to spar...@googlegroups.com
#57: Import directive
---------------------------+------------------------------------------------
Reporter: louis.dejardin | Owner:
Type: enhancement | Status: new
Priority: major | Component: Spark Core
Keywords: |
---------------------------+------------------------------------------------
Make an <use import=""> or <import file=""> directive, and maybe an
<imports><add import=""></imports> configuration entry.

Only class-level elements <global> <macro> <viewdata> <use namespace> <use
assembly> <use import> would have any meaning at the root level of an
imported file. Anything else that happens to be in there won't be output
because the file's never actually in the execution path.

Also have a particular file name that's treated as an import by
convention. Maybe look for _import.spark file in the controller folder,
and in the shared folder, in order to declare things like macros and
globals across the board.

--
Ticket URL: <http://dev.dejardin.org/trac/spark/ticket/57>
Spark View Engine <http://dev.dejardin.org/trac/spark>
Spark View Engine

Torkel Ödegaard

unread,
Sep 10, 2008, 2:30:10 AM9/10/08
to spar...@googlegroups.com
That is a great idea.

Brian J. Cardiff

unread,
Sep 10, 2008, 9:05:41 AM9/10/08
to spar...@googlegroups.com
I would like support for xinclude, since should be standard way to import xml one inside another.
Again, I use to think a templates as valid xml.

http://www.xml.com/pub/a/2002/07/31/xinclude.html
--
Brian J. Cardiff
bcardiff(?)gmail.com
.

Louis DeJardin

unread,
Sep 10, 2008, 5:32:01 PM9/10/08
to Spark View Engine Dev
Actually, as of last night the templates can be valid xml. Thanks
again for the input. :)

xinclude seems like a fairly straightforward specification - I think
it should be possible to implement <include href=""> and <fallback>.
At least for relative href values. Not sure if xpointer would be
practical. The parse="text" attribute might be pretty useful.

I think the usage between import and include might be a little
different though both would be useful. It sounds like xinclude
specification brings the target contents into being at the location of
the include, while the import would bring in the declarations of a
global nature (member properties, functions, using namespaces) but any
of the contents.

Trying to think of a good example... Like it should be safe to import
a file multiple times and from different places (e.g. putting the same
import into a few different partials) where an include would cause a
problem with duplicate declarations.



On Sep 10, 2:05 pm, "Brian J. Cardiff" <bcard...@gmail.com> wrote:
> I would like support for xinclude, since should be standard way to import
> xml one inside another.
> Again, I use to think a templates as valid xml.
>
> http://www.xml.com/pub/a/2002/07/31/xinclude.html
>
> On Wed, Sep 10, 2008 at 3:30 AM, Torkel Ödegaard
> <torkel.odega...@gmail.com>wrote:

Brian J. Cardiff

unread,
Sep 10, 2008, 8:53:42 PM9/10/08
to spar...@googlegroups.com
I agree import vs include are different. I think XIncludes should enough to split nicely spark templates.

I won't expect special semantic for macros and are stuff be applied in the processing of XIncludes.
Neither I expect to reach C language #ifndef code style.
Since sometimes you would expect to macros have local scope in the included file and in other case global scope I think is good to have some import statement with the right semantics (that would be safety to appear more than once).

Spark View Engine

unread,
Sep 11, 2008, 12:37:26 AM9/11/08
to spar...@googlegroups.com
#57: Import directive
-----------------------------+----------------------------------------------
Reporter: louis.dejardin | Owner:
Type: enhancement | Status: closed
Priority: major | Component: Spark Core
Resolution: fixed | Keywords:
-----------------------------+----------------------------------------------
Changes (by louis.dejardin):

* status: new => closed
* resolution: => fixed

Comment:

Implemented with <use import="filename">
See http://dev.dejardin.org/documentation/organizingcontent#Importingfiles

and <include href="filename.spark" parse="xml|text"><fallback>
See http://dev.dejardin.org/documentation/organizingcontent#Includingfiles

--
Ticket URL: <http://dev.dejardin.org/trac/spark/ticket/57#comment:1>
Reply all
Reply to author
Forward
0 new messages