跳至內容

「Module:StorySim」:修訂間差異

移除 440 位元組 、​ 2023年12月31日 (星期日)
無編輯摘要
無編輯摘要
SSF留言 | 貢獻
無編輯摘要
第168行: 第168行:
]]
]]


local function reco(_str)
local function reco(str)
    while true do
    while true do
      local s,e,c,t = string.find(_str,'<color=(.-)>(.-)</color>');
      local s,e,c,t = string.find(str,'<color=(.-)>(.-)</color>');
      if s then _str = string.sub(_str,1,s-1) .. "<span class='Colored color_" .. c .. "' style='color:" .. c .. ";'>" .. t .. "</span>" .. string.sub(_str,e+1)
      if s then str = string.sub(str,1,s-1) .. "<span class='Colored color_" .. c .. "' style='color:" .. c .. ";'>" .. t .. "</span>" .. string.sub(str,e+1)
      else break;
      else break;
      end
      end
    end
    end
    while true do
    while true do
      local s,e,c,t = string.find(_str,'<size=(.-)>(.-)</size>');
      local s,e,c,t = string.find(str,'<size=(.-)>(.-)</size>');
      if s then _str = string.sub(_str,1,s-1) .. string.format("<span class='Sized size_%s' style='font-size:%.3fem;'>",c,(tonumber(c)/36)) .. t .. "</span>" .. string.sub(_str,e+1)
      if s then str = string.sub(str,1,s-1) .. string.format("<span class='Sized size_%s' style='font-size:%.3fem;'>",c,(tonumber(c)/36)) .. t .. "</span>" .. string.sub(str,e+1)
      else break;
      else break;
      end
      end
    end
    end
    local start,size,ed = string.match(_str,'(.*)<indent=(.-)%>(.*)');
    local s,_,c,t = string.find(str,'<indent=(.-)%%>(.*)');
   start = start or '';
     if c then str = string.sub(str,1,s-1) .. string.format("<span class='Indented indent_%s' style='padding-left:%.3fem;'>",c,(tonumber(c)/5)) .. t .. "</span>"
   if size and ed then
     local inn,out = string.match(ed,'(.*)</indent>(.*)');
     if inn and out then _str = start .. string.format("<span class='Indented indent_%s' style='padding-left:%.3fem;'>",size,(tonumber(size)/5)) .. inn .. '</span>' .. out;
     else _str = start .. string.format("<span class='Indented indent_%s' style='padding-left:%.3fem;'>",size,(tonumber(size)/5)) .. ed .. '</span>';
      end
      end
     -- _str = start .. "<span class='Indented indent_" .. size .. "' style='padding-left:" .. c .. "em;'>" .. t .. "</span>" .. ed;
    return str;
   end
    return _str;
end
end


WikiBuilder
329

次編輯