Updated color for state

Updated color for state

Map { font-directory: url("./fonts"); }

@default_text_halo: white;
@default_text_color: black;
@default_text_halo_radius: 2;

#lands {
    polygon-opacity:1;
    [zoom >= 14] {
        text-face-name: 'Noto Sans Regular';
        text-name:'[name]';
        [name=''],[name=null] {
            text-name: '[adminAgency]';
        }
        text-size: 12;
        text-placement:line;
        text-fill:black;
        text-halo-fill: @default_text_halo;
        text-halo-radius: @default_text_halo_radius;
        text-dy:-5;
        text-min-padding:1;
        text-max-char-angle-delta : 10;
        text-min-distance:50;
        //Border line
        line-width:1;
        line-color:black;
    }
    [adminlevel='federal'] {
        polygon-fill:#984ea3;
    }
    [adminLevel='state'] {
        polygon-fill:#eed3ee;
    }
    [adminLevel='county'] {
        polygon-fill:#ffff33;
    }
    [adminLevel='local'] {
        polygon-fill:#00ffff;
    }
    [adminAgency='Bureau of Land Management'] {
        polygon-fill: #e41a1c;
    }
    [adminAgency='Forest Service'] {
        polygon-fill: #4daf4a;
    }
    [adminAgency='U.S. Forest Service'] {
        polygon-fill: #4daf4a;
    }
    [adminAgency='National Park Service'] {
        polygon-fill: #a65628;
    }
    [adminAgency='Department of Defense'],[adminAgency='Army Corps of Engineers'],[adminAgency='Army'],[adminAgency='Air Force'],[adminAgency='Navy'],[adminAgency='Marine Corps'],[adminAgency='Coast Guard'],[adminAgency='Fish & Wildlife Service'] {
        polygon-fill: #0489B1;
    }
}

Map { font-directory: url("./fonts"); }

@default_text_halo: white;
@default_text_color: black;
@default_text_halo_radius: 2;

#lands {
    polygon-opacity:1;
    [zoom >= 14] {
        text-face-name: 'Noto Sans Regular';
        text-name:'[name]';
        [name=''],[name=null] {
            text-name: '[adminAgency]';
        }
        text-size: 12;
        text-placement:line;
        text-fill:black;
        text-halo-fill: @default_text_halo;
        text-halo-radius: @default_text_halo_radius;
        text-dy:-5;
        text-min-padding:1;
        text-max-char-angle-delta : 10;
        text-min-distance:50;
        //Border line
        line-width:1;
        line-color:black;
    }
    [adminlevel='federal'] {
        polygon-fill:#984ea3;
    }
    [adminLevel='state'] {
        polygon-fill:#dda0dd;
    }
    [adminLevel='county'] {
        polygon-fill:#ffff33;
    }
    [adminLevel='local'] {
        polygon-fill:#00ffff;
    }
    [adminAgency='Bureau of Land Management'] {
        polygon-fill: #e41a1c;
    }
    [adminAgency='Forest Service'] {
        polygon-fill: #4daf4a;
    }
    [adminAgency='U.S. Forest Service'] {
        polygon-fill: #4daf4a;
    }
    [adminAgency='National Park Service'] {
        polygon-fill: #a65628;
    }
    [adminAgency='Department of Defense'],[adminAgency='Army Corps of Engineers'],[adminAgency='Army'],[adminAgency='Air Force'],[adminAgency='Navy'],[adminAgency='Marine Corps'],[adminAgency='Coast Guard'],[adminAgency='Fish & Wildlife Service'] {
        polygon-fill: #0489B1;
    }
}


Update palette.mss

Update palette.mss

/* ****************************************************************** */
/* OSM BRIGHT for Imposm                                              */
/* ****************************************************************** */

/* For basic style customization you can simply edit the colors and
 * fonts defined in this file. For more detailed / advanced
 * adjustments explore the other files.
 *
 * GENERAL NOTES
 *
 * There is a slight performance cost in rendering line-caps.  An
 * effort has been made to restrict line-cap definitions to styles
 * where the results will be visible (lines at least 2 pixels thick).
 */

/* ================================================================== */
/* FONTS
/* ================================================================== */

/* directory to load fonts from in addition to the system directories */
Map { font-directory: url(./fonts); }

/* set up font sets for various weights and styles */
@sans_lt:           "Open Sans Regular","DejaVu Sans Book","unifont Medium";
@sans_lt_italic:    "Open Sans Italic","DejaVu Sans Italic","unifont Medium";
@sans:              "Open Sans Semibold","DejaVu Sans Book","unifont Medium";
@sans_italic:       "Open Sans Semibold Italic","DejaVu Sans Italic","unifont Medium";
@sans_bold:         "Open Sans Bold","DejaVu Sans Bold","unifont Medium";
@sans_bold_italic:  "Open Sans Bold Italic","DejaVu Sans Bold Italic","unifont Medium";

/* Some fonts are larger or smaller than others. Use this variable to
   globally increase or decrease the font sizes. */
/* Note this is only implemented for certain things so far */
@text_adjust: 0;

/* ================================================================== */
/* COLOR PALETTE
/* ================================================================== */
@grey1: #595959;
@black: #000000;
@white: #ffffff;
@grey2: #8F8F8F;
@grey3: #D6D6D6;
@orange: #FF6600;
@blue: #4BB4E6;
@yellow: #FFDC00;
@green: #50BE87;
@purple: #9164CD;
@pink: #FFB4E6;

/* ================================================================== */
/* LANDUSE & LANDCOVER COLORS
/* ================================================================== */

@land:              @white;
@water:             @blue;
@grass:             @green;
@beach:             @yellow;
@park:              @green;
@cemetery:          @white;
@wooded:            @green;
@agriculture:       @white;

@building:          @orange;
@hospital:          @white;
@school:            @white;
@sports:            @green;

@residential:       @white;
@commercial:        @white;
@industrial:        @white;
@parking:           @white;

/* ================================================================== */
/* ROAD COLORS
/* ================================================================== */

/* For each class of road there are three color variables:
 * - line: for lower zoomlevels when the road is represented by a
 *         single solid line.
 * - case: for higher zoomlevels, this color is for the road's
 *         casing (outline).
 * - fill: for higher zoomlevels, this color is for the road's
 *         inner fill (inline).
 */

@motorway_line:     @black;
@motorway_fill:     lighten(@motorway_line,80%);
@motorway_case:     @motorway_line * 0.8;

@trunk_line:        @black;
@trunk_fill:        lighten(@trunk_line,70%);
@trunk_case:        @trunk_line * 0.7;

@primary_line:      @black;
@primary_fill:      lighten(@primary_line,60%);
@primary_case:      @primary_line * 0.6;

@secondary_line:    @black;
@secondary_fill:    lighten(@secondary_line,50%);
@secondary_case:    @secondary_line * 0.5;

@standard_line:     @black;
@standard_fill:     @white;
@standard_case:     @black;

@pedestrian_line:   @black;
@pedestrian_fill:   @white;
@pedestrian_case:   @black;

@cycle_line:        @black;
@cycle_fill:        @white;
@cycle_case:        @black;

@rail_line:         @black;
@rail_fill:         @black;
@rail_case:         @black;

@aeroway:           @black;

/* ================================================================== */
/* BOUNDARY COLORS
/* ================================================================== */

@admin_2:           @purple;

/* ================================================================== */
/* LABEL COLORS
/* ================================================================== */

/* We set up a default halo color for places so you can edit them all
   at once or override each individually. */
