<commit_before>--- Handle Markdown generation

require 'logging.console'
local logger = logging.console()
logger:setLevel(logging.DEBUG)

local textx = require 'pl.text'

class.MarkdownWriter()

--[[ Constructor for MarkdownWriter

Args:
 * `outputPath` - string; path to write to
 * `packageName` - string; name of package being documented

Returns: new MarkdownWriter object
--]]
function MarkdownWriter:_init(outputPath, packageName)
    self.outputFile = io.open(outputPath, 'w')
    self.packageName = packageName
    lapp.assert(self.outputFile, "could not open output file " .. outputPath)
    self:writeHeader()
end

--[[ Append a string to the output

Args:
 * `text` :: string; text to append

Returns: nil
--]]
function MarkdownWriter:write(text)
    self.outputFile:write(text)
end

--[[ Add the package header to the output ]]
function MarkdownWriter:writeHeader()
    self:heading(3, "Module " .. self.packageName)
end

--[[ Add a heading to the output

Args:
 * `text` :: string; the heading text
 * `level` :: int; level of the heading (lower means bigger)

Returns: nil
--]]
function MarkdownWriter:heading(level, text)
    self:write(string.rep("#", level) .. " ".. text .. "\n\n")
end

--[[ Add markdown for a documented function

Args:
 * `entity` :: DocumentedFunction object

Returns: nil
--]]
function MarkdownWriter:documentEntity(entity)
    logger:debug("Outputting markdown for " .. entity:name())

    local valueTable = {
        name = entity:name() or "{missing name}",
        doc = entity:doc() or "{missing docs}",
    }<commit_msg>Remove packageName logic from markdown writer<commit_after>--- Handle Markdown generation

require 'logging.console'
local logger = logging.console()
logger:setLevel(logging.DEBUG)

local textx = require 'pl.text'

class.MarkdownWriter()

--[[ Constructor for MarkdownWriter

Args:
 * `outputPath` - string; path to write to

Returns: new MarkdownWriter object
--]]
function MarkdownWriter:_init(outputPath)
    self.outputFile = io.open(outputPath, 'w')
    lapp.assert(self.outputFile, "could not open output file " .. outputPath)
end

--[[ Append a string to the output

Args:
 * `text` :: string; text to append

Returns: nil
--]]
function MarkdownWriter:write(text)
    self.outputFile:write(text)
end

--[[ Add a heading to the output

Args:
 * `text` :: string; the heading text
 * `level` :: int; level of the heading (lower means bigger)

Returns: nil
--]]
function MarkdownWriter:heading(level, text)
    self:write(string.rep("#", level) .. " ".. text .. "\n\n")
end

--[[ Add markdown for a documented function

Args:
 * `entity` :: DocumentedFunction object

Returns: nil
--]]
function MarkdownWriter:documentEntity(entity)
    logger:debug("Outputting markdown for " .. entity:name())

    local valueTable = {
        name = entity:name() or "{missing name}",
        doc = entity:doc() or "{missing docs}",
    }
{'fraction_non_alphanumeric': 0.13510711817553558, 'fraction_numerical': 0.0003455425017277125, 'mean_word_length': 3.9742268041237114, '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': '1832718', 'n_tokens_mistral': 870, 'n_tokens_neox': 866, 'n_words': 271}