site.fabricate.prototype.write Namespace


Fabricate's namespace for writing HTML pages. This file combines fabricate's other namespaces for reading source files, parsing & restructuring their contents, and generating HTML pages with additional functions for input and output in order to achieve the purpose of the library: create HTML documents.

The central method that it uses to combine these functions from other namespaces is a finite-state-machine.


Functions


rerender
Description
Render the given page on file change. Returns the completed page map.
Arguments
  • [{:keys [site.fabricate/settings site.fabricate/pages], :as application-state-map} {:keys [file count action]}]
draft!
Description
Render all the Fabricate templates once, then launches a file watcher to rerender the templates on save. Also launches a web server to view the rendered pages locally.
Arguments
  • [{:keys [site.fabricate/settings site.fabricate/pages], :as application-state-map}]
eval-parsed-page
Description
Evaluate the given page after parsing.
Arguments
  • [{:keys [site.fabricate.page/parsed-content site.fabricate.page/namespace], :as page-data} site-opts]
populate-page-meta
Description
Get the metadata for the given page.
Arguments
  • [{:keys [site.fabricate.page/namespace site.fabricate.page/parsed-content site.fabricate.file/output-file site.fabricate.file/filename site.fabricate.file/input-file], :as page-data} {:keys [site.fabricate.file/input-dir site.fabricate.file/output-dir], :as site-settings}]
publish!
Description
Render all the fabricate templates.
Arguments
  • [{:keys [files dirs], :as opts}]
parse-contents
Description
Parses the contents of the given template map.
Arguments
  • [{:keys [site.fabricate.page/unparsed-content site.fabricate.file/filename], :as page-data} {:keys [site.fabricate/settings]}]
stop!
Description
Shuts down fabricate's stateful components.
Arguments
  • [application-state-map]
valid-state?
Description
Arguments
    evaluated->hiccup
    Description
    Takes the evaluated contents and turns them into a well-formed hiccup data structure.
    Arguments
    • [{:keys [site.fabricate.page/namespace site.fabricate.page/metadata site.fabricate.page/evaluated-content], :as page-data} {:keys [site.fabricate/settings], :as state}]
    get-output-filename
    Description
    Creates the output filename for the given input
    Arguments
    • [path in-dir out-dir]
    explain-state
    Description
    Arguments
      get-template-files
      Description
      Get the Fabricate input template files in the given directory
      Arguments
      • [dir suffix]


      Constants


      initial-state
      Description
      Starting state for Fabricate's application components.
      Type
      clojure.lang.PersistentArrayMap
      rendered-state
      Description
      Fabricate input rendered to output string
      Type
      :malli.core/schema
      file-state
      Description
      Fabricate input represented as java.io.File entry in page map
      Type
      :malli.core/schema
      parsed-state
      Description
      Fabricate input parsed and metadata associated with page map
      Type
      :malli.core/schema
      page-metadata-schema
      Description
      Schema describing the keys and values used by Fabricate to store metadata about pages.
      Type
      :malli.core/schema
      input-state
      Description
      Starting state for Fabricate templates: path as a string.
      Type
      :malli.core/schema
      html-state
      Description
      Fabricate input evaluated as hiccup vector
      Type
      :malli.core/schema
      evaluated-state
      Description
      Fabricate contents evaluated after parsing
      Type
      :malli.core/schema
      state-schema
      Description
      Schema for the agent containing the state of fabricate.
      Type
      :malli.core/schema
      markdown-state
      Description
      Fabricate markdown input evaluated as markdown string
      Type
      :malli.core/schema
      default-operations
      Description
      Default render loop for Fabricate projects. Defined as a mapping of malli schemas describing states to the functions that process data in that state. See the fsm namespace for additional information.
      Type
      clojure.lang.PersistentArrayMap
      state
      Description
      This agent holds the current state of all the pages created by Fabricate, the application settings, and the state of the application itself
      Type
      clojure.lang.Agent
      default-site-settings
      Description
      Default configuration for Fabricate projects.
      Type
      clojure.lang.PersistentArrayMap
      read-state
      Description
      Fabricate input read in as string
      Type
      :malli.core/schema