Jump to content

Module:Citation/CS1: Difference between revisions

testing
m>Dragons flight
(testing)
m>Dragons flight
(testing)
Line 96: Line 96:


function safejoin( tbl, duplicate_char, space_char )
function safejoin( tbl, duplicate_char, space_char )
    --[[
    Note: we use string function here, rather than ustring functions.
   
    This has considerably faster performance and should work correctly as
    long as the duplicate_char and space_char are strict ASCII.  The strings
    in tbl may be ASCII or UTF8.
    ]]
   
     local str = '';
     local str = '';
     for _, value in ipairs( tbl ) do
     for _, value in ipairs( tbl ) do
Line 108: Line 116:
             if value:sub(1,1) == duplicate_char then
             if value:sub(1,1) == duplicate_char then
                 if str:sub(-1,-1) == duplicate_char then
                 if str:sub(-1,-1) == duplicate_char then
                     str = str .. space_char .. value:sub(2);
                     if string.len( value ) > 1 then
                        str = str .. space_char .. value:sub(2);
                    end                   
                 elseif str:sub(-3,-1) == duplicate_char .. "''" then                   
                 elseif str:sub(-3,-1) == duplicate_char .. "''" then                   
                     str = str .. space_char .. value:sub(2);
                     if string.len( value ) > 1 then
                        str = str .. space_char .. value:sub(2);
                    end                   
                 else
                 else
                     str = str .. space_char .. value;
                     str = str .. space_char .. value;
Anonymous user
Cookies help us deliver our services. By using our services, you agree to our use of cookies.