             </ul>
             <ul id="panel-content-body" class="list-group">
                 <li class="list-item" v-repeat="body.goal">
-                    <button class='no-btn text-info' v-on="click: jumpToGoal(goalIndex)">{{goalIndex}}</button>
+                    <button class='no-btn text-info' v-on="click: jumpToGoal(index)">{{index}}</button>
                     <span>:</span>
-                    <type input="{{goalType}}"></type>
+                    <type input="{{body}}"></type>
                 </li>
                 <li class="list-item" v-repeat="body.term">
-                    <span class="text-success">{{termIndex}}</span>
+                    <span class="text-success">{{index}}</span>
                     <span>:</span>
-                    <type input="{{termType}}"></type>
+                    <type input="{{body}}"></type>
                 </li>
                 <li class="list-item" v-repeat="body.meta">
-                    <span class="text-success">{{metaIndex}}</span>
+                    <span class="text-success">{{index}}</span>
                     <span>:</span>
-                    <type input="{{metaType}}"></type><span class="location text-subtle">{{location}}</span>
+                    <type input="{{body}}"></type><span class="location text-subtle">{{location}}</span>
                 </li>
                 <li class="list-item" v-repeat="body.sort">
-                    <span class="text-highlight">Sort</span> <span class="text-warning">{{sortIndex}}</span><span class="location text-subtle">{{location}}</span>
+                    <span class="text-highlight">Sort</span> <span class="text-warning">{{index}}</span><span class="location text-subtle">{{location}}</span>
                 </li>
                 <li class="list-item" v-repeat="body.value">
                     <type input="{{value}}"></type>

            set: (content) ->
                if content.type is 'value' or content.type is 'type-judgement'
                    {header, body} = divideContent content.body
                    @header = concatJudgements(header).map parseHeader
                    items = concatJudgements(body).map parseBody
                    @body =
                        goal: _.filter(items, 'goalIndex')
                        term: _.filter(items, 'termIndex')
                        meta: _.filter(items, 'metaIndex')
                        sort: _.filter(items, 'sortIndex')
                        value: _.filter(items, 'value')

                else
                    @header = []

_   = require 'lodash'
require './body/type'

regexHeader = /^(Goal|Have)\: ((?:\n|.)+)/
parseHeader = (str) ->
    result = str.match regexHeader
    label: result[1]
    type: result[2]

regexLocation = /((?:\n|.)*\S+)\s*\[ at (.+):(?:(\d+)\,(\d+)\-(\d+)\,(\d+)|(\d+)\,(\d+)\-(\d+)) \]/
parseLocation = (str) ->
    result = str.match regexLocation
    if result
        body: result[1]
        location:
            path: result[2]
            rowStart: if result[3] then result[3] else result[7]
            rowEnd: if result[5] then result[5] else result[7]
            colStart: if result[4] then result[4] else result[8]
            colEnd: if result[6] then result[6] else result[9]

regexGoal = /^(\?\d+) \: ((?:\n|.)+)/
parseGoal = (str) ->
    result = str.match regexGoal
    if result
        index: result[1]
        body: result[2]
        type: 'goal'

regexTerm = /^([^\_\?].*) \: ((?:\n|.)+)/
parseTerm = (str) ->
    result = str.match regexTerm
    if result
        index: result[1]
        body: result[2]
        type: 'term'

regexMeta = /^(.+) \: ((?:\n|.)+)/
parseMeta = (str) ->
    {body, location} = parseLocation str
    result = body.match regexMeta
    if result
        index: result[1]
        body: result[2]
        location: location
        type: 'meta'

regexSort = /^Sort ((?:\n|.)+)/
parseSort = (str) ->
    {body, location} = parseLocation str
    result = body.match regexSort
    if result
        index: result[1]
        location: location
        type: 'sort'

parseBody = (str) -> parseGoal(str) || parseTerm(str) || parseMeta(str) || parseSort(str)

# divide content into header and body
# divideContent : [String] -> { header :: [String], body :: [String] }