@place_halo:        fadeout(#fff,0%);

@country_text:      @black;
@country_halo:      @place_halo;

@state_text:        @black;
@state_halo:        @place_halo;

@city_text:         @black;
@city_halo:         @place_halo;

@town_text:         @black;
@town_halo:         @place_halo;

@poi_text:          @black;

@road_text:         @black;
@road_halo:         @place_halo;

@other_text:        @black;
@other_halo:        @place_halo;

@locality_text:     @black;
@locality_halo:     @land;

/* Also used for other small places: hamlets, suburbs, localities */
@village_text:      @black;
@village_halo:      @place_halo;

/* ****************************************************************** */

/* ****************************************************************** */
/* OSM BRIGHT for Imposm                                              */
/* ****************************************************************** */

/* For basic style customization you can simply edit the colors and
 * fonts defined in this file. For more detailed / advanced
 * adjustments explore the other files.
 *
 * GENERAL NOTES
 *
 * There is a slight performance cost in rendering line-caps.  An
 * effort has been made to restrict line-cap definitions to styles
 * where the results will be visible (lines at least 2 pixels thick).
 */

/* ================================================================== */
/* FONTS
/* ================================================================== */

/* directory to load fonts from in addition to the system directories */
Map { font-directory: url(./fonts); }

/* set up font sets for various weights and styles */
@sans_lt:           "Open Sans Regular","DejaVu Sans Book","unifont Medium";
@sans_lt_italic:    "Open Sans Italic","DejaVu Sans Italic","unifont Medium";
@sans:              "Open Sans Semibold","DejaVu Sans Book","unifont Medium";
@sans_italic:       "Open Sans Semibold Italic","DejaVu Sans Italic","unifont Medium";
@sans_bold:         "Open Sans Bold","DejaVu Sans Bold","unifont Medium";
@sans_bold_italic:  "Open Sans Bold Italic","DejaVu Sans Bold Italic","unifont Medium";

/* Some fonts are larger or smaller than others. Use this variable to
   globally increase or decrease the font sizes. */
/* Note this is only implemented for certain things so far */
@text_adjust: 0;

/* ================================================================== */
/* COLOR PALETTE
/* ================================================================== */
@grey1: #595959;
@black: #000000;
@white: #ffffff;
@grey2: #8F8F8F;
@grey3: #D6D6D6;
@orange: #FF6600;
@blue: #4BB4E6;
@yellow: #FFDC00;
@green: #50BE87;
@purple: #9164CD;
@pink: #FFB4E6;

/* ================================================================== */
/* LANDUSE & LANDCOVER COLORS
/* ================================================================== */

@land:              @white;
@water:             @blue;
@grass:             @green;
@beach:             @yellow;
@park:              @green;
@cemetery:          @white;
@wooded:            @green;
@agriculture:       @white;

@building:          @orange;
@hospital:          @white;
@school:            @white;
@sports:            @green;

@residential:       @white;
@commercial:        @white;
@industrial:        @white;
@parking:           @white;

/* ================================================================== */
/* ROAD COLORS
/* ================================================================== */

/* For each class of road there are three color variables:
 * - line: for lower zoomlevels when the road is represented by a
 *         single solid line.
 * - case: for higher zoomlevels, this color is for the road's
 *         casing (outline).
 * - fill: for higher zoomlevels, this color is for the road's
 *         inner fill (inline).
 */

@motorway_line:     @black;
@motorway_fill:     lighten(@motorway_line,80%);
@motorway_case:     @motorway_line * 0.8;

@trunk_line:        @black;
@trunk_fill:        lighten(@trunk_line,70%);
@trunk_case:        @trunk_line * 0.7;

@primary_line:      @black;
@primary_fill:      lighten(@primary_line,60%);
@primary_case:      @primary_line * 0.6;

@secondary_line:    @black;
@secondary_fill:    lighten(@secondary_line,50%);
@secondary_case:    @secondary_line * 0.5;

@standard_line:     @black;
@standard_fill:     @white;
@standard_case:     @black;

@pedestrian_line:   @black;
@pedestrian_fill:   @white;
@pedestrian_case:   @black;

@cycle_line:        @black;
@cycle_fill:        @white;
@cycle_case:        @black;

@rail_line:         @black;
@rail_fill:         @black;
@rail_case:         @black;

@aeroway:           @black;

/* ================================================================== */
/* BOUNDARY COLORS
/* ================================================================== */

@admin_2:           @purple;

/* ================================================================== */
/* LABEL COLORS
/* ================================================================== */

/* We set up a default halo color for places so you can edit them all
   at once or override each individually. */
@place_halo:        fadeout(#fff,0%);

@country_text:      @black;
@country_halo:      @place_halo;

@state_text:        @black;
@state_halo:        @place_halo;

@city_text:         @black;
@city_halo:         @place_halo;

@town_text:         @black;
@town_halo:         @place_halo;

@poi_text:          @black;

@road_text:         @black;
@road_halo:         @place_halo;

@other_text:        @place_halo;
@other_halo:        @place_halo;

@locality_text:     @place_halo;
@locality_halo:     @land;

/* Also used for other small places: hamlets, suburbs, localities */
@village_text:      @black;
@village_halo:      @place_halo;

/* ****************************************************************** */


WIP: Supporting more symbols

WIP: Supporting more symbols

function ProcessScore () {
    //$module(ExportProcessors.mss)
    // processors are a bit like a workflow manager -- they orchestrate the
    // generators, which in turn use the converters to convert specific values from sibelius
    // to MEI.
    score = Self._property:ActiveScore;

    mei = libmei.Mei();
    libmei.setDocumentRoot(mei);

    libmei.AddAttribute(mei, 'xmlns:xlink', 'http://www.w3.org/1999/xlink');
    libmei.AddAttribute(mei, 'xmlns', 'http://www.music-encoding.org/ns/mei');
    libmei.AddAttribute(mei, 'meiversion', '3.0.0');

    header = sibmei2.GenerateMEIHeader();
    libmei.AddChild(mei, header);

    music = sibmei2.GenerateMEIMusic();
    libmei.AddChild(mei, music);

}  //$end

function ProcessBeam (bobj, layer) {
    //$module(ExportProcessors.mss)
    ret = null;

    if (bobj.Duration < 256)
    {
        // if this object is an eighth note but is not beamed, and if the
        // active beam is set, null out the active beam and return null.
        if (bobj.Beam = NoBeam and layer._property:ActiveBeamId != null)
        {
            layer._property:ActiveBeamId = null;
            return ret;
        }

        /*
            It's possible that Sibelius records a 'continue beam' at the start
            of a beamed group. Visually, this doesn't look out of place if the previous
            note was a quarter note or higher.

            The first check we do is if the note has a 'continue beam' attribute and
            the previous note has a duration higher than 256 (quarter) then we probably have
            a false negative (i.e., there is the start of a beam, but it isn't necessarily
            encoded correctly).
        */
        falseNegative = False;
        next_obj = bobj.NextItem(bobj.VoiceNumber, 'NoteRest');

        if ((bobj.Beam = ContinueBeam or bobj.Beam = SingleBeam) and layer._property:ActiveBeamId = null)
        {
            // by all accounts this should be a beamed note, but we'll need to double-check.
            prev_obj = bobj.PreviousItem(bobj.VoiceNumber, 'NoteRest');

            if (prev_obj != null and (prev_obj.Duration >= 256 or prev_obj.NoteCount = 0))
            {
                falseNegative = True;
            }
        }

        if (next_obj != null and (bobj.Beam = StartBeam or falseNegative = True) and next_obj.Beam = ContinueBeam and next_obj.Duration < 256)
        {
            // if:
            //  - we're not at the end of the bar
            //  - we have a start beam
            //  - the next note is a continue beam
            //  - the next note is a beamable duration (safeguard against quarter and longer
            //    notes with Beam = ContinueBeam, which for some reason can actually occur)
            beam = libmei.Beam();
            layer._property:ActiveBeamId = beam._id;

            // return the beam so that we can add it to the tree.
            ret = beam;
        }

        if (layer._property:ActiveBeamId != null and (bobj.Beam = ContinueBeam or bobj.Beam = SingleBeam))
        {
            beamid = layer._property:ActiveBeamId;
            beam = libmei.getElementById(beamid);
            ret = beam;
        }
    }
    else
    {
        if (layer._property:ActiveBeamId != null)
        {
            // this is a break in any active beam, so register it as such.
            layer._property:ActiveBeamId = null;
        }
    }

    return ret;
}  //$end

function ProcessTuplet (bobj, meielement, layer) {
    //$module(ExportProcessors.mss)
    if (bobj.ParentTupletIfAny = null)
    {
        return null;
    }

    if (layer._property:ActiveTupletId = null)
    {
        tupletObject = bobj.ParentTupletIfAny;

        tuplet = libmei.Tuplet();

        layer._property:ActiveTupletObject = tupletObject;
        layer._property:ActiveTupletId = tuplet._id;

        if (libmei.GetName(meielement) = 'beam')
        {
            // get the first child
            startid = meielement.children[0];
        }
        else
        {
            startid = meielement._id;
        }

        libmei.AddAttribute(tuplet, 'startid', '#' & startid);
        libmei.AddAttribute(tuplet, 'num', tupletObject.Left);
        libmei.AddAttribute(tuplet, 'numbase', tupletObject.Right);

        tupletStyle = tupletObject.Style;

        switch (tupletStyle)
        {
            case(TupletNoNumber)
            {
                libmei.AddAttribute(tuplet, 'dur.visible', 'false');
            }
            case(TupletLeft)
            {
                libmei.AddAttribute(tuplet, 'num.format', 'count');
            }
            case(TupletLeftRight)
            {
                libmei.AddAttribute(tuplet, 'num.format', 'ratio');
            }
        }

        tupletBracket = tupletObject.Bracket;

        switch(tupletBracket)
        {
            case(TupletBracketOff)
            {
                libmei.AddAttribute(tuplet, 'bracket.visible', 'false');
            }
        }

        return tuplet;
    }
    else
    {
        tid = layer._property:ActiveTupletId;
        t = libmei.getElementById(tid);

        if (IsLastNoteInTuplet(bobj))
        {
            libmei.AddAttribute(t, 'endid', '#' & meielement._id);
            layer._property:ActiveTupletObject = null;
            layer._property:ActiveTupletId = null;
        }

        return t;
    }
}  //$end

function ShiftTupletToTupletSpan (tuplet, layer) {
    //$module(ExportProcessors.mss)
    /*
        Shifts the tuplet object to a tupletSpan object. This is
        useful if we need to define a tuplet outside of a hierarchy;
        for example, if a tuplet is only on part of a beam group.

        A tupletSpan supports many of the same attributes as a tuplet
        object, so we can copy the attributes verbatim. Functionally,
        it should behave the same way as a tuplet, except that it
        takes no child elements and the parent element is the measure,
        not the layer. These two things get handled higher up the
        processing chain, however, so we don't have to worry about them here.
    */

    tupletSpan = libmei.TupletSpan();
    libmei.SetAttributes(tupletSpan, tuplet.attrs);
    tupletSpan._property:AddedToMeasure = False;

    layer._property:ActiveTupletId = tupletSpan._id;

    if (tuplet._parent != null)
    {
        // if the tuplet has already been added to the tree,
        // remove it now. (Unfortunately, we can't delete the object,
        // but disowning it from the tree should be enough to keep it from
        // appearing in the output.)
        pobj = libmei.getElementById(tuplet._parent);
        libmei.RemoveChild(pobj, tuplet);
        tuplet._parent = null;
    }
}  //$end

function ProcessLyric (lyricobj, objectPositions) {
    //$module(ExportProcessors.mss)
    /*
        We need to track initial, medial, and terminal lyrics. Sibelius
        only allows us to know the medial and terminal, so we store all the
        syllables in an array until we reach the end of the word, and then
        attach them to the notes.
    */
    styleparts = MSplitString(lyricobj.StyleId, '.');
    verse_id = styleparts[5];
    verse_id_arr = MSplitString(verse_id, false);
    verse_num = verse_id_arr[5];
    bar_num = lyricobj.ParentBar.BarNumber;
    staff_num = lyricobj.ParentBar.ParentStaff.StaffNum;
    voicenum = lyricobj.VoiceNumber;

    if (voicenum = 0)
    {
        // assign it to the first voice, since we don't have any notes in voice 0.
        voicenum = 1;
        warnings = Self._property:warnings;
        warnings.Push(utils.Format(_ObjectAssignedToAllVoicesWarning, bar_num, voicenum, 'Lyric object'));
    }

    lyricwords = Self._property:LyricWords;

    if (lyricwords.PropertyExists(staff_num) = False)
    {
        lyricwords[staff_num] = CreateDictionary();
    }

    lyricstaff = lyricwords[staff_num];

    if (lyricstaff.PropertyExists(voicenum) = False)
    {
        lyricstaff[voicenum] = CreateDictionary();
    }

    lyricvoice = lyricstaff[voicenum];

    if (lyricvoice.PropertyExists(verse_num) = False)
    {
        lyricvoice[verse_num] = CreateSparseArray();
    }

    if (lyricobj.SyllableType = MiddleOfWord)
    {
        lyricvoice[verse_num].Push(lyricobj);
        // we haven't reached the end of the word yet, so just return
        // and keep going.
        return null;
    }

    // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    // anything past here is in the EndOfWord condition.
    // this should return a sparse array containing the syllables of the word.
    lyricvoice[verse_num].Push(lyricobj);
    lyric_word = lyricvoice[verse_num];
    objects = objectPositions[voicenum];

    obj_id = null;
    obj = null;

    for j = 0 to lyric_word.Length
    {
        syl = lyric_word[j];

        verse = libmei.Verse();
        libmei.AddAttribute(verse, 'n', verse_num);
        sylel = libmei.Syl();
        libmei.SetText(sylel, syl.Text);
        libmei.AddChild(verse, sylel);

        if (j = 0)
        {
            libmei.AddAttribute(sylel, 'wordpos', 'i'); // 'initial'

            if (lyric_word.Length > 1)
            {
                libmei.AddAttribute(sylel, 'con', 'd');
            }
        }
        else
        {
            if (syl.SyllableType = EndOfWord)
            {
                libmei.AddAttribute(sylel, 'wordpos', 't'); // 'terminal'

                if (syl.NumNotes > 1)
                {
                    libmei.AddAttribute(sylel, 'con', 'u'); // 'underscore'
                }

            }
            else
            {
                libmei.AddAttribute(sylel, 'wordpos', 'm'); // medial
                libmei.AddAttribute(sylel, 'con', 'd');
            }
        }

        syltext = libmei.GetText(sylel);

        if (utils.Pos('_', syltext) > -1)
        {
            // Syllable elision. split this syllable element by underscore.
            syllables = MSplitString(syltext, '_');
            sylarray = CreateSparseArray();

            // reset the text of the first syllable element to the first half of the syllable.
            libmei.SetText(sylel, syllables[0]);
            libmei.AddAttribute(sylel, 'con', 'b');

            for s = 1 to syllables.Length
            {
                esyl = libmei.Syl();
                libmei.SetText(esyl, syllables[s]);
                libmei.AddChild(verse, esyl);
            }
        }

        obj = GetNoteObjectAtPosition(syl);

        if (obj != null)
        {
            name = libmei.GetName(obj);

            if (name = 'rest')
            {
                warnings = Self._property:warnings;
                warnings.Push(utils.Format(_ObjectIsOnAnIllogicalObject, bar_num, voicenum, 'Lyric', 'rest'));
            }

            if (name = 'chord')
            {
                warnings = Self._property:warnings;
                warnings.Push(utils.Format(_ObjectIsOnAnIllogicalObject, bar_num, voicenum, 'Lyric', 'chord'));
            }

            libmei.AddChild(obj, verse);
        }
        else
        {
            Log('Could not find note object for syl ' & syl);
        }
    }

    // now reset the syllable array for this voice
    lyricvoice[verse_num] = CreateSparseArray();
}  //$end

function ProcessSystemStaff (score) {
    //$module(ExportProcessors.mss)
    systf = score.SystemStaff;

    for each bar in systf
    {
        for each bobj in bar
        {
            switch (bobj.Type)
            {
                case ('SpecialBarline')
                {
                    spclbarlines = Self._property:SpecialBarlines;
                    if (spclbarlines.PropertyExists(bar.BarNumber) = False)
                    {
                        spclbarlines[bar.BarNumber] = CreateSparseArray();
                    }

                    spclbarlines[bar.BarNumber].Push(ConvertBarline(bobj.BarlineInternalType));
                }
                case ('SystemTextItem')
                {
                    if (bobj.OnNthBlankPage < 0)
                    {
                        ProcessFrontMatter(bobj);
                    }

                    systemtext = Self._property:SystemText;

                    if (systemtext.PropertyExists(bar.BarNumber) = False)
                    {
                        systemtext[bar.BarNumber] = CreateSparseArray();
                    }

                    systemtext[bar.BarNumber].Push(bobj);
                }
                case ('Graphic')
                {
                    Log('Found a graphic!');
                    Log('is object? ' & IsObject(bobj));
                }
                case ('RepeatTimeLine')
                {
                    RegisterVolta(bobj);
                }
            }
        }
    }
}  //$end

function ProcessFrontMatter (bobj) {
    //$module(ExportProcessors.mss)
    /*
        For example, if page 2 (0-indexed) is the first page of music,
        then 'OnNthPage' will be 2, but the system staff items for
        the first page of text will be -2, so 2 + (-2) = 0 + 1;
    */
    bar = bobj.ParentBar;
    text = '';

    pnum = (bar.OnNthPage + bobj.OnNthBlankPage) + 1;
    frontmatter = Self._property:FrontMatter;

    if (frontmatter.PropertyExists(pnum) = False)
    {
        pb = libmei.Pb();
        libmei.AddAttribute(pb, 'n', pnum);
        frontmatter[pnum] = CreateSparseArray(pb);
    }
    pagematter = frontmatter[pnum];

    text = GenerateFormattedString(bobj);
    frontmatter[pnum] = pagematter.Concat(text);

}  //$end

function RegisterVolta (bobj) {
    //$module(ExportProcessors.mss)
    voltabars = Self._property:VoltaBars;
    style = MSplitString(bobj.StyleId, '.');

    if (style[2] = 'repeat')
    {
        voltabars[bobj.ParentBar.BarNumber] = bobj;
    }
}  //$end

function ProcessVolta (mnum) {
    //$module(ExportProcessors.mss)
    voltabars = Self._property:VoltaBars;

    if (voltabars.PropertyExists(mnum))
    {
        voltaElement = libmei.Ending();

        Self._property:VoltaElement = voltaElement;

        voltaObject = voltabars[mnum];
        voltainfo = ConvertEndingValues(voltaObject.StyleId);

        libmei.AddAttribute(voltaElement, 'n', voltainfo[0]);
        libmei.AddAttribute(voltaElement, 'label', voltainfo[1]);
        libmei.AddAttribute(voltaElement, 'type', voltainfo[2]);

        if (voltaObject.EndBarNumber != mnum)
        {
            Self._property:ActiveVolta = voltaObject;
        }

        return voltaElement;
    }
    else
    {
        if (Self._property:ActiveVolta != null)
        {
            // we have an unresolved volta, so
            // we'll keep the previous parentElement
            // active.
            activeVolta = Self._property:ActiveVolta;
            voltaElement = Self._property:VoltaElement;

            // if the end bar is the current bar OR if the end
            // bar is the next bar, but the end position is 0, we're escaping the
            // volta the next time around.
            if ((activeVolta.EndBarNumber = mnum) or
                (activeVolta.EndBarNumber = (mnum + 1) and activeVolta.EndPosition = 0))
            {
                Self._property:ActiveVolta = null;
                Self._property:VoltaElement = null;
            }
            return null;
        }
    }

    return null;
}  //$end

function ProcessTremolo (bobj) {
    //$module(ExportProcessors.mss)
    if (bobj.DoubleTremolos = 0)
    {
        return null;
    }

    Log('Fingered tremolo: ' & bobj.DoubleTremolos);
    tremEl = libmei.FTrem();
    libmei.AddAttribute(tremEl, 'slash', bobj.DoubleTremolos);
    libmei.AddAttribute(tremEl, 'measperf')

} //$end

function ProcessSymbol (sobj) {
    //$module(ExportProcessors.mss)
    Log('symbol index: ' & sobj.Index & ' name: ' & sobj.Name);
    Log(sobj.VoiceNumber);
    voicenum = sobj.VoiceNumber;
    bar = sobj.ParentBar;

    if (voicenum = 0)
    {
        // assign it to the first voice, since we don't have any notes in voice/layer 0.
        sobj.VoiceNumber = 1;
        warnings = Self._property:warnings;
        warnings.Push(utils.Format(_ObjectAssignedToAllVoicesWarning, bar.BarNumber, voicenum, 'Symbol'));
    }

    switch (sobj.Index)
    {
        case ('32')
        {
            // trill
            trill = GenerateTrill(sobj);
            mlines = Self._property:MeasureObjects;
            mlines.Push(trill._id);
        }

        case ('36')
        {
            // inverted mordent
            mordent = libmei.Mordent();
            libmei.AddAttribute(mordent, 'form', 'inv');
            mordent = AddBarObjectInfoToElement(sobj, mordent);
            mlines = Self._property:MeasureObjects;
            mlines.Push(mordent._id);
        }

        case ('37')
        {
            // mordent
            mordent = libmei.Mordent();
            libmei.AddAttribute(mordent, 'form', 'norm');
            mordent = AddBarObjectInfoToElement(sobj, mordent);
            mlines = Self._property:MeasureObjects;
            mlines.Push(mordent._id);
        }

        case ('38')
        {
            // turn
            turn = libmei.Turn();
            libmei.AddAttribute(turn, 'form', 'norm');
            turn = AddBarObjectInfoToElement(sobj, turn);
            mlines = Self._property:MeasureObjects;
            mlines.Push(turn._id);
        }

        case ('39')
        {
            // inverted turn
            turn = libmei.Turn();
            libmei.AddAttribute(turn, 'form', 'inv');
            turn = AddBarObjectInfoToElement(sobj, turn);
            mlines = Self._property:MeasureObjects;
            mlines.Push(turn._id);
        }
        case ('52')
        {
            nobj = GetNoteObjectAtPosition(sobj);

            if (nobj != null)
            {
                artic = libmei.Artic();
                libmei.AddAttribute(artic, 'artic', 'heel');
                libmei.AddChild(nobj, artic);
            }
        }
        case ('53')
        {
            nobj = GetNoteObjectAtPosition(sobj);
            if (nobj != null)
            {
                artic = libmei.Artic();
                libmei.AddAttribute(artic, 'artic', 'heel');
                libmei.AddChild(nobj, artic);
            }

        }
        case ('54')
        {
            nobj = GetNoteObjectAtPosition(sobj);
            if (nobj != null)
            {
                artic = libmei.Artic();
                libmei.AddAttribute(artic, 'artic', 'toe');
                libmei.AddChild(nobj, artic);
            }

        }
        case ('55')
        {
            nobj = GetNoteObjectAtPosition(sobj);
            if (nobj != null)
            {
                artic = libmei.Artic();
                libmei.AddAttribute(artic, 'artic', 'toe');
                libmei.AddChild(nobj, artic);
            }

        }
        case ('160')
        {
            nobj = GetNoteObjectAtPosition(sobj);
            if (nobj != null)
            {
                artic = libmei.Artic();
                libmei.AddAttribute(artic, 'artic', 'stop');
                libmei.AddChild(nobj, artic);
            }
        }
        case ('162')
        {
            nobj = GetNoteObjectAtPosition(sobj);
            if (nobj != null)
            {
                artic = libmei.Artic();
                libmei.AddAttribute(artic, 'artic', 'open');
                libmei.AddChild(nobj, artic);
            }
        }
        case ('163')
        {
            nobj = GetNoteObjectAtPosition(sobj);
            if (nobj != null)
            {
                artic = libmei.Artic();
                libmei.AddAttribute(artic, 'artic', 'damp');
                libmei.AddChild(nobj, artic);
            }
        }
        case ('164')
        {
            nobj = GetNoteObjectAtPosition(sobj);
            if (nobj != null)
            {
                artic = libmei.Artic();
                libmei.AddAttribute(artic, 'artic', 'damp');
                libmei.AddChild(nobj, artic);
            }

        }
        case ('165')
        {
            nobj = GetNoteObjectAtPosition(sobj);
            if (nobj != null)
            {
                artic = libmei.Artic();
                libmei.AddAttribute(artic, 'artic', 'damp');
                libmei.AddChild(nobj, artic);
            }
        }
        case ('166')
        {
            nobj = GetNoteObjectAtPosition(sobj);
            if (nobj != null)
            {
                artic = libmei.Artic();
                libmei.AddAttribute(artic, 'artic', 'damp');
                libmei.AddChild(nobj, artic);
            }

        }
        case ('212')
        {
            nobj = GetNoteObjectAtPosition(sobj);
            if (nobj != null)
            {
                artic = libmei.Artic();
                libmei.AddAttribute(artic, 'artic', 'ten');
                libmei.AddAttribute(artic, 'place', 'above');
                libmei.AddChild(nobj, artic);
            }
        }
        case ('214')
        {
            nobj = GetNoteObjectAtPosition(sobj);

            if (nobj != null)
            {
                artic = libmei.Artic();
                libmei.AddAttribute(artic, 'artic', 'marc');
                libmei.AddAttribute(artic, 'place', 'above');
                libmei.AddChild(nobj, artic);
            }
        }
        case ('217')
        {
            // up-bow above
            nobj = GetNoteObjectAtPosition(sobj);

            if (nobj != null)
            {
                artic = libmei.Artic();
                libmei.AddAttribute(artic, 'artic', 'upbow');
                libmei.AddAttribute(artic, 'place', 'above');
                libmei.AddChild(nobj, artic);
            }
        }
        case ('218')
        {
            // down-bow above
            nobj = GetNoteObjectAtPosition(sobj);

            if (nobj != null)
            {
                artic = libmei.Artic();
                libmei.AddAttribute(artic, 'artic', 'dnbow');
                libmei.AddAttribute(artic, 'place', 'above');
                libmei.AddChild(nobj, artic);
            }

        }
        case ('233')
        {
            // up-bow below
            nobj = GetNoteObjectAtPosition(sobj);

            if (nobj != null)
            {
                artic = libmei.Artic();
                libmei.AddAttribute(artic, 'artic', 'upbow');
                libmei.AddAttribute(artic, 'place', 'below');
                libmei.AddChild(nobj, artic);
            }
        }
        case ('234')
        {
            // down-bow below
            nobj = GetNoteObjectAtPosition(sobj);

            if (nobj != null)
            {
                artic = libmei.Artic();
                libmei.AddAttribute(artic, 'artic', 'dnbow');
                libmei.AddAttribute(artic, 'place', 'below');
                libmei.AddChild(nobj, artic);
            }
            else
            {
                warnings = Self._property:warnings;
                warnings.Push(utils.Format(_ObjectCouldNotFindAttachment, bar.BarNumber, voicenum, sobj.Name));
            }
        }
        case ('240')
        {
            // double staccato
            return null;
        }
        case ('241')
        {
            // triple staccato
            return null;
        }
        case ('242')
        {
            // quadruple staccato
            return null;
        }
        case ('243')
        {
            // snap
            nobj = GetNoteObjectAtPosition(sobj);

            if (nobj != null)
            {
                artic = libmei.Artic();
                libmei.AddAttributeValue(artic, 'artic', 'snap');
                libmei.AddChild(nobj, artic);
            }
            else
            {
                warnings = Self._property:warnings;
                warnings.Push(utils.Format(_ObjectCouldNotFindAttachment, bar.BarNumber, voicenum, sobj.Name));
            }
        }
        case ('480')
        {
            //scoop
            nobj = GetNoteObjectAtPosition(sobj);
            if (nobj != null)
            {
                artic = libmei.Artic();
                libmei.AddAttributeValue(artic, 'artic', 'scoop');
                libmei.AddChild(nobj, artic);
            }
        }
        case ('481')
        {
            //fall
            nobj = GetNoteObjectAtPosition(sobj);
            if (nobj != null)
            {
                artic = libmei.Artic();
                libmei.AddAttributeValue(artic, 'artic', 'fall');
                libmei.AddChild(nobj, artic);
            }

        }
        case ('490')
        {
            nobj = GetNoteObjectAtPosition(sobj);

            if (nobj != null)
            {
                artic = libmei.Artic();
                libmei.AddAttributeValue(artic, 'artic', 'fingernail');
                libmei.AddChild(nobj, artic);
            }
        }
        case ('494')
        {
            //doit
            nobj = GetNoteObjectAtPosition(sobj);
            if (nobj != null)
            {
                artic = libmei.Artic();
                libmei.AddAttributeValue(artic, 'artic', 'doit');
                libmei.AddChild(nobj, artic);
            }

        }
        case ('495')
        {
            //plop
            nobj = GetNoteObjectAtPosition(sobj);

            if (nobj != null)
            {
                artic = libmei.Artic();
                libmei.AddAttributeValue(artic, 'artic', 'plop');
                libmei.AddChild(nobj, artic);
            }

        }

    }
}  //$end

function ProcessScore () {
    //$module(ExportProcessors.mss)
    // processors are a bit like a workflow manager -- they orchestrate the
    // generators, which in turn use the converters to convert specific values from sibelius
    // to MEI.
    score = Self._property:ActiveScore;

    mei = libmei.Mei();
    libmei.setDocumentRoot(mei);

    libmei.AddAttribute(mei, 'xmlns:xlink', 'http://www.w3.org/1999/xlink');
    libmei.AddAttribute(mei, 'xmlns', 'http://www.music-encoding.org/ns/mei');
    libmei.AddAttribute(mei, 'meiversion', '3.0.0');

    header = sibmei2.GenerateMEIHeader();
    libmei.AddChild(mei, header);

    music = sibmei2.GenerateMEIMusic();
    libmei.AddChild(mei, music);

}  //$end

function ProcessBeam (bobj, layer) {
    //$module(ExportProcessors.mss)
    ret = null;

    if (bobj.Duration < 256)
    {
        // if this object is an eighth note but is not beamed, and if the
        // active beam is set, null out the active beam and return null.
        if (bobj.Beam = NoBeam and layer._property:ActiveBeamId != null)
        {
            layer._property:ActiveBeamId = null;
            return ret;
        }

        /*
            It's possible that Sibelius records a 'continue beam' at the start
            of a beamed group. Visually, this doesn't look out of place if the previous
            note was a quarter note or higher.

            The first check we do is if the note has a 'continue beam' attribute and
            the previous note has a duration higher than 256 (quarter) then we probably have
            a false negative (i.e., there is the start of a beam, but it isn't necessarily
            encoded correctly).
        */
        falseNegative = False;
        next_obj = bobj.NextItem(bobj.VoiceNumber, 'NoteRest');

        if ((bobj.Beam = ContinueBeam or bobj.Beam = SingleBeam) and layer._property:ActiveBeamId = null)
        {
            // by all accounts this should be a beamed note, but we'll need to double-check.
            prev_obj = bobj.PreviousItem(bobj.VoiceNumber, 'NoteRest');

            if (prev_obj != null and (prev_obj.Duration >= 256 or prev_obj.NoteCount = 0))
            {
                falseNegative = True;
            }
        }

        if (next_obj != null and (bobj.Beam = StartBeam or falseNegative = True) and next_obj.Beam = ContinueBeam and next_obj.Duration < 256)
        {
            // if:
            //  - we're not at the end of the bar
            //  - we have a start beam
            //  - the next note is a continue beam
            //  - the next note is a beamable duration (safeguard against quarter and longer
            //    notes with Beam = ContinueBeam, which for some reason can actually occur)
            beam = libmei.Beam();
            layer._property:ActiveBeamId = beam._id;

            // return the beam so that we can add it to the tree.
            ret = beam;
        }

        if (layer._property:ActiveBeamId != null and (bobj.Beam = ContinueBeam or bobj.Beam = SingleBeam))
        {
            beamid = layer._property:ActiveBeamId;
            beam = libmei.getElementById(beamid);
            ret = beam;
        }
    }
    else
    {
        if (layer._property:ActiveBeamId != null)
        {
            // this is a break in any active beam, so register it as such.
            layer._property:ActiveBeamId = null;
        }
    }

    return ret;
}  //$end

function ProcessTuplet (bobj, meielement, layer) {
    //$module(ExportProcessors.mss)
    if (bobj.ParentTupletIfAny = null)
    {
        return null;
    }

    if (layer._property:ActiveTupletId = null)
    {
        tupletObject = bobj.ParentTupletIfAny;

        tuplet = libmei.Tuplet();

        layer._property:ActiveTupletObject = tupletObject;
        layer._property:ActiveTupletId = tuplet._id;

        if (libmei.GetName(meielement) = 'beam')
        {
            // get the first child
            startid = meielement.children[0];
        }
        else
        {
            startid = meielement._id;
        }

        libmei.AddAttribute(tuplet, 'startid', '#' & startid);
        libmei.AddAttribute(tuplet, 'num', tupletObject.Left);
        libmei.AddAttribute(tuplet, 'numbase', tupletObject.Right);

        tupletStyle = tupletObject.Style;

        switch (tupletStyle)
        {
            case(TupletNoNumber)
            {
                libmei.AddAttribute(tuplet, 'dur.visible', 'false');
            }
            case(TupletLeft)
            {
                libmei.AddAttribute(tuplet, 'num.format', 'count');
            }
            case(TupletLeftRight)
            {
                libmei.AddAttribute(tuplet, 'num.format', 'ratio');
            }
        }

        tupletBracket = tupletObject.Bracket;

        switch(tupletBracket)
        {
            case(TupletBracketOff)
            {
                libmei.AddAttribute(tuplet, 'bracket.visible', 'false');
            }
        }

        return tuplet;
    }
    else
    {
        tid = layer._property:ActiveTupletId;
        t = libmei.getElementById(tid);

        if (IsLastNoteInTuplet(bobj))
        {
            libmei.AddAttribute(t, 'endid', '#' & meielement._id);
            layer._property:ActiveTupletObject = null;
            layer._property:ActiveTupletId = null;
        }

        return t;
    }
}  //$end

function ShiftTupletToTupletSpan (tuplet, layer) {
    //$module(ExportProcessors.mss)
    /*
        Shifts the tuplet object to a tupletSpan object. This is
        useful if we need to define a tuplet outside of a hierarchy;
        for example, if a tuplet is only on part of a beam group.

        A tupletSpan supports many of the same attributes as a tuplet
        object, so we can copy the attributes verbatim. Functionally,
        it should behave the same way as a tuplet, except that it
        takes no child elements and the parent element is the measure,
        not the layer. These two things get handled higher up the
        processing chain, however, so we don't have to worry about them here.
    */

    tupletSpan = libmei.TupletSpan();
    libmei.SetAttributes(tupletSpan, tuplet.attrs);
    tupletSpan._property:AddedToMeasure = False;

    layer._property:ActiveTupletId = tupletSpan._id;

    if (tuplet._parent != null)
    {
        // if the tuplet has already been added to the tree,
        // remove it now. (Unfortunately, we can't delete the object,
        // but disowning it from the tree should be enough to keep it from
        // appearing in the output.)
        pobj = libmei.getElementById(tuplet._parent);
        libmei.RemoveChild(pobj, tuplet);
        tuplet._parent = null;
    }
}  //$end

function ProcessLyric (lyricobj, objectPositions) {
    //$module(ExportProcessors.mss)
    /*
        We need to track initial, medial, and terminal lyrics. Sibelius
        only allows us to know the medial and terminal, so we store all the
        syllables in an array until we reach the end of the word, and then
        attach them to the notes.
    */
    styleparts = MSplitString(lyricobj.StyleId, '.');
    verse_id = styleparts[5];
    verse_id_arr = MSplitString(verse_id, false);
    verse_num = verse_id_arr[5];
    bar_num = lyricobj.ParentBar.BarNumber;
    staff_num = lyricobj.ParentBar.ParentStaff.StaffNum;
    voicenum = lyricobj.VoiceNumber;

    if (voicenum = 0)
    {
        // assign it to the first voice, since we don't have any notes in voice 0.
        voicenum = 1;
        warnings = Self._property:warnings;
        warnings.Push(utils.Format(_ObjectAssignedToAllVoicesWarning, bar_num, voicenum, 'Lyric object'));
    }

    lyricwords = Self._property:LyricWords;

    if (lyricwords.PropertyExists(staff_num) = False)
    {
        lyricwords[staff_num] = CreateDictionary();
    }

    lyricstaff = lyricwords[staff_num];

    if (lyricstaff.PropertyExists(voicenum) = False)
    {
        lyricstaff[voicenum] = CreateDictionary();
    }

    lyricvoice = lyricstaff[voicenum];

    if (lyricvoice.PropertyExists(verse_num) = False)
    {
        lyricvoice[verse_num] = CreateSparseArray();
    }

    if (lyricobj.SyllableType = MiddleOfWord)
    {
        lyricvoice[verse_num].Push(lyricobj);
        // we haven't reached the end of the word yet, so just return
        // and keep going.
        return null;
    }

    // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    // anything past here is in the EndOfWord condition.
    // this should return a sparse array containing the syllables of the word.
    lyricvoice[verse_num].Push(lyricobj);
    lyric_word = lyricvoice[verse_num];
    objects = objectPositions[voicenum];

    obj_id = null;
    obj = null;

    for j = 0 to lyric_word.Length
    {
        syl = lyric_word[j];

        verse = libmei.Verse();
        libmei.AddAttribute(verse, 'n', verse_num);
        sylel = libmei.Syl();
        libmei.SetText(sylel, syl.Text);
        libmei.AddChild(verse, sylel);

        if (j = 0)
        {
            libmei.AddAttribute(sylel, 'wordpos', 'i'); // 'initial'

            if (lyric_word.Length > 1)
            {
                libmei.AddAttribute(sylel, 'con', 'd');
            }
        }
        else
        {
            if (syl.SyllableType = EndOfWord)
            {
                libmei.AddAttribute(sylel, 'wordpos', 't'); // 'terminal'

                if (syl.NumNotes > 1)
                {
                    libmei.AddAttribute(sylel, 'con', 'u'); // 'underscore'
                }

            }
            else
            {
                libmei.AddAttribute(sylel, 'wordpos', 'm'); // medial
                libmei.AddAttribute(sylel, 'con', 'd');
            }
        }

        syltext = libmei.GetText(sylel);

        if (utils.Pos('_', syltext) > -1)
        {
            // Syllable elision. split this syllable element by underscore.
            syllables = MSplitString(syltext, '_');
            sylarray = CreateSparseArray();

            // reset the text of the first syllable element to the first half of the syllable.
            libmei.SetText(sylel, syllables[0]);
            libmei.AddAttribute(sylel, 'con', 'b');

            for s = 1 to syllables.Length
            {
                esyl = libmei.Syl();
                libmei.SetText(esyl, syllables[s]);
                libmei.AddChild(verse, esyl);
            }
        }

        obj = GetNoteObjectAtPosition(syl);

        if (obj != null)
        {
            name = libmei.GetName(obj);

            if (name = 'rest')
            {
                warnings = Self._property:warnings;
                warnings.Push(utils.Format(_ObjectIsOnAnIllogicalObject, bar_num, voicenum, 'Lyric', 'rest'));
            }

            if (name = 'chord')
            {
                warnings = Self._property:warnings;
                warnings.Push(utils.Format(_ObjectIsOnAnIllogicalObject, bar_num, voicenum, 'Lyric', 'chord'));
            }

            libmei.AddChild(obj, verse);
        }
        else
        {
            Log('Could not find note object for syl ' & syl);
        }
    }

    // now reset the syllable array for this voice
    lyricvoice[verse_num] = CreateSparseArray();
}  //$end

function ProcessSystemStaff (score) {
    //$module(ExportProcessors.mss)
    systf = score.SystemStaff;

    for each bar in systf
    {
        for each bobj in bar
        {
            switch (bobj.Type)
            {
                case ('SpecialBarline')
                {
                    spclbarlines = Self._property:SpecialBarlines;
                    if (spclbarlines.PropertyExists(bar.BarNumber) = False)
                    {
                        spclbarlines[bar.BarNumber] = CreateSparseArray();
                    }

                    spclbarlines[bar.BarNumber].Push(ConvertBarline(bobj.BarlineInternalType));
                }
                case ('SystemTextItem')
                {
                    if (bobj.OnNthBlankPage < 0)
                    {
                        ProcessFrontMatter(bobj);
                    }

                    systemtext = Self._property:SystemText;

                    if (systemtext.PropertyExists(bar.BarNumber) = False)
                    {
                        systemtext[bar.BarNumber] = CreateSparseArray();
                    }

                    systemtext[bar.BarNumber].Push(bobj);
                }
                case ('Graphic')
                {
                    Log('Found a graphic!');
                    Log('is object? ' & IsObject(bobj));
                }
                case ('RepeatTimeLine')
                {
                    RegisterVolta(bobj);
                }
            }
        }
    }
}  //$end

function ProcessFrontMatter (bobj) {
    //$module(ExportProcessors.mss)
    /*
        For example, if page 2 (0-indexed) is the first page of music,
        then 'OnNthPage' will be 2, but the system staff items for
        the first page of text will be -2, so 2 + (-2) = 0 + 1;
    */
    bar = bobj.ParentBar;
    text = '';

    pnum = (bar.OnNthPage + bobj.OnNthBlankPage) + 1;
    frontmatter = Self._property:FrontMatter;

    if (frontmatter.PropertyExists(pnum) = False)
    {
        pb = libmei.Pb();
        libmei.AddAttribute(pb, 'n', pnum);
        frontmatter[pnum] = CreateSparseArray(pb);
    }
    pagematter = frontmatter[pnum];

    text = GenerateFormattedString(bobj);
    frontmatter[pnum] = pagematter.Concat(text);

}  //$end

function RegisterVolta (bobj) {
    //$module(ExportProcessors.mss)
    voltabars = Self._property:VoltaBars;
    style = MSplitString(bobj.StyleId, '.');

    if (style[2] = 'repeat')
    {
        voltabars[bobj.ParentBar.BarNumber] = bobj;
    }
}  //$end

function ProcessVolta (mnum) {
    //$module(ExportProcessors.mss)
    voltabars = Self._property:VoltaBars;

    if (voltabars.PropertyExists(mnum))
    {
        voltaElement = libmei.Ending();

        Self._property:VoltaElement = voltaElement;

        voltaObject = voltabars[mnum];
        voltainfo = ConvertEndingValues(voltaObject.StyleId);

        libmei.AddAttribute(voltaElement, 'n', voltainfo[0]);
        libmei.AddAttribute(voltaElement, 'label', voltainfo[1]);
        libmei.AddAttribute(voltaElement, 'type', voltainfo[2]);

        if (voltaObject.EndBarNumber != mnum)
        {
            Self._property:ActiveVolta = voltaObject;
        }

        return voltaElement;
    }
    else
    {
        if (Self._property:ActiveVolta != null)
        {
            // we have an unresolved volta, so
            // we'll keep the previous parentElement
            // active.
            activeVolta = Self._property:ActiveVolta;
            voltaElement = Self._property:VoltaElement;

            // if the end bar is the current bar OR if the end
            // bar is the next bar, but the end position is 0, we're escaping the
            // volta the next time around.
            if ((activeVolta.EndBarNumber = mnum) or
                (activeVolta.EndBarNumber = (mnum + 1) and activeVolta.EndPosition = 0))
            {
                Self._property:ActiveVolta = null;
                Self._property:VoltaElement = null;
            }
            return null;
        }
    }

    return null;
}  //$end

function ProcessTremolo (bobj) {
    //$module(ExportProcessors.mss)
    if (bobj.DoubleTremolos = 0)
    {
        return null;
    }

    Log('Fingered tremolo: ' & bobj.DoubleTremolos);
    tremEl = libmei.FTrem();
    libmei.AddAttribute(tremEl, 'slash', bobj.DoubleTremolos);
    libmei.AddAttribute(tremEl, 'measperf')

} //$end

function ProcessSymbol (sobj) {
    //$module(ExportProcessors.mss)
    // Log('symbol index: ' & sobj.Index & ' name: ' & sobj.Name);
    // Log(sobj.VoiceNumber);
    voicenum = sobj.VoiceNumber;
    bar = sobj.ParentBar;

    if (voicenum = 0)
    {
        // assign it to the first voice, since we don't have any notes in voice/layer 0.
        sobj.VoiceNumber = 1;
        warnings = Self._property:warnings;
        warnings.Push(utils.Format(_ObjectAssignedToAllVoicesWarning, bar.BarNumber, voicenum, 'Symbol'));
    }

    switch (sobj.Index)
    {
        case ('32')
        {
            // trill
            trill = GenerateTrill(sobj);
            mlines = Self._property:MeasureObjects;
            mlines.Push(trill._id);
        }

        case ('36')
        {
            // inverted mordent
            mordent = libmei.Mordent();
            libmei.AddAttribute(mordent, 'form', 'inv');
            mlines = Self._property:MeasureObjects;
            mlines.Push(mordent._id);
        }

        case ('37')
        {
            // mordent
            mordent = libmei.Mordent();
            libmei.AddAttribute(mordent, 'form', 'norm');
            mlines = Self._property:MeasureObjects;
            mlines.Push(mordent._id);
        }

        case ('38')
        {
            // turn
            turn = libmei.Turn();
            libmei.AddAttribute(turn, 'form', 'norm');
            turn = AddBarObjectInfoToElement(sobj, turn);
            mlines = Self._property:MeasureObjects;
            mlines.Push(turn._id);
        }

        case ('39')
        {
            // inverted turn
            turn = libmei.Turn();
            libmei.AddAttribute(turn, 'form', 'inv');
            turn = AddBarObjectInfoToElement(sobj, turn);
            mlines = Self._property:MeasureObjects;
            mlines.Push(turn._id);
        }
        case ('217')
        {
            // up-bow above
            nobj = GetNoteObjectAtPosition(sobj);

            if (nobj != null)
            {
                artic = libmei.Artic();
                libmei.AddAttribute(artic, 'artic', 'upbow');
                libmei.AddAttribute(artic, 'place', 'above');
                libmei.AddChild(nobj, artic);
            }
        }
        case ('218')
        {
            // down-bow above
            nobj = GetNoteObjectAtPosition(sobj);

            if (nobj != null)
            {
                artic = libmei.Artic();
                libmei.AddAttribute(artic, 'artic', 'dnbow');
                libmei.AddAttribute(artic, 'place', 'above');
                libmei.AddChild(nobj, artic);
            }

        }
        case ('233')
        {
            // up-bow below
            nobj = GetNoteObjectAtPosition(sobj);

            if (nobj != null)
            {
                artic = libmei.Artic();
                libmei.AddAttribute(artic, 'artic', 'upbow');
                libmei.AddAttribute(artic, 'place', 'below');
                libmei.AddChild(nobj, artic);
            }
        }
        case ('234')
        {
            // down-bow below
            nobj = GetNoteObjectAtPosition(sobj);

            if (nobj != null)
            {
                artic = libmei.Artic();
                libmei.AddAttribute(artic, 'artic', 'dnbow');
                libmei.AddAttribute(artic, 'place', 'below');
                libmei.AddChild(nobj, artic);
            }
            else
            {
                warnings = Self._property:warnings;
                warnings.Push(utils.Format(_ObjectCouldNotFindAttachment, bar.BarNumber, voicenum, sobj.Name));
            }
        }
        case ('242')
        {
            // triple staccato
            return null;
        }
        case ('243')
        {
            // snap
            nobj = GetNoteObjectAtPosition(sobj);

            if (nobj != null)
            {
                libmei.AddAttributeValue(nobj, 'artic', 'snap');
            }
            else
            {
                warnings = Self._property:warnings;
                warnings.Push(utils.Format(_ObjectCouldNotFindAttachment, bar.BarNumber, voicenum, sobj.Name));
            }
        }
    }
}  //$end


Dropped outlines until zoom 14 and added 'U.S.' Forest Service lands temporarily, until new PR removing the US prefix is merged.

Map { font-directory: url("./fonts"); }

#lands {
	text-face-name: 'Noto Sans Regular';
    text-name:'[loc_nm]';
    text-size: 12;
    text-placement:line;
    text-fill:black;
    text-min-padding:1;
   	text-wrap-width:100;
	polygon-opacity:1;
	[zoom >= 14] {
    	line-width:1;
    	line-color:black;
	}
	[adminLevel='state'] {
    	polygon-fill:#f781bf;
	}
	[adminLevel='county'] {
    	polygon-fill:#ffff33;
	}
	[adminLevel='local'] {
    	polygon-fill:#377eb8;
	}
	[adminAgency='Bureau of Land Management'][type!='wilderness area'] {
		polygon-fill: #e41a1c;
	}
	[adminAgency='Bureau of Reclamation'][type!='wilderness area'] {
		polygon-fill: #984ea3;
	}
	[adminAgency='Forest Service'][type!='wilderness area'] {
		polygon-fill: #4daf4a;
	}
	[adminAgency='U.S. Forest Service'][type!='wilderness area'] {
        polygon-fill: #4daf4a;
    }
	[adminAgency='National Park Service'][type!='wilderness area'] {
		polygon-fill: #a65628;
	}
	[adminAgency='Department of Defense']{
		polygon-fill: #ff7f00;
	}
	[adminAgency='Army Corps of Engineers'] {
		polygon-fill: #ff7f00;
	}
	[adminAgency='Army'] {
        polygon-fill: #ff7f00;
    }
	[adminAgency='Air Force'] {
        polygon-fill: #ff7f00;
    }
	[adminAgency='Navy'] {
        polygon-fill: #ff7f00;
    }
	[adminAgency='Marine Corps'] {
        polygon-fill: #ff7f00;
    }
	[adminAgency='Coast Guard']{
        polygon-fill: #ff7f00;
    }
	[adminAgency='Department of Energy']{
		polygon-fill: #984ea3;
	}
	[adminAgency='Department of Agriculture']{
		polygon-fill: #984ea3;
	}
	[adminAgency='Fish & Wildlife Service'][type!='wilderness area'] {
		polygon-fill: #0489B1;
	}
	[adminAgency='National Aeronautics and Space Administration']{
		polygon-fill: #984ea3;
	}
	[adminAgency='International Boundary & Water Commission']{
		polygon-fill: #984ea3;
	}
	[adminAgency='Tennessee Valley Authority']{
		polygon-fill: #984ea3;
	}
	[adminAgency='Bureau of Indian Affairs']{
		polygon-fill: #984ea3;
	}
	[adminAgency='Department of the Interior'][type!='wilderness area'] {
		polygon-fill: #984ea3;
	}
	[adminAgency='National Center for Atmospheric Research']{
		polygon-fill: #984ea3;
	}
	[adminAgency='National Institute of Standards and Technology']{
		polygon-fill: #984ea3;
	}
	[adminAgency='Department of Justice']{
        polygon-fill: #984ea3;
    }
	[adminAgency='Department of Commerce']{
        polygon-fill: #984ea3;
    }
	[adminAgency='Department of Veterans Affairs']{
        polygon-fill: #984ea3;
    }
	[adminAgency='Federal Aviation Administration']{
        polygon-fill: #984ea3;
    }
	[adminAgency='Bureau of Indian Affairs'] {
        polygon-fill: #984ea3;
    }
	[adminAgency='Bonneville Power Administration'] {
        polygon-fill: #984ea3;
    }
	[adminAgency='Federal Government'] {
        polygon-fill: #984ea3;
    }
	[adminAgency='Federal Highway Administration'] {
        polygon-fill: #984ea3;
    }
	[adminAgency='Fire Administration'] {
        polygon-fill: #984ea3;
    }
	[adminAgency='National Marine Fisheries Service'] {
        polygon-fill: #984ea3;
    }
	[adminAgency='Natural Resources Conservation Service'] {
        polygon-fill: #984ea3;
    }
	[adminAgency='Smithsonian'] {
        polygon-fill: #984ea3;
    }
	[adminAgency='Smithsonian Environmental Research Center'] {
        polygon-fill: #984ea3;
    }
}

Map { font-directory: url("./fonts"); }

#lands {
	text-face-name: 'Noto Sans Regular';
    text-name:'[loc_nm]';
    text-size: 12;
    text-placement:line;
    text-fill:black;
    text-min-padding:1;
   	text-wrap-width:100;
	polygon-opacity:1;
    line-width:1;
    line-color:black;
	[adminLevel='state'] {
    	polygon-fill:#f781bf;
	}
	[adminLevel='county'] {
    	polygon-fill:#ffff33;
	}
	[adminLevel='local'] {
    	polygon-fill:#377eb8;
	}
	[adminAgency='Bureau of Land Management'][type!='wilderness area'] {
		polygon-fill: #e41a1c;
	}
	[adminAgency='Bureau of Reclamation'][type!='wilderness area'] {
		polygon-fill: #984ea3;
	}
	[adminAgency='Forest Service'][type!='wilderness area'] {
		polygon-fill: #4daf4a;
	}
	[adminAgency='National Park Service'][type!='wilderness area'] {
		polygon-fill: #a65628;
	}
	[adminAgency='Department of Defense']{
		polygon-fill: #ff7f00;
	}
	[adminAgency='Army Corps of Engineers'] {
		polygon-fill: #ff7f00;
	}
	[adminAgency='Army'] {
        polygon-fill: #ff7f00;
    }
	[adminAgency='Air Force'] {
        polygon-fill: #ff7f00;
    }
	[adminAgency='Navy'] {
        polygon-fill: #ff7f00;
    }
	[adminAgency='Marine Corps'] {
        polygon-fill: #ff7f00;
    }
	[adminAgency='Coast Guard']{
        polygon-fill: #ff7f00;
    }
	[adminAgency='Department of Energy']{
		polygon-fill: #984ea3;
	}
	[adminAgency='Department of Agriculture']{
		polygon-fill: #984ea3;
	}
	[adminAgency='Fish & Wildlife Service'][type!='wilderness area'] {
		polygon-fill: #0489B1;
	}
	[adminAgency='National Aeronautics and Space Administration']{
		polygon-fill: #984ea3;
	}
	[adminAgency='International Boundary & Water Commission']{
		polygon-fill: #984ea3;
	}
	[adminAgency='Tennessee Valley Authority']{
		polygon-fill: #984ea3;
	}
	[adminAgency='Bureau of Indian Affairs']{
		polygon-fill: #984ea3;
	}
	[adminAgency='Department of the Interior'][type!='wilderness area'] {
		polygon-fill: #984ea3;
	}
	[adminAgency='National Center for Atmospheric Research']{
		polygon-fill: #984ea3;
	}
	[adminAgency='National Institute of Standards and Technology']{
		polygon-fill: #984ea3;
	}
	[adminAgency='Department of Justice']{
        polygon-fill: #984ea3;
    }
	[adminAgency='Department of Commerce']{
        polygon-fill: #984ea3;
    }
	[adminAgency='Department of Veterans Affairs']{
        polygon-fill: #984ea3;
    }
	[adminAgency='Federal Aviation Administration']{
        polygon-fill: #984ea3;
    }
	[adminAgency='Bureau of Indian Affairs'] {
        polygon-fill: #984ea3;
    }
	[adminAgency='Bonneville Power Administration'] {
        polygon-fill: #984ea3;
    }
	[adminAgency='Federal Government'] {
        polygon-fill: #984ea3;
    }
	[adminAgency='Federal Highway Administration'] {
        polygon-fill: #984ea3;
    }
	[adminAgency='Fire Administration'] {
        polygon-fill: #984ea3;
    }
	[adminAgency='National Marine Fisheries Service'] {
        polygon-fill: #984ea3;
    }
	[adminAgency='Natural Resources Conservation Service'] {
        polygon-fill: #984ea3;
    }
	[adminAgency='Smithsonian'] {
        polygon-fill: #984ea3;
    }
	[adminAgency='Smithsonian Environmental Research Center'] {
        polygon-fill: #984ea3;
    }
}


