Class: Slidict::Output::Format

Inherits:
Object
  • Object
show all
Defined in:
lib/slidict/output/format.rb

Overview

Single source of truth for everything that varies per output framework: the output file extension, the body_format sent to the slidict.io API, and (for markdown-based frameworks) the frontmatter block to render. Add a new framework by adding one entry to REGISTRY.

Defined Under Namespace

Classes: Definition

Constant Summary collapse

DEFAULT_NAME =
"slidev"
REGISTRY =
{
  "slidev" => Definition.new(
    name: "slidev",
    extension: ".md",
    body_format: "markdown",
    frontmatter: "theme: default\nclass: text-center"
  ),
  "marp" => Definition.new(
    name: "marp",
    extension: ".md",
    body_format: "markdown",
    frontmatter: "marp: true\ntheme: default"
  ),
  "asciidoctor-revealjs" => Definition.new(
    name: "asciidoctor-revealjs",
    extension: ".adoc",
    body_format: "asciidoc",
    frontmatter: nil
  )
}.freeze

Class Method Summary collapse

Class Method Details

.fetch(name) ⇒ Object



35
36
37
# File 'lib/slidict/output/format.rb', line 35

def self.fetch(name)
  REGISTRY.fetch(name.to_s.downcase, REGISTRY.fetch(DEFAULT_NAME))
end

.namesObject



39
40
41
# File 'lib/slidict/output/format.rb', line 39

def self.names
  REGISTRY.keys
end