Text, Large Text and the Default View
Large Text is arguably the most important Type in Querki, because it is the Type of the Default View Property.
The Default View
At the time, we brushed past the Default View. Now let's talk about it.
Remember our Archetype Model, and the Spy that we've created based on it? At this point, it looks like this:
That works -- it shows all the information we put into the Editor -- but it's not very pretty. The Default View is how you make Things display the way you want.
A "View" in Querki is a way of looking at a given Thing; the Default View is the one that's built-in, which you use all the time. There is also a Print View Property, which you should use if you want to print your Things differently from how they show up on-screen, and you can define other Views if you like, although that's pretty rare. Most of the time, Default View is how you say what these Things look like.
For example, let's go back to the Model Designer for Archetype, and define its Default View:
Now, when we look at our Spy Archetype, it looks like this:
What's going on here? Views, and indeed all Text and Large Text Properties, are basically templates: you usually define the Default View on the Model, and all of the Instances pick that up automatically. Large Text Properties like Default View are a mix of three elements:
- Ordinary text, which pretty much does what you expect.
- QL, which is the stuff in the double-square brackets ([[like this]]). Most QL names Properties, and means "put the value of this Property here", but there is a lot of power hiding in there.
- QText, which says how to format everything. For example, surrounding text with double asterisks (**like this**) means "boldface", and starting a line with ### means "this is a level-3 header".
So this line:
### Notes
Displays as:
Notes
And [[Notes]]
displays as "Has a briefcase full of incriminating documents", because that is the value of the Notes Property of Spy.
At this point, a lot of programmers are asking, "So it's just another templating language?". Pretty much, yes.
Large Text works very much like Rails, Razor or even PHP. The only real difference is that instead of using HTML to format pages, you usually use the more-concise QText markup language for the easy bits. And instead of using a general-purpose language like Ruby or C# or Java (or PHP), the expressions are defined in QL -- a programming language that has been designed from the ground up for this purpose.
You should find the concepts here pretty familiar, and I hope you find yourself agreeing that Querki makes the same ideas just plain easier. By focusing on the problem of template design first and foremost, and developing this pair of languages around that, Querki's templates come out a lot more concise and easier to read than any other system I know, while still providing deep power when you need it.
We'll talk more about QText and QL on the next two pages, and there are some big reference pages about them. But don't worry about it excessively: knowing just a little about each is enough to make reasonably pretty and useful Querki pages.
All of this is just as true of Text Properties (which, remember, are just a word or phrase) as it is of Large Text: they can contain whatever QL and QText you need them to. In general, though, you'll probably find that Text Properties should mostly contain ordinary text: they tend to define the values that you fill into a Large Text like Default View, which is where you put the formatting.
One more thing about Default View: while it mostly gets used for templates like this, it doesn't have to be. In fact, you will probably find that you want some pages in your Space that aren't really Instances of anything, they're just pages -- basically wiki pages. For example, remember the Who owns each game page back in our Game Night example:
That's just a Simple Thing, where the Default View is this slightly complex expression:
[[Game._instances ->
_sort ->
""**____**: [[Owners -> _commas]]"" ->
_bulleted]]
Don't worry too much about what that means right now -- we'll explain it soon -- the point is, if you just want a Plain Old Page, simply create an Instance of Simple Thing, and fill in the Default View.