Update roads.mss

Update roads.mss

/* ==================================================================
   ROAD & RAIL LINES
/* ================================================================== */

/* At lower zoomlevels, just show major automobile routes: motorways
and trunks. */

/* At higher levels the roads become more complex. We're now showing
more than just automobile routes - railways, footways, and cycleways
come in as well.

/* Road width variables that are used in road & bridge styles */
@rdz11_maj: 0.3; @rdz11_med: 0.2; @rdz11_min: 0.1;
@rdz12_maj: 0.5; @rdz12_med: 0.4; @rdz12_min: 0.2;
@rdz13_maj: 1;   @rdz13_med: 0.8; @rdz13_min: 0.5;
@rdz14_maj: 2;   @rdz14_med: 1.5; @rdz14_min: 1;
@rdz15_maj: 4;   @rdz15_med: 3;   @rdz15_min: 2;
@rdz16_maj: 8;   @rdz16_med: 6;   @rdz16_min: 4;
@rdz17_maj: 16;  @rdz17_med: 12;  @rdz17_min: 8;
@rdz18_maj: 32;  @rdz18_med: 24;  @rdz18_min: 16;

/* ---- Casing ----------------------------------------------- */

#roads_high::outline[zoom>=11][zoom<=20],
#tunnel[render='1_outline'][zoom>=11][zoom<=20],
#bridge[render='1_outline'][zoom>=11][zoom<=20]{
  /* -- colors & styles -- */
  line-cap: round;
  [bridge=1],
  [tunnel=1] {
    line-cap: butt;
  }
  line-join: round;
  line-color: @standard_case;
  [bridge=1] { line-color: @standard_case * 0.8; }
  [type='motorway'],
  [type='motorway_link'] {
    line-color: @motorway_case;
    [bridge=1] { line-color: @motorway_case * 0.8; }
  }
  [type='trunk'],
  [type='trunk_link'] {
    line-color: @trunk_case;
    [bridge=1] { line-color: @trunk_case * 0.8; }
  }
  [type='primary'],
  [type='primary_link'] {
    line-color: @primary_case;
    [bridge=1] { line-color: @primary_case * 0.8; }
  }
  [type='secondary'],
  [type='secondary_link'] {
    line-color: @secondary_case;
    [bridge=1] { line-color: @secondary_case * 0.8; }
  }
  [stylegroup='railway'] {
    line-color: fadeout(@land,50%);
    [bridge=1] { line-color: @secondary_case * 0.8; }
  }
  [tunnel=1] { line-dasharray: 3,3; }
  /* -- widths -- */
  [zoom=11] {
    [stylegroup='motorway'] { line-width: @rdz11_maj; }
    [stylegroup='mainroad'] { line-width: @rdz11_med; }
    [stylegroup='minorroad']{ line-width: @rdz11_min; }
    /* No minor bridges yet */
    [stylegroup='service']  { line-width: 0; }
    [stylegroup='noauto']   { line-width: @rdz11_maj;  }
    [stylegroup='railway']  { line-width: 0; }
  }
  [zoom=12] {
    [stylegroup='motorway'] { line-width: @rdz12_maj ; }
    [stylegroup='mainroad'] { line-width: @rdz12_med; }
    [stylegroup='minorroad']{ line-width: @rdz12_min; }
    /* No minor bridges yet */
    [stylegroup='service']  { line-width: 0; }
    [stylegroup='noauto']   { line-width: @rdz12_maj;  }
    [stylegroup='railway']  { line-width: 0; }
  }
  [zoom=13] {
    [stylegroup='motorway'] { line-width: @rdz13_maj; }
    [stylegroup='mainroad'] { line-width: @rdz13_med; }
    [stylegroup='minorroad']{ line-width: @rdz13_min; }
    /* No minor bridges yet */
    [stylegroup='service']  { line-width: 0; }
    [stylegroup='noauto']   { line-width: @rdz13_maj;  }
    [stylegroup='railway']  { line-width: 0; }
  }
  [zoom=14] {
    [stylegroup='motorway'] { line-width: @rdz14_maj; }
    [stylegroup='mainroad'] { line-width: @rdz14_med; }
    [stylegroup='minorroad']{ line-width: @rdz14_min; }
    /* No minor bridges yet */
    [stylegroup='service']  { line-width: 0; }
    [stylegroup='noauto']   { line-width: @rdz14_med;  }
    [stylegroup='railway']  { line-width: 0; }
  }
  [zoom=15] {
    [stylegroup='motorway'] { line-width: @rdz15_maj ; }
    [stylegroup='mainroad'] { line-width: @rdz15_med  }
    [stylegroup='minorroad']{ line-width: @rdz15_min ; }
    [stylegroup='service']  { line-width: @rdz15_min / 3 + 2; }
    [stylegroup='noauto']   { line-width: @rdz15_maj;  }
    [stylegroup='railway']  { line-width: 1.5 + 2; }
  }
  [zoom=16] {
    [stylegroup='motorway'] { line-width: @rdz16_maj ;}
    [stylegroup='mainroad'] { line-width: @rdz16_med; }
    [stylegroup='minorroad']{ line-width: @rdz16_min; }
    [stylegroup='service']  { line-width: @rdz16_min / 3 + 2; }
    [stylegroup='noauto']   { line-width: @rdz16_maj; }
    [stylegroup='railway']  { line-width: 2 + 2; }
  }
  [zoom>=17] {
    [stylegroup='motorway'] { line-width: @rdz17_maj; }
    [stylegroup='mainroad'] { line-width: @rdz17_med; }
    [stylegroup='minorroad']{ line-width: @rdz17_min; }
    [stylegroup='service']  { line-width: @rdz17_min / 3 + 2; }
    [stylegroup='noauto']   { line-width: @rdz17_maj; }
    [stylegroup='railway']  { line-width: 3 + 4; } // 3 + 4
  }
  [zoom>=18] {
    [stylegroup='motorway'] { line-width: @rdz18_maj; }
    [stylegroup='mainroad'] { line-width: @rdz18_med; }
    [stylegroup='minorroad']{ line-width: @rdz18_min; }
    [stylegroup='service']  { line-width: @rdz18_min / 3 + 3.5; }
    [stylegroup='noauto']   { line-width: @rdz18_maj; }
    [stylegroup='railway']  { line-width: 4 + 6; }
  }
}

