<commit_before>SILE.inputs.common = {
  init = function(fn, t)
    local dclass = t.attr.class or "plain"
    SILE.documentState.documentClass = SILE.require("classes/"..dclass)
    for k,v in pairs(t.attr) do
      if SILE.documentState.documentClass.options[k] then
        SILE.documentState.documentClass.options[k](v)
      end
    end
    SILE.outputFilename= string.gsub(fn,".sil$", ".pdf")
    local ff = SILE.documentState.documentClass:init()
    SILE.typesetter:init(ff)
  end
}

SILE.process = function(t)
  for k,v in ipairs(t) do
    if type(v) == "string" then
      SILE.typesetter:typeset(v)
    elseif SILE.Commands[v.tag] then
      SILE.Commands[v.tag](v.attr,v)
    else
      SU.error("Unknown command "..(v.tag or v.id))
    end
  end
end<commit_msg>This is a hack allowing us to call commands from other commands.<commit_after>SILE.inputs.common = {
  init = function(fn, t)
    local dclass = t.attr.class or "plain"
    SILE.documentState.documentClass = SILE.require("classes/"..dclass)
    for k,v in pairs(t.attr) do
      if SILE.documentState.documentClass.options[k] then
        SILE.documentState.documentClass.options[k](v)
      end
    end
    SILE.outputFilename= string.gsub(fn,".sil$", ".pdf")
    local ff = SILE.documentState.documentClass:init()
    SILE.typesetter:init(ff)
  end
}

SILE.process = function(t)
  if type(t) == "function" then return t() end
  for k,v in ipairs(t) do
    if type(v) == "string" then
      SILE.typesetter:typeset(v)
    elseif SILE.Commands[v.tag] then
      SILE.Commands[v.tag](v.attr,v)
    else
      SU.error("Unknown command "..(v.tag or v.id))
    end
  end
end
{'fraction_non_alphanumeric': 0.13686131386861314, 'fraction_numerical': 0.0, 'mean_word_length': 3.0818858560794045, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1512442', 'n_tokens_mistral': 596, 'n_tokens_neox': 595, 'n_words': 127}