Replaces macros in documentation with their appropriate values. These macros
    are used for things like providing URLs.

def sub_macros(string,base_url):
    '''
    Replaces macros in documentation with their appropriate values. These macros
    are used for things like providing URLs.
    '''
    macros = { '|url|': base_url,
               '|media|': os.path.join(base_url,'media'),
               '|page|': os.path.join(base_url,'page')
             }
    for key, val in macros.items():
        string = string.replace(key,val)
    return string