#roads_high[zoom>=11][zoom<=20],
#tunnel[render='3_inline'][zoom>=11][zoom<=20],
#bridge[render='3_inline'][zoom>=11][zoom<=20]{
  /* -- colors & styles -- */
  line-color: @standard_fill;
  [type='motorway'],
  [type='motorway_link'] {
    line-color: @motorway_fill;
    [tunnel=1] { line-color: lighten(@motorway_fill, 10%); }
  }
  [type='trunk'],
  [type='trunk_link'] {
    line-color: @trunk_fill;
    [tunnel=1] { line-color: lighten(@trunk_fill, 10%); }
  }
  [type='primary'],
  [type='primary_link'] {
    line-color: @primary_fill;
    [tunnel=1] { line-color: lighten(@primary_fill, 10%); }
  }
  [type='secondary'],
  [type='secondary_link'] {
    line-color: @secondary_fill;
    [tunnel=1] { line-color: lighten(@secondary_fill, 10%); }
  }
  [stylegroup='railway'] {
    line-color: @rail_line;
    line-dasharray: 1,1;
    [type='subway'] { line-opacity: 0.67; }
    [zoom>15] { line-dasharray: 1,2; }
  }
  [stylegroup='noauto'],
  [stylegroup='service'],
  [stylegroup='minorroad'] {
    line-width: 0;
    line-color: @black;
  }
  [stylegroup='service'],
  [stylegroup='minorroad'],
  [stylegroup='mainroad'],
  [stylegroup='motorway'] {
    line-cap: round;
    line-join: round;
  }
  [stylegroup='noauto'] {
    line-join: round;
  }
  [tunnel=1] {
    line-cap: butt;
  }
  /* -- widths -- */
  [zoom=11] {
    [stylegroup='motorway'] { line-width: @rdz11_maj; }
    [stylegroup='mainroad'] { line-width: @rdz11_med; }
    [stylegroup='minorroad']{ line-width: 0; }
    [stylegroup='noauto']   { line-width: @rdz11_maj ; line-color: @black; }
    [stylegroup='railway']  { line-width: 0.2; }
  }
  [zoom=12] {
    [stylegroup='motorway'] { line-width: @rdz12_maj; }
    [stylegroup='mainroad'] { line-width: @rdz12_med; }
    [stylegroup='minorroad']{ line-width: 0; }
   [stylegroup='noauto']   { line-width: @rdz12_maj ; line-color: @black; }
    [stylegroup='railway']  { line-width: 0.4; }
  }
  [zoom=13] {
    [stylegroup='motorway'] { line-width: @rdz13_maj; }
    [stylegroup='mainroad'] { line-width: @rdz13_med; }
    [stylegroup='minorroad']{ line-width: @rdz13_min; }
    [stylegroup='service']  { line-width: @rdz13_min / 3; }
    [stylegroup='noauto']   { line-width: @rdz13_maj ; line-color: @black;}
    [stylegroup='railway']  { line-width: 0.8; }
  }
  [zoom=14] {
    [stylegroup='motorway'] { line-width: @rdz14_maj; }
    [stylegroup='mainroad'] { line-width: @rdz14_med; }
    [stylegroup='minorroad']{ line-width: @rdz14_min; }
    [stylegroup='service']  { line-width: @rdz14_min / 3; }
    [stylegroup='noauto']   { line-width: @rdz14_maj; line-color: @black; }
    [stylegroup='railway']  { line-width: 1; }
  }
  [zoom=15] {
    [stylegroup='motorway'] { line-width: @rdz15_maj; }
    [stylegroup='mainroad'] { line-width: @rdz15_med; }
    [stylegroup='minorroad']{ line-width: @rdz15_min; }
    [stylegroup='service']  { line-width: @rdz15_min / 3; }
    [stylegroup='noauto']   { line-width: @rdz15_maj; line-color: @black; }
    [stylegroup='railway']  { line-width: 1.5; }
  }
  [zoom=16] {
    [stylegroup='motorway'] { line-width: @rdz16_maj; }
    [stylegroup='mainroad'] { line-width: @rdz16_med; }
    [stylegroup='minorroad']{ line-width: @rdz16_min; }
    [stylegroup='service']  { line-width: @rdz16_min / 3; }
    [stylegroup='noauto']   { line-width: @rdz16_maj ; line-color: @black;}
    [stylegroup='railway']  { line-width: 2; }
  }
  [zoom=17] {
    [stylegroup='motorway'] { line-width: @rdz17_maj; }
    [stylegroup='mainroad'] { line-width: @rdz17_med; }
    [stylegroup='minorroad']{ line-width: @rdz17_min; }
    [stylegroup='service']  { line-width: @rdz17_min / 3; }
    [stylegroup='noauto']   { line-width: @rdz17_maj ; line-color: @black;}
    [stylegroup='railway']  { line-width: 3; }
  }
  [zoom>=18] {
    [stylegroup='motorway'] { line-width: @rdz18_maj; }
    [stylegroup='mainroad'] { line-width: @rdz18_med; }
    [stylegroup='minorroad']{ line-width: @rdz18_min; }
    [stylegroup='service']  { line-width: @rdz18_min / 2; }
    [stylegroup='noauto']   { line-width: @rdz18_maj  ; line-color: @black; }
    [stylegroup='railway']  { line-width: 4; }
  }
}

