The scripts and inline event handlers a post's or a page's content holds, for the targets that
write the content (MishkaCmsMigration.Targets.CmsPage, MishkaCmsMigration.Targets.BlogPost):
each <script> element and each on… attribute (onclick, onerror, ...), whatever the source
and the editor that made the content.
Such an item is never written on its own: it waits for an admin's decision
(MishkaCmsMigration.MigrationItem's Decide…) on "scripts", its reason naming them after ": "
in the order the content has them, a handler with its element, as in
"scripts: onclick on a, script", in the dry run (the target's waiting/2, waiting/2 here) and
in prepare/3 for any write (call/2). Remove them ("import") writes the content without them
(removed/3), and Keep them, I trust this content ("trust"), writes it as it is; the report
says which (note/2: "scripts_removed: <found>", "scripts_kept: <found>"). Keep them is not
a choice the Items table's Keep the site as it is makes for picked rows: trusting a script is
decided item by item.
Summary
Functions
:ok for item to be written: its content holds no script, or an admin decided to remove them
or to keep them; else {:undecided, conflict}.
The conflict item waits on: "scripts: <found>" for content that holds a script or an inline
event handler, else nil.
What the report says of item's scripts once it is written: "scripts_removed: <found>" or
"scripts_kept: <found>", as an admin decided, else nil.
html, the content of item, without its scripts and inline event handlers once an admin
decided to remove them; as it is otherwise.
What the target's waiting/2 says of item: {:undecided, conflict} until an admin decides,
then nil, to be written, as for content with no script.
Functions
@spec call(MishkaCmsMigration.Source.Item.t(), MishkaCmsMigration.Target.context()) :: :ok | {:undecided, String.t()}
:ok for item to be written: its content holds no script, or an admin decided to remove them
or to keep them; else {:undecided, conflict}.
@spec conflict(MishkaCmsMigration.Source.Item.t()) :: String.t() | nil
The conflict item waits on: "scripts: <found>" for content that holds a script or an inline
event handler, else nil.
@spec note(MishkaCmsMigration.Source.Item.t(), MishkaCmsMigration.Target.context()) :: String.t() | nil
What the report says of item's scripts once it is written: "scripts_removed: <found>" or
"scripts_kept: <found>", as an admin decided, else nil.
@spec removed( String.t(), MishkaCmsMigration.Source.Item.t(), MishkaCmsMigration.Target.context() ) :: String.t()
html, the content of item, without its scripts and inline event handlers once an admin
decided to remove them; as it is otherwise.
@spec waiting(MishkaCmsMigration.Source.Item.t(), MishkaCmsMigration.Target.context()) :: MishkaCmsMigration.Target.found() | nil
What the target's waiting/2 says of item: {:undecided, conflict} until an admin decides,
then nil, to be written, as for content with no script.