• Welcome to the Kancolle Wiki!
  • If you have any questions regarding site content, account registration, etc., please visit the KanColle Wiki Discord

Changes

Jump to navigation Jump to search
Refactor, fix fragment links for ships without page aliases
Line 58: Line 58:  
_arrow = "⇒",
 
_arrow = "⇒",
 
_question_marks = "??",
 
_question_marks = "??",
 +
_fragment_prefix = "shipremodelistkai",
 
}
 
}
   Line 69: Line 70:     
function ShipRemodelListKai:name(ship)
 
function ShipRemodelListKai:name(ship)
return {values = {value = tostring(mw.html.create('span'):attr('id', "shipremodellistkai-" .. tostring(ship:api_id() or mw.ustring.lower(mw.ustring.gsub(text, "%s+")))):wikitext(Formatting:format_link(ship:link())))}, bg_color = self._transparent, text_align = self._center_align}
+
return {values = {value = Formatting:id_span(tostring(ship:api_id() or mw.ustring.lower(mw.ustring.gsub(ship:name(), "%s+"))), self._fragment_prefix, Formatting:format_link(ship:link()))}, bg_color = self._transparent, text_align = self._center_align}
 
end
 
end
   Line 115: Line 116:  
local name_after = self._remodel_to == nil and self._question_marks or self._dash
 
local name_after = self._remodel_to == nil and self._question_marks or self._dash
 
if self._remodel_to then
 
if self._remodel_to then
local text = select(2, self._remodel_to:link())
+
name_after = Formatting:fragment_link(tostring(self._remodel_to:api_id() or mw.ustring.lower(mw.ustring.gsub(self._remodel_to:name(), "%s+"))), self._fragment_prefix, self._remodel_to:name())
name_after = Formatting:format_link("", text, "shipremodellistkai-" .. tostring(self._remodel_to:api_id() or mw.ustring.lower(mw.ustring.gsub(text, "%s+"))))
   
end
 
end
 
return {values = {value = name_after}, bg_color = self._transparent, text_align = self._center_align}
 
return {values = {value = name_after}, bg_color = self._transparent, text_align = self._center_align}
Anonymous user

Navigation menu