/* ---- Bridge fill for dashed lines -------------------------------- */
#tunnel[render='2_line'][zoom>=14][zoom<=20],
#bridge[render='2_line'][zoom>=14][zoom<=20]{
  /* -- colors & styles -- */
  [stylegroup='noauto'] {
    line-color: @land;
    line-width: 0;
    line-join: round;
  }
  [stylegroup='railway'] {
    line-color: @land;
    line-join: round;
  }
  /* -- widths -- */
  [zoom=14] {
    [stylegroup='noauto']   { line-width: @rdz14_min / 4 + 1; }
    [stylegroup='railway']  { line-width: 1 + 1; }
  }
  [zoom=15] {
    [stylegroup='noauto']   { line-width: @rdz15_min / 4 + 1; }
    [stylegroup='railway']  { line-width: 1.5 + 1; }
  }
  [zoom=16] {
    [stylegroup='noauto']   { line-width: @rdz16_min / 4 + 1; }
    [stylegroup='railway']  { line-width: 2 + 1; }
  }
  [zoom=17] {
    [stylegroup='noauto']   { line-width: @rdz17_min / 4 + 3; }
    [stylegroup='railway']  { line-width: 3 + 2; }
  }
  [zoom>=18] {
    [stylegroup='noauto']   { line-width: @rdz18_min / 4 + 3; }
    [stylegroup='railway']  { line-width: 4 + 3; }
  }
}

