In Boomla, files are selected. You can select one ore more files. This is in
contrast with a traditional OS, where files are opened. In Boomla, you don’t
need to open and close files, you just work with them.
(The same way you don’t need to open a <div>
in the DOM, you just select it.)
To select a single file, use its path.
Examples:
//example.com/foo/bar
/foo/bar
foo/bar
..
To find multiple files, you can use a path with wildcards. You can also throw in some selectors and filters.
Selectors perform a certain function on the context collection. Take, for
example, */first()
. *
is a filter for returning all the children of a given
file. first()
is a selector to keep only the first of those.
Filters are used to select 0 or more children of a file.
Note that only a single selector may be present between slashes (/
), but you
can use multiple filters.
Examples:
*/first()
foo/*:c:1/bar
name
Select a file by its name.
Examples: name
, a/b/c
.
*
Select a file by pattern matching its name.
Examples: ali*
, a/*
, a/*/*
.
:p
Only match files that are pages. A file is a page its type chain contains a file
named .Page
.
Examples: :p
, a/:p
, a/:p/:p
:c
Only match files that are contents. A file is a content if it implements the
.Inline
interface, that is, an .Inline
file exists on its type chain.
Examples: :c
, a/:c
, a/:c/:c
:1
Select all files in a given bucket.
Examples: /:1
, */:1
, foo/*:1
.
//example.com
Select the root file of any website. Must be at the beginning of a query string. Note that access control may prevent you from selecting remote websites.
Examples: //example.com
, //example.com/
, //example.com/foo
.
/
Select the root file of the context filesystem. Must be at the beginning of a query string.
Note that for imported filesystems, this means the root file of the imported filesystem, not the outer one.
Examples: /
, /a
.
..
Select a file’s parent at parse time.
Note that the ..
parent selector is resolved before
the query is evaluated, while the parent()
selector is resolved at evaluation
time. Thus, parent()/..
is not equivalent to ../parent()
.
foo/parent()/..
is simplified to foo
before it is evaluated.
foo/../parent()
is simplified to parent()
before it is evaluated.
Examples: ..
, ../../a
.
type()
Follow the file’s type reference.
Examples: type()
, a/type()/b
.
typeChain()
Return all the files along the file’s type chain, including self.
Examples: typeChain()
, a/typeChain()/b
.
root()
Selects the root file of the context. Note that for imported filesystems, this means the root file of the imported filesystem, not the outer one.
Example: root()
, typeChain()/last()/root()
.
Let’s dig into typeChain()/last()/root()
:
typeChain()
returns a collection of all files we encounter
when following the file’s type chain.last()
returns the last file of the collection, typically, an application
contained in a package that was installed (imported).root()
will return the root file of that imported package, for example
/sys/packages/example.com
.The latter example will return the root file of the imported filesystem
parent()
Select a file’s parent at evaluation time.
Note that the parent()
selector is resolved at evaluation time, not at
parse time. Thus, parent()/..
is not equivalent to ../parent()
.
foo/parent()/..
is simplified to foo
before it is evaluated.
foo/../parent()
is simplified to parent()
before it is evaluated.
Examples: parent()
, type()/parent()
.
first()
Returns the first file from the collection. May also be called on a file.
Examples: first()
, */first()
.
last()
Returns the last file from the collection. May also be called on a file
Examples: last()
, */last()
.