无编辑摘要
无编辑摘要
标签已被回退
第80行: 第80行:
end  
end  


-- 格式化单个值的私有函数 (不包含难度样式)
-- 格式化单个值的私有函数 (基础格式化,不应用BPM或难度样式)
local function formatSingleValue(value, fieldType)
local function formatSingleValue(value, fieldType)
     if value == nil then
     if value == nil then
第89行: 第89行:
         return p.valueMappingMethod[fieldType](value)
         return p.valueMappingMethod[fieldType](value)
     else
     else
         local strValue = tostring(value)
         return tostring(value)
       
        -- BPM 颜色逻辑
        if fieldType == 'bpm' and string.find(strValue, '-') then
            return '<span style="color:red;">' .. strValue .. '</span>'
        end
       
        return strValue
     end
     end
end  
end  
-- 仅在表格中应用的BPM样式
local function formatBPMValue(rawValue)
    local strValue = tostring(rawValue)
    if string.find(strValue, '-') then
        return '<span style="color:red;">' .. strValue .. '</span>'
    end
    return rawValue
end


-- 获取难度模式 (使用哈希表检查,使用 sub 提取模式)
-- 获取难度模式 (使用哈希表检查,使用 sub 提取模式)
第213行: 第216行:
         local value = ValueFromValuesByKey(songEntry, argType)
         local value = ValueFromValuesByKey(songEntry, argType)
          
          
         -- FIX: p.value 中只进行基本的格式化,不应用难度样式
         -- p.value 中,只进行基础格式化,不应用任何颜色或加粗样式
         local formattedValue = formatSingleValue(value, argType)  
         local formattedValue = formatSingleValue(value, argType)  
          
          
第219行: 第222行:
     end
     end
      
      
return table.concat(resultTable, ' / ')
    -- FIX: 使用 &nbsp;/&nbsp; 代替 / 来防止非数字值导致自动换行
return table.concat(resultTable, '&nbsp;/&nbsp;')
end
end


第318行: 第322行:
     for _, songId in ipairs(matchingKeys) do
     for _, songId in ipairs(matchingKeys) do
         local songEntry = songData[songId]
         local songEntry = songData[songId]
         table.insert(output, '|-')
         table.insert(output, '\n|-') -- 确保新行开始
          
          
         local rowCells = {}
         local rowCells = {}
第328行: 第332行:
             local formattedValue = formatSingleValue(rawValue, field)
             local formattedValue = formatSingleValue(rawValue, field)
              
              
             -- 在 p.generateListTable 中应用自定义样式
             -- **应用 BPM 样式** (仅在表格中)
            if field == 'bpm' then
                formattedValue = formatBPMValue(formattedValue)
            end
 
            -- **应用难度样式** (仅在表格中)
             local btn, mode = getDifficultyDetails(field)
             local btn, mode = getDifficultyDetails(field)
             if btn and mode then
             if btn and mode then
第346行: 第355行:
     end
     end
      
      
     table.insert(output, '|}')
     table.insert(output, '\n|}')
      
      
     return table.concat(output, '\n')
     return table.concat(output, '')
end
end


return p
return p