 WorkoutsMeta.prototype.getAll = () ->
 	this._meta.slice()
 
+WorkoutsMeta.prototype.render = () ->
+	'<div class="meta">' +
+		this._meta.map((metaSection) ->
+			'<div class="meta-section">' +
+				metaSection +
+			'</div>') +
+	'</div>'
+
 Workout = (workoutText) ->
 	this._chunks = workoutText.split('\n')
 	this._header = new WorkoutHeader(this._chunks[0])

Workout.prototype.isValid = () ->
	this._header.isValid()

WorkoutHeader = (headerText) ->
	DATE_REGEXP = /^(\d+\/\d+\/\d+)\s/
	this._workoutDate = headerText.match(DATE_REGEXP)?[1]
	this

WorkoutHeader.prototype.isValid = () ->
	!!this._workoutDate

Exercises = (exercises) -> this

WorkoutsView = (workouts) ->
	html = []

	html.push workouts.getAllMeta().map (metaSection) ->
		'<div class="meta">' +
			metaSection +
		'</div>'


	html.push workouts.getAll().map (workout) ->
		'<div class="workout">' +
			workout +
		'</div>'

	this._html = html.join('')
	this

Workouts.prototype.getAllMeta = () ->
	this._meta.getAll()

Workouts.prototype.renderMeta = () ->
	this._meta.render()

WorkoutsMeta = (textChunks) ->
	this._meta = []
	this