/* ---- Turning Circles --------------------------------------------- */
#turning_circle_case[zoom>=14] {
  marker-fill:@standard_fill;
  marker-line-color:@standard_case;
  marker-line-width:2;
  marker-allow-overlap:true;
}
#turning_circle_fill[zoom>=14] {
  marker-fill:@standard_fill;
  marker-line-width:0;
  marker-line-opacity:0;
  marker-allow-overlap:true;
}
#turning_circle_case,
#turning_circle_fill {
  [zoom=14] { marker-width:@rdz14_min * 1.1; }
  [zoom=15] { marker-width:@rdz15_min * 1.1; }
  [zoom=16] { marker-width:@rdz16_min * 1.1; }
  [zoom=17] { marker-width:@rdz17_min * 1.1; }
  [zoom>=18] { marker-width:@rdz18_min * 1.1; }
}

/* ================================================================== */
/* AEROWAYS
/* ================================================================== */

#aeroway[zoom>9] {
  line-color:@aeroway;
  line-cap:butt;
  line-join:miter;
  [type='runway'] {
    [zoom=10]{ line-width:1; }
    [zoom=11]{ line-width:2; }
    [zoom=12]{ line-width:3; }
    [zoom=13]{ line-width:5; }
    [zoom=14]{ line-width:7; }
    [zoom=15]{ line-width:11; }
    [zoom=16]{ line-width:15; }
    [zoom=17]{ line-width:19; }
    [zoom>17]{ line-width:23; }
  }
  [type='taxiway'] {
    [zoom=10]{ line-width:0.2; }
    [zoom=11]{ line-width:0.2; }
    [zoom=12]{ line-width:0.2; }
    [zoom=13]{ line-width:1; }
    [zoom=14]{ line-width:1.5; }
    [zoom=15]{ line-width:2; }
    [zoom=16]{ line-width:3; }
    [zoom=17]{ line-width:4; }
    [zoom>17]{ line-width:5; }
  }
}

