Module:Tabs: Difference between revisions

Want an adless experience? Log in or Create an account.
support transcluding content
mNo edit summary
(support transcluding content)
Line 176: Line 176:
   local content = mw.html.create( 'div' )
   local content = mw.html.create( 'div' )
     :addClass( 'zdw-tabcontent' )
     :addClass( 'zdw-tabcontent' )
     :wikitext( '\n' .. self.content ) -- newline is needed for tables, lists, etc.
 
  if self.content == 'transclude' then
    local template = mw.getCurrentFrame():expandTemplate{ title = 'PAGENAME' } .. '/'
     if type( self.selection ) == 'table' then
      template = template .. self.selection.left .. '/' .. self.selection.right
    else
      template = template .. self.selection
    end
    content:tag( 'span' )
      :addClass( 'edit plainlinks' )
      :css( 'position', 'absolute' )
      :css( 'top', '12px' )
      :css( 'right', '15px' )
      :wikitext( '[' .. tostring( mw.uri.fullUrl( template, { action = 'edit' } ) ) .. ' [edit]]' )
    content:wikitext( '\n' .. mw.getCurrentFrame():expandTemplate{ title = template } )
  else
    content:wikitext( '\n' .. self.content ) -- newline is needed for tables, lists, etc.
  end


   if type( self.selection ) == 'table' then
   if type( self.selection ) == 'table' then