From WikiChip
Module:arch timeline
Revision as of 04:15, 14 May 2017 by Inject (talk | contribs)

Documentation for this module may be created at Module:arch timeline/doc

local p = {
  arch = {
    intel = {
      {"09/01/2015", "01/01/2018", "[[intel/microarchitectures/skylake|Skylake]]" },
      {"08/30/2016", "01/01/2019", "[[intel/microarchitectures/kaby_lake|Kaby Lake]]" },
      {"07/01/2017", "01/01/2019", "[[intel/microarchitectures/coffee_lake|Coffee Lake]]" },
      {"10/01/2017", "10/01/2019", "[[intel/microarchitectures/cannonlake|Cannonlake]]" },
      {"08/01/2018", "01/01/2020", "[[intel/microarchitectures/icelake|Icelake]]" },
      {"08/01/2019", "01/01/2021", "[[intel/microarchitectures/tigerlake|Tigerlake]]" }
    }
  }
}

function p.new_timeline(w, h, s, e)
		return [[
<timeline>
ImageSize  = width:]] .. w .. [[ height:]] .. h .. [[
PlotArea   = left:150 right:10 top:10 bottom:25 #left:0 right:0 bottom:20 top:0

DateFormat = mm/dd/yyyy
Period     = from:]] .. s .. [[ till:]] .. e .. [[
ScaleMajor = unit:year increment:1 start:]] .. s .. [[
ScaleMinor = unit:month increment:1 start:]] .. s .. [[

TimeAxis   = orientation:horizontal
AlignBars  = justify

Colors =
   id:c_arch1 value:rgb(1,0.96,0.90)
   id:c_arch2 value:rgb(1,0.92,0.90)
   id:c_arch3 value:rgb(1,0.88,0.80)
   id:c_arch4 value:rgb(1,0.84,0.80)
   id:c_arch5 value:rgb(1,0.80,0.70)
   id:c_arch6 value:rgb(1,0.76,0.70)
   id:c_arch7 value:rgb(1,0.72,0.60)
   id:c_arch8 value:rgb(1,0.68,0.60)
   id:c_arch9 value:rgb(1,0.64,0.50)

   id:c_core1 value:rgb(0.47,0.83,0.91)
   id:c_core2 value:rgb(0.97,0.90,0.72)
   id:c_core3 value:rgb(0.68,1,0.91)
   id:c_core4 value:rgb(0.98,0.73,0.87)
   id:c_core5 value:rgb(0.78,0.82,0.96)
   id:c_core6 value:rgb(0.84,0.97,0.96)
   id:c_core7 value:rgb(0.95,0.83,1)
   id:c_core8 value:rgb(0.89,0.95,0.87)
   id:c_core9 value:rgb(0.78,0.93,1)

BarData =
  barset:Microarchitectures
    bar:arch1
    bar:arch2
    bar:arch3
    bar:arch4
    bar:arch5
    bar:arch6
    bar:arch7
    bar:arch8
    bar:arch9
  barset:Cores1
    bar:core11
    bar:core12
    bar:core13
    bar:core14
    bar:core15
    bar:core16
  barset:Cores2
    bar:core21
    bar:core22
    bar:core23
    bar:core24
    bar:core25
    bar:core26
  barset:Cores3
    bar:core31
    bar:core32
    bar:core33
    bar:core34
    bar:core35
    bar:core36
  barset:Cores4
    bar:core41
    bar:core42
    bar:core43
    bar:core44
    bar:core45
    bar:core46
  barset:Cores5
    bar:core51
    bar:core52
    bar:core53
    bar:core54
    bar:core55
    bar:core56
  barset:Cores6
    bar:core61
    bar:core62
    bar:core63
    bar:core64
    bar:core65
    bar:core66
  barset:Cores7
    bar:core71
    bar:core72
    bar:core73
    bar:core74
    bar:core75
    bar:core76
  barset:Cores8
    bar:core81
    bar:core82
    bar:core83
    bar:core84
    bar:core85
    bar:core86
  barset:Cores9
    bar:core91
    bar:core92
    bar:core93
    bar:core94
    bar:core95
    bar:core96
]]

end

function p.intel (frame)
  local timeline
  local lang = mw.language.getContentLanguage()
  
  if not frame.args.date_start or not frame.args.date_end then
    return "MISSING START OR END DATE"
  end
  
  if not frame.args.width or not frame.args.height then
    return "MISSING WIDTH OR HEIGHT"
  end
  
  local start_date = frame.args.date_start
  local end_date = frame.args.date_end
  
  timeline = new_timeline(frame.args.width, frame.args.height, start_date, end_date)
  
  return timeline
end

return p