package website

(@

load("@ytt:assert", "assert")
load("@ytt:data", "data")

def golang_escape_tick(str):
  # in Go the only way to escape tick is to
  # break up string and wrap tick in double quotes
  return str.replace("`", "`+\"`\"+`")
end

def inject_google_analytics(str):
  return str.replace("<!-- google analytics -->", data.values.google_analytics)
end

assetFiles = []
exampleFiles = []

for file in data.list():
  if file.startswith('js/') or file.startswith('templates/'):
    assetFiles.append(file)
  end
end

@)

func init() {
	Files = map[string]File{
		(@ for name in assetFiles: @)
    "(@= name @)": File{
      Name: "(@= name @)",
      Content: `(@= inject_google_analytics(golang_escape_tick(data.read(name))) @)`,
    },
		(@ end @)
	}
}
