<?xml version="1.0" encoding="UTF-8"?>

<?context-directive job ctxfile x-setups.ctx ?>

<cd:interface xmlns:cd="http://www.pragma-ade.com/commands">

    <cd:define name="assignment-setupfittingpage">
        <cd:assignments list="yes">
            <cd:parameter name="pagestate">
                <cd:constant type="start"/>
                <cd:constant type="stop" default="yes"/>
            </cd:parameter>
            <cd:parameter name="command">
                <cd:constant type="cd:oneargument"/>
            </cd:parameter>
            <cd:parameter name="margin">
                <cd:constant type="page"/>
            </cd:parameter>
            <cd:parameter name="scale">
                <cd:constant type="cd:number"/>
            </cd:parameter>
            <cd:parameter name="paper">
                <cd:constant type="auto"/>
                <cd:constant type="default" default="yes"/>
                <cd:constant type="cd:name"/>
            </cd:parameter>
            <cd:inherit name="setupframed"/>
        </cd:assignments>
    </cd:define>

    <cd:command name="definefittingpage" level="style" category="layout" keywords="background" file="page-app.mkiv">
        <cd:arguments>
            <cd:resolve name="keyword-name"/>
            <cd:resolve name="keyword-name-optional"/>
            <cd:assignments list="yes" optional="yes">
                <cd:inherit name="setupfittingpage"/>
            </cd:assignments>
        </cd:arguments>
    </cd:command>

    <cd:command name="setupfittingpage" level="style" category="layout" keywords="background" file="page-app.mkiv">
        <cd:arguments>
            <cd:resolve name="keyword-name-list-optional"/>
            <cd:resolve name="assignment-setupfittingpage"/>
        </cd:arguments>
    </cd:command>

    <cd:command name="fittingpage" type="environment" level="document" category="layout" keywords="background" file="page-app.mkiv">
        <cd:arguments>
            <cd:resolve name="keyword-name"/>
            <cd:assignments list="yes" optional="yes">
                <cd:inherit name="setupfittingpage"/>
            </cd:assignments>
        </cd:arguments>
    </cd:command>

    <cd:command name="fittingpage" type="environment" generated="yes" variant="instance" level="document" category="layout" keywords="background" file="page-app.mkiv">
        <cd:sequence>
            <cd:instance value="fittingpage"/>
        </cd:sequence>
        <cd:arguments>
            <cd:assignments list="yes" optional="yes">
                <cd:inherit name="setupfittingpage"/>
            </cd:assignments>
        </cd:arguments>
        <cd:instances>
            <cd:resolve name="instance-fittingpage"/>
        </cd:instances>
    </cd:command>

    <cd:command name="setupTEXpage" level="style" category="layout" keywords="background" file="page-app.mkiv">
        <cd:arguments>
            <cd:resolve name="assignment-setupfittingpage"/>
        </cd:arguments>
    </cd:command>

    <cd:command name="setupMPpage" level="style" category="layout" keywords="background metapost" file="meta-fig.mkiv">
        <cd:arguments>
            <cd:resolve name="assignment-setupfittingpage"/>
        </cd:arguments>
    </cd:command>

</cd:interface>