/******************************************************************* */

/* ==================================================================
   ROAD & RAIL LINES
/* ================================================================== */

/* At lower zoomlevels, just show major automobile routes: motorways
and trunks. */

/* At higher levels the roads become more complex. We're now showing
more than just automobile routes - railways, footways, and cycleways
come in as well.

/* Road width variables that are used in road & bridge styles */
@rdz11_maj: 0.3; @rdz11_med: 0.2; @rdz11_min: 0.1;
@rdz12_maj: 0.5; @rdz12_med: 0.4; @rdz12_min: 0.2;
@rdz13_maj: 1;   @rdz13_med: 0.8; @rdz13_min: 0.5;
@rdz14_maj: 2;   @rdz14_med: 1.5; @rdz14_min: 1;
@rdz15_maj: 4;   @rdz15_med: 3;   @rdz15_min: 2;
@rdz16_maj: 8;   @rdz16_med: 6;   @rdz16_min: 4;
@rdz17_maj: 16;  @rdz17_med: 12;  @rdz17_min: 8;
@rdz18_maj: 32;  @rdz18_med: 24;  @rdz18_min: 16;

/* ---- Casing ----------------------------------------------- */

#roads_high::outline[zoom>=11][zoom<=20],
#tunnel[render='1_outline'][zoom>=11][zoom<=20],
#bridge[render='1_outline'][zoom>=11][zoom<=20]{
  /* -- colors & styles -- */
  line-cap: round;
  [bridge=1],
  [tunnel=1] {
    line-cap: butt;
  }
  line-join: round;
  line-color: @standard_case;
  [bridge=1] { line-color: @standard_case * 0.8; }
  [type='motorway'],
  [type='motorway_link'] {
    line-color: @motorway_case;
    [bridge=1] { line-color: @motorway_case * 0.8; }
  }
  [type='trunk'],
  [type='trunk_link'] {
    line-color: @trunk_case;
    [bridge=1] { line-color: @trunk_case * 0.8; }
  }
  [type='primary'],
  [type='primary_link'] {
    line-color: @primary_case;
    [bridge=1] { line-color: @primary_case * 0.8; }
  }
  [type='secondary'],
  [type='secondary_link'] {
    line-color: @secondary_case;
    [bridge=1] { line-color: @secondary_case * 0.8; }
  }
  [stylegroup='railway'] {
    line-color: fadeout(@land,50%);
    [bridge=1] { line-color: @secondary_case * 0.8; }
  }
  [tunnel=1] { line-dasharray: 3,3; }
  /* -- widths -- */
  [zoom=11] {
    [stylegroup='motorway'] { line-width: @rdz11_maj; }
    [stylegroup='mainroad'] { line-width: @rdz11_med; }
    [stylegroup='minorroad']{ line-width: @rdz11_min; }
    /* No minor bridges yet */
    [stylegroup='service']  { line-width: 0; }
    [stylegroup='noauto']   { line-width: @rdz11_maj;  }
    [stylegroup='railway']  { line-width: 0; }
  }
  [zoom=12] {
    [stylegroup='motorway'] { line-width: @rdz12_maj ; }
    [stylegroup='mainroad'] { line-width: @rdz12_med; }
    [stylegroup='minorroad']{ line-width: @rdz12_min; }
    /* No minor bridges yet */
    [stylegroup='service']  { line-width: 0; }
    [stylegroup='noauto']   { line-width: @rdz12_maj;  }
    [stylegroup='railway']  { line-width: 0; }
  }
  [zoom=13] {
    [stylegroup='motorway'] { line-width: @rdz13_maj; }
    [stylegroup='mainroad'] { line-width: @rdz13_med; }
    [stylegroup='minorroad']{ line-width: @rdz13_min; }
    /* No minor bridges yet */
    [stylegroup='service']  { line-width: 0; }
    [stylegroup='noauto']   { line-width: @rdz13_maj;  }
    [stylegroup='railway']  { line-width: 0; }
  }
  [zoom=14] {
    [stylegroup='motorway'] { line-width: @rdz14_maj; }
    [stylegroup='mainroad'] { line-width: @rdz14_med; }
    [stylegroup='minorroad']{ line-width: @rdz14_min; }
    /* No minor bridges yet */
    [stylegroup='service']  { line-width: 0; }
    [stylegroup='noauto']   { line-width: @rdz14_med;  }
    [stylegroup='railway']  { line-width: 0; }
  }
  [zoom=15] {
    [stylegroup='motorway'] { line-width: @rdz15_maj ; }
    [stylegroup='mainroad'] { line-width: @rdz15_med  }
    [stylegroup='minorroad']{ line-width: @rdz15_min ; }
    [stylegroup='service']  { line-width: @rdz15_min / 3 + 2; }
    [stylegroup='noauto']   { line-width: @rdz15_maj;  }
    [stylegroup='railway']  { line-width: 1.5 + 2; }
  }
  [zoom=16] {
    [stylegroup='motorway'] { line-width: @rdz16_maj ;}
    [stylegroup='mainroad'] { line-width: @rdz16_med; }
    [stylegroup='minorroad']{ line-width: @rdz16_min; }
    [stylegroup='service']  { line-width: @rdz16_min / 3 + 2; }
    [stylegroup='noauto']   { line-width: @rdz16_maj; }
    [stylegroup='railway']  { line-width: 2 + 2; }
  }
  [zoom>=17] {
    [stylegroup='motorway'] { line-width: @rdz17_maj; }
    [stylegroup='mainroad'] { line-width: @rdz17_med; }
    [stylegroup='minorroad']{ line-width: @rdz17_min; }
    [stylegroup='service']  { line-width: @rdz17_min / 3 + 2; }
    [stylegroup='noauto']   { line-width: @rdz17_maj; }
    [stylegroup='railway']  { line-width: 3 + 4; } // 3 + 4
  }
  [zoom>=18] {
    [stylegroup='motorway'] { line-width: @rdz18_maj; }
    [stylegroup='mainroad'] { line-width: @rdz18_med; }
    [stylegroup='minorroad']{ line-width: @rdz18_min; }
    [stylegroup='service']  { line-width: @rdz18_min / 3 + 3.5; }
    [stylegroup='noauto']   { line-width: @rdz18_maj; }
    [stylegroup='railway']  { line-width: 4 + 6; }
  }
}

