"""
    Raw Set Section
    
    Resets the section counter to the specified root section number. This is so that you may have
    pages that are part of a larger document that have sections starting at a certain number.
    
    Usage::
       [[SetSection(4)]]
       
    Note: Must be used BEFORE TableOfContents. 
    
    Code by Steve Tindle at SQI, Inc. (steve.tindle@sqi-inc.com)
"""


def execute(macro, args):
    section_start = int(args) -1
    if section_start < 0: section_start = 0
    macro.request._fmt_hd_counters = [section_start]
    macro.request._fmt_hd_counters_toc_start = section_start
    return ''
