"use strict";

/*
 *  Link Examples:
 * 
 *     last
 *     next
 *     [Day]
 *     [Time]
 *     [Time] #2
 *     [Day] > [Time]
 *     [Day] > [Time] : [Location]
 *     [Day] > [Time] : [Location] #2
 *
 */

function processTargets( story )
{   
    // Traverse story and process the targets in links/choices.
    story.chapters.forEach( function( chapter, chapterIndex ) {
        chapter.pages.forEach( function( page, pageIndex ) {
            
            // Process links.
            page.links.forEach( function( link, linkIndex ) {
                story = processLinkOnPage( story, chapterIndex, 
                    pageIndex, linkIndex, link );
            });
            
            // Process choices.
            page.texts.forEach( function( text, textIndex ) {
                story = processChoiceOnText( story, chapterIndex, 
                    pageIndex, textIndex, text );
            }
        });
    });
    
    return story;
}

function processLinkOnPage( story, chapterIndex, pageIndex, linkIndex, link )
{
    return story;
}

function processChoiceOnText( story, chapterIndex, pageIndex, textIndex, text )
{
    return story;
}


@@ -15,20 +15,22 @@
 %0A/*%0A *  
-Link
+Target
  Example
@@ -946,32 +946,163 @@
 eturn story;%0A%7D%0A%0A
+function targetAddress( chapterIndex, pageIndex )%0A%7B%0A    return %7B%0A        chapter: chapterIndex,%0A        page: pageIndex,%0A    %7D;%0A%7D%0A%0A
 function process

Work on linker.