无编辑摘要
无编辑摘要
第62行: 第62行:
     end
     end
     return valueString
     return valueString
end
-- **新增:格式化 key 值 (仅在表格中使用)**
local function formatKeyValue(value)
    if type(value) == 'boolean' then
        local color = value and 'green' or 'red'
        local text = value and i18n['true'] or i18n['false']
        return '<span style="color:' .. color .. ';">' .. text .. '</span>'
    end
    -- 如果不是布尔值,则返回默认格式化结果
    return tostring(value)
end
end


第137行: 第148行:
end
end


-- **NOTES 字段加粗/变色逻辑 (已修正)**
-- **NOTES 字段加粗/变色逻辑**
local function formatNotesValue(valueString, context)
local function formatNotesValue(valueString, context)
     local numValue = tonumber(valueString)
     local numValue = tonumber(valueString)
第189行: 第200行:
         return value
         return value
     end),
     end),
    -- key 字段在非表格环境中的默认处理 (例如 p.value 调用)
    ['key'] = (function(value)
        if type(value) == 'boolean' then
            return value and i18n['true'] or i18n['false']
        end
        return tostring(value)
    end)
}
}


第231行: 第249行:
         local value = ValueFromValuesByKey(songEntry, argType)
         local value = ValueFromValuesByKey(songEntry, argType)
          
          
        -- 使用 formatSingleValue 处理 BPM/Duration/Key(boolean->text) 等映射
         local formattedValue = formatSingleValue(value, argType)  
         local formattedValue = formatSingleValue(value, argType)  
       
         formattedValue = applySCPrefix(formattedValue, argType)
         formattedValue = applySCPrefix(formattedValue, argType)
          
          
第313行: 第333行:
         local separator = ' ' -- 默认分隔符是空格
         local separator = ' ' -- 默认分隔符是空格
          
          
         if mode then -- 谱面难度字段 (3.2% 固定宽度)
         -- BPM/Pack/Key/Duration 字段,固定宽度 6% (UPDATED)
            headerStyle = ' style="width: 3.2%;"'
        if field == 'bpm' or field == 'pack' or field == 'key' or field == 'duration' then  
            separator = ' | '  
        elseif field == 'bpm' then -- BPM 字段,固定宽度 6%
             headerStyle = ' style="width: 6%;"'
             headerStyle = ' style="width: 6%;"'
             separator = ' | '  
             separator = ' | '  
         elseif field == 'pack' then -- Pack 字段,固定宽度 6%
         elseif mode then -- 谱面难度字段 (3.2% 固定宽度)
             headerStyle = ' style="width: 6%;"'
             headerStyle = ' style="width: 3.2%;"'
             separator = ' | '  
             separator = ' | '  
         elseif string.match(field, '_notes$') then -- NOTES 字段 (4% 固定宽度)
         elseif string.match(field, '_notes$') then -- NOTES 字段 (4% 固定宽度)
第340行: 第358行:
              
              
             local rawValue = ValueFromValuesByKey(songEntry, field)
             local rawValue = ValueFromValuesByKey(songEntry, field)
           
            -- 获取格式化的值
             local formattedValue = formatSingleValue(rawValue, field)
             local formattedValue = formatSingleValue(rawValue, field)
              
              
第345行: 第365行:
             if field == 'bpm' then
             if field == 'bpm' then
                 formattedValue = formatBPMValue(formattedValue)
                 formattedValue = formatBPMValue(formattedValue)
            elseif field == 'key' then
                formattedValue = formatKeyValue(rawValue) -- 对 key 字段应用颜色逻辑,使用原始值 (rawValue)
             end
             end
 
           
             local _, mode = getDifficultyDetails(field)
             local _, mode = getDifficultyDetails(field)
             if mode then
             if mode then