Skip to content

Saved views

  • Marking - in a document a declaration's save places, a line <!-- folio view: REF --> - a byte order mark before it on the first line is no part of it - and a later line <!-- /folio view --> mark a region, and Folio writes there what REF names - a reference as an embed writes it: a data file or a part of it, a .sql file, or #name for a query of the document - as plain markdown between blank lines: a table, or a single value as text. On GitHub and in an editor the comment lines do not show and the result reads as ordinary markdown.
  • Kept current - the region is rewritten whenever the result changes, as an embed redraws, and only then. Nothing outside the marked regions ever changes, byte for byte, whatever the file's encoding; a region is written with the line ending of its start line. A result line that would read as a marker or open a code fence is written with a backslash before it, so it shows as it reads and stays inside its region. A result's line breaks, a carriage return alone included, are written as the region's line ending. The file is written whole under a new name, flushed to disk and renamed into place, so no reader sees half of it, keeping its mode and owner; a file with another hard link, or an owner Folio cannot give a new file, is written over in place, keeping its links, so a reader may briefly see it half written. Nothing is written through a link leading out of the served folder.
  • Edits - Folio writes a file only once it has settled - no other program holds it open to write it, which Folio can tell on Linux, and it has not changed for a second, unless Folio wrote it last; a file dated in the future counts as still - and reads it again just before writing, writing nothing when it changed meanwhile and working the views out again on the new text. A hand edit inside a region is replaced by the next write; the edited text stays among the document's versions, and health lists that a hand edit was replaced until the document next changes. Line endings alone never count as a hand edit.
  • Broken - a region whose result cannot be read is left as it was, and health lists why under Saved views not written as asked, as it lists a start line with no end line and a document Folio cannot write; the other documents are written as ever. A view whose query reads its own document and whose result changes with every write into it, while nothing else changes, is written three times, then left as it is and listed there too.
  • Where - what Folio last wrote is kept in its own state, never in the folder. A copy left beside a document by a Folio stopped while writing is removed when Folio starts again, and a write over a document in place that it cut short is finished then - unless the document changed since, when it is left as it is.