Module:Citation/CS1: Difference between revisions

    m>Dragons flight
    (worry about the enddot)
    m>Dragons flight
    No edit summary
    Line 105: Line 105:
          
          
         local str = '';
         local str = '';
        local comp = '';
         for _, value in ipairs( tbl ) do
         for _, value in ipairs( tbl ) do
             if value == nil then value = ''; end
             if value == nil then value = ''; end
    Line 111: Line 112:
                 str = value;
                 str = value;
             elseif value ~= '' then
             elseif value ~= '' then
                 if value:sub(1,1) == duplicate_char then
                 if value:sub(1,1) == '<' then
                    -- Special case of values enclosed in spans and other markup.
                    comp = value:replace( "%b<>", "" );
                else
                    comp = value;
                end
               
                if comp:sub(1,1) == duplicate_char then
                     if str:sub(-1,-1) == duplicate_char then
                     if str:sub(-1,-1) == duplicate_char then
                         str = str .. value:sub(2);
                         str = str(1,-2) .. value;
                     elseif str:sub(-3,-1) == duplicate_char .. "''" then                   
                     elseif str:sub(-3,-1) == duplicate_char .. "''" then                   
                         str = str .. value:sub(2);
                         str = str(1, -4) .. "''" .. value:sub(2);
                     elseif str:sub(-2,-1) == duplicate_char .. " " then
                     elseif str:sub(-2,-1) == duplicate_char .. " " then
                         str = str:sub(1,-3) .. value;
                         str = str:sub(1,-3) .. value;