#roads_high[zoom>=11][zoom<=20],
#tunnel[render='3_inline'][zoom>=11][zoom<=20],
#bridge[render='3_inline'][zoom>=11][zoom<=20]{
  /* -- colors & styles -- */
  line-color: @standard_fill;
  [type='motorway'],
  [type='motorway_link'] {
    line-color: @motorway_fill;
    [tunnel=1] { line-color: lighten(@motorway_fill, 10%); }
  }
  [type='trunk'],
  [type='trunk_link'] {
    line-color: @trunk_fill;
    [tunnel=1] { line-color: lighten(@trunk_fill, 10%); }
  }
  [type='primary'],
  [type='primary_link'] {
    line-color: @primary_fill;
    [tunnel=1] { line-color: lighten(@primary_fill, 10%); }
  }
  [type='secondary'],
  [type='secondary_link'] {
    line-color: @secondary_fill;
    [tunnel=1] { line-color: lighten(@secondary_fill, 10%); }
  }
  [stylegroup='railway'] {
    line-color: @rail_line;
    line-dasharray: 1,1;
    [type='subway'] { line-opacity: 0.67; }
    [zoom>15] { line-dasharray: 1,2; }
  }
  [stylegroup='noauto'],
  [stylegroup='service'],
  [stylegroup='minorroad'] {
    line-width: 0;
  }
  [stylegroup='service'],
  [stylegroup='minorroad'],
  [stylegroup='mainroad'],
  [stylegroup='motorway'] {
    line-cap: round;
    line-join: round;
  }
  [stylegroup='noauto'] {
    line-join: round;
  }
  [tunnel=1] {
    line-cap: butt;
  }
  /* -- widths -- */
  [zoom=11] {
    [stylegroup='motorway'] { line-width: @rdz11_maj; }
    [stylegroup='mainroad'] { line-width: @rdz11_med; }
    [stylegroup='minorroad']{ line-width: 0; }
    [stylegroup='noauto']   { line-width: @rdz11_maj ; line-color: @brown; }
    [stylegroup='railway']  { line-width: 0.2; }
  }
  [zoom=12] {
    [stylegroup='motorway'] { line-width: @rdz12_maj; }
    [stylegroup='mainroad'] { line-width: @rdz12_med; }
    [stylegroup='minorroad']{ line-width: 0; }
   [stylegroup='noauto']   { line-width: @rdz12_maj ; line-color: @brown; }
    [stylegroup='railway']  { line-width: 0.4; }
  }
  [zoom=13] {
    [stylegroup='motorway'] { line-width: @rdz13_maj; }
    [stylegroup='mainroad'] { line-width: @rdz13_med; }
    [stylegroup='minorroad']{ line-width: @rdz13_min; }
    [stylegroup='service']  { line-width: @rdz13_min / 3; }
    [stylegroup='noauto']   { line-width: @rdz13_maj ; line-color: @brown;}
    [stylegroup='railway']  { line-width: 0.8; }
  }
  [zoom=14] {
    [stylegroup='motorway'] { line-width: @rdz14_maj; }
    [stylegroup='mainroad'] { line-width: @rdz14_med; }
    [stylegroup='minorroad']{ line-width: @rdz14_min; }
    [stylegroup='service']  { line-width: @rdz14_min / 3; }
    [stylegroup='noauto']   { line-width: @rdz14_maj; line-color: @brown; }
    [stylegroup='railway']  { line-width: 1; }
  }
  [zoom=15] {
    [stylegroup='motorway'] { line-width: @rdz15_maj; }
    [stylegroup='mainroad'] { line-width: @rdz15_med; }
    [stylegroup='minorroad']{ line-width: @rdz15_min; }
    [stylegroup='service']  { line-width: @rdz15_min / 3; }
    [stylegroup='noauto']   { line-width: @rdz15_maj; line-color: @brown; }
    [stylegroup='railway']  { line-width: 1.5; }
  }
  [zoom=16] {
    [stylegroup='motorway'] { line-width: @rdz16_maj; }
    [stylegroup='mainroad'] { line-width: @rdz16_med; }
    [stylegroup='minorroad']{ line-width: @rdz16_min; }
    [stylegroup='service']  { line-width: @rdz16_min / 3; }
    [stylegroup='noauto']   { line-width: @rdz16_maj ; line-color: @brown;}
    [stylegroup='railway']  { line-width: 2; }
  }
  [zoom=17] {
    [stylegroup='motorway'] { line-width: @rdz17_maj; }
    [stylegroup='mainroad'] { line-width: @rdz17_med; }
    [stylegroup='minorroad']{ line-width: @rdz17_min; }
    [stylegroup='service']  { line-width: @rdz17_min / 3; }
    [stylegroup='noauto']   { line-width: @rdz17_maj ; line-color: @brown;}
    [stylegroup='railway']  { line-width: 3; }
  }
  [zoom>=18] {
    [stylegroup='motorway'] { line-width: @rdz18_maj; }
    [stylegroup='mainroad'] { line-width: @rdz18_med; }
    [stylegroup='minorroad']{ line-width: @rdz18_min; }
    [stylegroup='service']  { line-width: @rdz18_min / 2; }
    [stylegroup='noauto']   { line-width: @rdz18_maj  ; line-color: @brown; }
    [stylegroup='railway']  { line-width: 4; }
  }
}

/* ---- Bridge fill for dashed lines -------------------------------- */
#tunnel[render='2_line'][zoom>=14][zoom<=20],
#bridge[render='2_line'][zoom>=14][zoom<=20]{
  /* -- colors & styles -- */
  [stylegroup='noauto'] {
    line-color: @land;
    line-width: 0;
    line-join: round;
  }
  [stylegroup='railway'] {
    line-color: @land;
    line-join: round;
  }
  /* -- widths -- */
  [zoom=14] {
    [stylegroup='noauto']   { line-width: @rdz14_min / 4 + 1; }
    [stylegroup='railway']  { line-width: 1 + 1; }
  }
  [zoom=15] {
    [stylegroup='noauto']   { line-width: @rdz15_min / 4 + 1; }
    [stylegroup='railway']  { line-width: 1.5 + 1; }
  }
  [zoom=16] {
    [stylegroup='noauto']   { line-width: @rdz16_min / 4 + 1; }
    [stylegroup='railway']  { line-width: 2 + 1; }
  }
  [zoom=17] {
    [stylegroup='noauto']   { line-width: @rdz17_min / 4 + 3; }
    [stylegroup='railway']  { line-width: 3 + 2; }
  }
  [zoom>=18] {
    [stylegroup='noauto']   { line-width: @rdz18_min / 4 + 3; }
    [stylegroup='railway']  { line-width: 4 + 3; }
  }
}

/* ---- Turning Circles --------------------------------------------- */
#turning_circle_case[zoom>=14] {
  marker-fill:@standard_fill;
  marker-line-color:@standard_case;
  marker-line-width:2;
  marker-allow-overlap:true;
}
#turning_circle_fill[zoom>=14] {
  marker-fill:@standard_fill;
  marker-line-width:0;
  marker-line-opacity:0;
  marker-allow-overlap:true;
}
#turning_circle_case,
#turning_circle_fill {
  [zoom=14] { marker-width:@rdz14_min * 1.1; }
  [zoom=15] { marker-width:@rdz15_min * 1.1; }
  [zoom=16] { marker-width:@rdz16_min * 1.1; }
  [zoom=17] { marker-width:@rdz17_min * 1.1; }
  [zoom>=18] { marker-width:@rdz18_min * 1.1; }
}

/* ================================================================== */
/* AEROWAYS
/* ================================================================== */

#aeroway[zoom>9] {
  line-color:@aeroway;
  line-cap:butt;
  line-join:miter;
  [type='runway'] {
    [zoom=10]{ line-width:1; }
    [zoom=11]{ line-width:2; }
    [zoom=12]{ line-width:3; }
    [zoom=13]{ line-width:5; }
    [zoom=14]{ line-width:7; }
    [zoom=15]{ line-width:11; }
    [zoom=16]{ line-width:15; }
    [zoom=17]{ line-width:19; }
    [zoom>17]{ line-width:23; }
  }
  [type='taxiway'] {
    [zoom=10]{ line-width:0.2; }
    [zoom=11]{ line-width:0.2; }
    [zoom=12]{ line-width:0.2; }
    [zoom=13]{ line-width:1; }
    [zoom=14]{ line-width:1.5; }
    [zoom=15]{ line-width:2; }
    [zoom=16]{ line-width:3; }
    [zoom=17]{ line-width:4; }
    [zoom>17]{ line-width:5; }
  }
}

/******************************************************************* */