<commit_before>local mod = EPGP:NewModule("EPGP_Standings", "AceDB-2.0", "AceEvent-2.0")

mod:RegisterDB("EPGP_Standings_DB")
mod:RegisterDefaults("profile", {
  data = { },
  detached_data = { },
  group_by_class = false,
  show_alts = false,
  raid_mode = true
})

local T = AceLibrary("Tablet-2.0")
local D = AceLibrary("Dewdrop-2.0")
local C = AceLibrary("Crayon-2.0")

local BC = AceLibrary("Babble-Class-2.2")

local function RaidIterator(obj, i)
  local name = GetRaidRosterInfo(i)
  if not name then return end
  return i+1, name
end

local function GuildIterator(obj, i)
  local name
  repeat
    name = GetGuildRosterInfo(i)
    -- Handle dummies
    if obj.cache:IsDummy(name) then
		  name = obj.cache.db.profile.dummies[name]
		end
    i = i+1
  until obj.db.profile.show_alts or not obj.cache:IsAlt(name)
  if not name then return end
  return i, name
end

function mod:GetStandingsIterator()
  if (self.db.profile.raid_mode and UnitInRaid("player")) then
    return RaidIterator, self, 1
  else
    return GuildIterator, self, 1
  end
end

function mod:OnInitialize()
  self.cache = EPGP:GetModule("EPGP_Cache")
  StaticPopupDialogs["EPGP_Standings_HTML"] = {
    text = "HTML table of the current EPGP standings.",
    hasEditBox = 1,
    OnShow = function()
      local text = "<table>"..
      "<caption>EPGP Standings</caption>"..
      "<tr><th>Name</th><th>Class</th><th>EP</th><th>GP</th><th>PR</th></tr>"
      for k,v in pairs(self.standings) do
        local name, class, ep, gp, pr = unpack(v)
        text = text..string.format(
          "<tr><td>%s</td><td><spam style=\"color:#%s\">%s</td><td>%d</td><td>%d</td><td>%.4g</td></tr>",
          name, BC:GetHexColor(class), class, ep, gp, pr)
      end
      text = text.."</table>"
      local editBox = getglobal(this:GetName().."EditBox")
      editBox:SetText(text)
      editBox:HighlightText()
      editBox:SetFocus()
    end,<commit_msg>Fix issue 59. Now the table has id="epgp-standings" and each tr tag has a specified class="wow-class" for use with CSS to style the epgp standings.<commit_after>local mod = EPGP:NewModule("EPGP_Standings", "AceDB-2.0", "AceEvent-2.0")

mod:RegisterDB("EPGP_Standings_DB")
mod:RegisterDefaults("profile", {
  data = { },
  detached_data = { },
  group_by_class = false,
  show_alts = false,
  raid_mode = true
})

local T = AceLibrary("Tablet-2.0")
local D = AceLibrary("Dewdrop-2.0")
local C = AceLibrary("Crayon-2.0")

local BC = AceLibrary("Babble-Class-2.2")

local function RaidIterator(obj, i)
  local name = GetRaidRosterInfo(i)
  if not name then return end
  return i+1, name
end

local function GuildIterator(obj, i)
  local name
  repeat
    name = GetGuildRosterInfo(i)
    -- Handle dummies
    if obj.cache:IsDummy(name) then
		  name = obj.cache.db.profile.dummies[name]
		end
    i = i+1
  until obj.db.profile.show_alts or not obj.cache:IsAlt(name)
  if not name then return end
  return i, name
end

function mod:GetStandingsIterator()
  if (self.db.profile.raid_mode and UnitInRaid("player")) then
    return RaidIterator, self, 1
  else
    return GuildIterator, self, 1
  end
end

function mod:OnInitialize()
  self.cache = EPGP:GetModule("EPGP_Cache")
  StaticPopupDialogs["EPGP_Standings_HTML"] = {
    text = "HTML table of the current EPGP standings.",
    hasEditBox = 1,
    OnShow = function()
      local text = "<table id=\"epgp-standings\">"..
      "<caption>EPGP Standings</caption>"..
      "<tr><th>Name</th><th>Class</th><th>EP</th><th>GP</th><th>PR</th></tr>"
      for k,v in pairs(self.standings) do
        local name, class, ep, gp, pr = unpack(v)
        text = text..string.format(
          "<tr><td class=\"%s\">%s</td><td class=\"%s\">%s</td><td>%d</td><td>%d</td><td>%.4g</td></tr>",
          class, name, class, class, ep, gp, pr)
      end
      text = text.."</table>"
      local editBox = getglobal(this:GetName().."EditBox")
      editBox:SetText(text)
      editBox:HighlightText()
      editBox:SetFocus()
    end,
{'fraction_non_alphanumeric': 0.15585066399398648, 'fraction_numerical': 0.00952142320220496, 'mean_word_length': 3.500563697857948, 'pattern_counts': {'":': 0, '<': 60, '<?xml version=': 0, '>': 60, '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': '6458294', 'n_tokens_mistral': 1487, 'n_tokens_neox': 1468, 'n_words': 328}