 
         ).appendTo(@element)
 
-    renderCorpusContent: (type, wordData, sentenceData, corpus_attrs, tokens) ->
+    renderCorpusContent: (type, wordData, sentenceData, corpus_attrs, tokens, customAttrs, customData) ->
         if type == "struct"
             pairs = _.pairs(sentenceData)
 

        @element.html '<div id="selected_sentence" /><div id="selected_word" />'
        corpusObj = settings.corpora[corpus]

        $("<div />").html("<h4 rel='localize[corpus]'></h4> <p>#{corpusObj.title}</p>").prependTo "#selected_sentence"
        unless $.isEmptyObject(corpusObj.attributes)
            $("#selected_word").append $("<h4>").localeKey("word_attr")

            posData = @renderCorpusContent("pos", wordData, sentenceData, corpusObj.attributes, tokens)
            # posData.appendTo "#selected_word"
            $("#selected_word").append posData
        unless $.isEmptyObject(corpusObj.struct_attributes)
            $("#selected_sentence").append $("<h4>").localeKey("sentence_attr")

            @renderCorpusContent("struct", wordData, sentenceData, corpusObj.struct_attributes, tokens).appendTo "#selected_sentence"

        unless $.isEmptyObject(corpusObj.custom_attributes)
            [word, sentence] = @renderCustomContent(wordData, sentenceData, corpusObj.custom_attributes, tokens)
            word.appendTo "#selected_word"
            sentence.appendTo "#selected_sentence"

        @element.localize()
        @applyEllipse()

                    pairs.push([key, val])

        pairs = _.filter pairs, ([key, val]) -> corpus_attrs[key]
        pairs = _.filter pairs, ([key, val]) -> not (corpus_attrs[key].displayType == "hidden" or corpus_attrs[key].displayType == "date_interval" or corpus_attrs[key].hideSidebar)

        for custom in customData
            pairs.push custom

        pairs.sort ([a], [b]) ->
            if a of corpus_attrs
                ord1 = corpus_attrs[a].order
            else
                ord1 = customAttrs[a].order

            if b of corpus_attrs
                ord2 = corpus_attrs[b].order
            else
                ord2 = customAttrs[b].order

            # first three cases to handle ord1 or ord2 being undefined
            if ord1 == ord2
                return 0
