<commit_before>SILE.inputs.common = {
  init = function(fn, t)
    local dclass = t.attr.class or "plain"
    t.attr.papersize = t.attr.papersize or "a4"
    SILE.documentState.documentClass = SILE.require(dclass, "classes")
    for k,v in pairs(t.attr) do
      if SILE.documentState.documentClass.options[k] then
        SILE.documentState.documentClass.options[k](v)
      end
    end

    -- Prepend the dirname of the input file to the Lua search path
    local dirname = SILE.masterFilename:match("(.-)[^%/]+$")
    package.path = dirname.."?;"..dirname.."?.lua;"..package.path

    if not SILE.outputFilename and SILE.masterFilename then
      SILE.outputFilename = string.match(SILE.masterFilename,"(.+)%..-$")..".pdf"
    end
    local ff = SILE.documentState.documentClass:init()
    SILE.typesetter:init(ff)
  end
}

SILE.process = function(input)
  if type(input) == "function" then return input() end
  for i=1, #input do
    SILE.currentCommand = input[i]
    content = input[i]
    if type(content) == "string" then
      SILE.typesetter:typeset(content)
    elseif SILE.Commands[content.tag] then
      SILE.Commands[content.tag](content.attr,content)
    elseif content.id == "stuff" or (not content.tag and not content.id) then
      SILE.process(content)
    else
      SU.error("Unknown command "..(content.tag or content.id))
    end
  end
end

-- Just a simple one-level find. We're not reimplementing XPath here.
SILE.findInTree = function (t, tag)
  for i=1, #t do
    if type(t[i]) == "string" then
    elseif t[i].tag == tag then
      return t[i]
    end
  end
end<commit_msg>Cleanup variable names<commit_after>SILE.inputs.common = {
  init = function(doc, tree)
    local dclass = tree.attr.class or "plain"
    tree.attr.papersize = tree.attr.papersize or "a4"
    SILE.documentState.documentClass = SILE.require(dclass, "classes")
    for k,v in pairs(tree.attr) do
      if SILE.documentState.documentClass.options[k] then
        SILE.documentState.documentClass.options[k](v)
      end
    end

    -- Prepend the dirname of the input file to the Lua search path
    local dirname = SILE.masterFilename:match("(.-)[^%/]+$")
    package.path = dirname.."?;"..dirname.."?.lua;"..package.path

    if not SILE.outputFilename and SILE.masterFilename then
      SILE.outputFilename = string.match(SILE.masterFilename,"(.+)%..-$")..".pdf"
    end
    local ff = SILE.documentState.documentClass:init()
    SILE.typesetter:init(ff)
  end
}

SILE.process = function(input)
  if type(input) == "function" then return input() end
  for i=1, #input do
    SILE.currentCommand = input[i]
    content = input[i]
    if type(content) == "string" then
      SILE.typesetter:typeset(content)
    elseif SILE.Commands[content.tag] then
      SILE.Commands[content.tag](content.attr,content)
    elseif content.id == "stuff" or (not content.tag and not content.id) then
      SILE.process(content)
    else
      SU.error("Unknown command "..(content.tag or content.id))
    end
  end
end

-- Just a simple one-level find. We're not reimplementing XPath here.
SILE.findInTree = function (tree, tag)
  for i=1, #tree do
    if type(tree[i]) == "string" then
    elseif tree[i].tag == tag then
      return tree[i]
    end
  end
end
{'fraction_non_alphanumeric': 0.13555144793592114, 'fraction_numerical': 0.0018484288354898336, 'mean_word_length': 3.1257941550190598, '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': '2448611', 'n_tokens_mistral': 1104, 'n_tokens_neox': 1091, 'n_words': 271}