Beispiel #1
0
def add_in_section(X, tstart, tspan, is_sub=False):
    '''X should just be a list of a single string, but may generalize...

    Also now includes SUBSECTION; basically same as SECTION, but uses
    '-' instead of '=' for the underline.  No change in indentation.

    '''

    tscript = ''
    trst = ''

    lline = X[tstart]
    ss = lline.split()
    text = ' '.join(ss[1:])
    ltext = len(text)

    trst += text + "\n"
    if is_sub:
        trst += (ltext + 2) * '-'
        tscript += lat.bannerize(text, fullwid=72, padsymb='-')
    else:
        trst += (ltext + 2) * '='
        tscript += lat.bannerize(text, fullwid=72, padsymb='=')

    # might have empty lines/padding
    for ii in range(1, tspan):
        jj = tstart + ii
        tscript += X[jj]
        trst += X[jj]

    return tscript, trst
Beispiel #2
0
    The script can be re-run.  Variables are defined in the 'Top level'
    section and used throughout, but otherwise the script is modular.
    individual sections can be run with or without modification (e.g.,
    copying them into a new file), as long as the 'Top level' sections are
    all present.

    '''.format(lat.qcbase, ap_ssdict['subj'], lat.ohtml)

    comm = lat.commentize(comm, padpost=2)
    str_FULL += comm

    # ------------------------------------------------------------------

    # Top level: definitions from json/dictionary of 'uvars'

    ban_apqc_topvar = lat.bannerize('Top level: file names and global vars',
                                    padpost=1)
    str_apqc_topvar = lat.make_apqc_top_vars(ap_ssdict, all_uvars)

    str_FULL += ban_apqc_topvar
    str_FULL += str_apqc_topvar

    # --------------------------------------------------------------------

    # Top level: commands to make dirs for output

    ban = lat.bannerize('Top level: make output directory structure')
    cmd = lat.make_apqc_dirs()

    str_FULL += ban
    str_FULL += cmd