Модуль:GeneratePlayerPages: відмінності між версіями

1032 байти вилучено ,  У понеділок о 15:37
нема опису редагування
Немає опису редагування
Немає опису редагування
Рядок 344: Рядок 344:
              
              
             if #player_facts > 0 then
             if #player_facts > 0 then
                -- ЗМІНА ТУТ: Заголовки генеруються як === Заголовок ===
                 table.insert(result_parts, string.format("==== %s ====", page_title))
                 table.insert(result_parts, string.format("=== %s ===", page_title))
                 for _, fact in ipairs(player_facts) do
                 for _, fact in ipairs(player_facts) do
                     table.insert(result_parts, fact)
                     table.insert(result_parts, fact)
Рядок 432: Рядок 431:
         local raw = mw.text.trim(player_info[4])
         local raw = mw.text.trim(player_info[4])
         if raw ~= "Відсутній" and raw ~= "-" and raw ~= "" then
         if raw ~= "Відсутній" and raw ~= "-" and raw ~= "" then
             recruiter = raw -- Залишаємо [[Демон]] як є
             recruiter = raw
         end
         end
     end
     end
Рядок 445: Рядок 444:
     local output = {}
     local output = {}
      
      
    -- Шаблон
     table.insert(output, "{{MCC Player New")
     table.insert(output, "{{MCC Player New")
     table.insert(output, "| nickname = " .. player_name)
     table.insert(output, "| nickname = " .. player_name)
      
      
    -- ВИПРАВЛЕНО: Правильна структура таблиці Статистика
    -- Колонки: № | Пан/Пані | Ігри | Виграші | Поразки | %
     if stats and #stats >= 6 then
     if stats and #stats >= 6 then
         local games = stats[3] or "0"
         local games = stats[3] or "0"
Рядок 457: Рядок 453:
         local winrate = stats[6] or "0"
         local winrate = stats[6] or "0"
          
          
        -- Видаляємо % з winrate
         winrate = mw.ustring.gsub(winrate, "%%", "")
         winrate = mw.ustring.gsub(winrate, "%%", "")
         winrate = mw.text.trim(winrate)
         winrate = mw.text.trim(winrate)
Рядок 476: Рядок 471:
     table.insert(output, "| date_added = " .. date_added)
     table.insert(output, "| date_added = " .. date_added)
      
      
    -- Foundation (колонка 3 в таблиці Фундація: № | Пан/Пані | Сума)
     if foundation and #foundation >= 3 then
     if foundation and #foundation >= 3 then
         local found = mw.ustring.gsub(foundation[3] or "0", "[^%d]", "")
         local found = mw.ustring.gsub(foundation[3] or "0", "[^%d]", "")
Рядок 484: Рядок 478:
     end
     end
      
      
    -- Prize pool (колонка 2 в таблиці Призовий_фонд: № | Сума)
     if prize_pool and #prize_pool >= 2 then
     if prize_pool and #prize_pool >= 2 then
         local prize = mw.ustring.gsub(prize_pool[2] or "0", "[^%d]", "")
         local prize = mw.ustring.gsub(prize_pool[2] or "0", "[^%d]", "")
Рядок 492: Рядок 485:
     end
     end
      
      
    -- Finalist (колонка 3 в таблиці Фіналіст: № | Пан/Пані | К-сть)
     if finalist and #finalist >= 3 then
     if finalist and #finalist >= 3 then
         local fin = mw.ustring.gsub(finalist[3] or "0", "[^%d]", "")
         local fin = mw.ustring.gsub(finalist[3] or "0", "[^%d]", "")
Рядок 504: Рядок 496:
     table.insert(output, "''[Тут додай опис гравця]''")
     table.insert(output, "''[Тут додай опис гравця]''")
     table.insert(output, "")
     table.insert(output, "")
   
    -- Сезони
     table.insert(output, "== Сезони ==")
     table.insert(output, "== Сезони ==")
     table.insert(output, "{{#invoke:FetchData|season_achievements|player=" .. player_name .. "}}")
     table.insert(output, "{{#invoke:FetchData|season_achievements|player=" .. player_name .. "}}")
     table.insert(output, "")
     table.insert(output, "")
   
    -- Титули
     table.insert(output, "== Нагороди в MCC ==")
     table.insert(output, "== Нагороди в MCC ==")
     table.insert(output, titles_code)
     table.insert(output, titles_code)
     table.insert(output, "")
     table.insert(output, "")
   
    -- Записи ігор
     table.insert(output, "== Записи ігор ({{#invoke:FetchData|games_count_records|player=" .. player_name .. "}}) ==")
     table.insert(output, "== Записи ігор ({{#invoke:FetchData|games_count_records|player=" .. player_name .. "}}) ==")
     table.insert(output, "{{#invoke:FetchData|player_games|player=" .. player_name .. "}}")
     table.insert(output, "{{#invoke:FetchData|player_games|player=" .. player_name .. "}}")
     table.insert(output, "")
     table.insert(output, "")
   
    -- Цікаві факти
     table.insert(output, "== Цікаві факти ==")
     table.insert(output, "== Цікаві факти ==")
     table.insert(output, facts_code)
     table.insert(output, facts_code)
      
      
     -- ЗМІНА ТУТ: Видаляємо обгортку <pre>
     -- ВИПРАВЛЕННЯ: Виводимо як syntaxhighlight
     return table.concat(output, "\n")
     local final_code = table.concat(output, "\n")
   
    return frame:extensionTag{
        name = 'syntaxhighlight',
        args = {lang = 'text'},
        content = final_code
    }
end
end


Рядок 547: Рядок 537:
          
          
         table.insert(output, string.format("=== %d. %s ===", i, player_name))
         table.insert(output, string.format("=== %d. %s ===", i, player_name))
        -- Оскільки generate_single_player тепер повертає чистий вікітекст,
        -- нам потрібно обгорнути його в <pre> лише для цієї функції,
        -- щоб розділити вивід для багатьох гравців.
         local player_code = p.generate_single_player({args = {player = player_name}})
         local player_code = p.generate_single_player({args = {player = player_name}})
         table.insert(output, "<pre>" .. player_code .. "</pre>")
         table.insert(output, player_code)
         table.insert(output, "\n----\n")
         table.insert(output, "\n----\n")
     end
     end