MishkaDocument.Resources.Changes.ContentFacts (Mishka Document v0.0.1)

Copy Markdown View Source

The components, the icons and the classes a page's or a note's content names, worked out when it is written — reading either works out nothing:

Worked out in a before_action hook, which runs after every change an action lists — the guardedstruct sanitizer and MishkaDocument.Resources.Changes.HighlightCode included — so they are read off the content that is stored. Every write works them out again from the content it stores, whether or not it changed it, so a row never names what its content does not.

The stylesheet

A write that makes a name, an icon or a class live on its site — an approved page or note names it now and did not before, and no other approved page or note of the site names it — rebuilds the site's stylesheet, through MishkaCmsCore.Runtime.Compilers.TailwindCompiler.schedule/1. The job is enqueued in the write's own transaction, so a write rolled back asks for nothing. A name, an icon or a class dropped, or a page sent back to review, rebuilds nothing.

Usage

update :update do
  change MishkaDocument.Resources.Changes.HighlightCode
  change MishkaDocument.Resources.Changes.ContentFacts
end

Summary

Functions

What record makes live of fact that was did not — its component names (:content_components, the default), its icons (:content_icons) or its classes (:content_classes): what an approved page or note lists, less what it listed while approved before the write.

Functions

newly_live(was, record, fact \\ :content_components)

@spec newly_live(
  map(),
  map(),
  :content_components | :content_icons | :content_classes
) :: [String.t()]

What record makes live of fact that was did not — its component names (:content_components, the default), its icons (:content_icons) or its classes (:content_classes): what an approved page or note lists, less what it listed while approved before the write.