<?xml version="1.0" encoding="UTF-8"?>
<div xmlns="http://www.tei-c.org/ns/1.0" xml:id="learn_encodeCastListTable" resp="or:odd_SPIT1_wtm or:odd_JENS1_cpy" ana="audEncoder audRemediator">
    <head>Encode Cast Lists Contained by Tables in Semi-Diplomatic Transcriptions</head>
    
    <p>This documentation is intended for experienced encoders. It presupposes that you are comfortable using CSS and CSS Flex, and that you are familiar with LEMDO’s practice for encoding cast lists in semi-diplomatic transcriptions. If you do not yet feel confident in these skills, read through each hyperlink in the prior reading section of this documentation.</p>
    
    <div xml:id="learn_encodeCastListTable_prior">
        <head>Prior Reading</head>
        
        <list rend="bulleted">
            <item>For encoding standard tables, see <ptr target="doc:learn_critParatextTables"/>.</item>
            <item>For the basics of encoding cast lists, see <ptr target="doc:learn_OScastList"/></item>
            <item>For cast lists that appear on title pages, see <ptr target="doc:learn_encodeTitlePage#learn_encodeTitlePage_specialCases2"/></item>
            <item>For an introduction to CSS and CSS Flex, see <ptr target="doc:learn_encodeStyleAdvanced"/></item>        
        </list>
    </div>
    
    <div xml:id="learn_encodeCastListTable_rationale">
        <head>Rationale</head>
        
        <p>In some early print publications, cast lists appear inside of a table. These tables vary in size, shape, and form, making it difficult to capture them with standard CSS. Instead, we use CSS Flex to truthfully encode and accurately render cast list tables.</p>
        
        <p>We encode cast lists differently depending on where they are located in the playbook. Most cast list tables appear on the play’s title page, but others can appear on their own page or at the end of the play text. This documentation will demonstrate how to encode the cast list table itself. If your cast list table is located on the title page, please see <ptr target="doc:learn_encodeTitlePage#learn_encodeTitlePage_specialCases2"/> to nest the table within the title page. If your table is located anywhere else, please see <ptr target="doc:learn_OScastList"/> to encode a typical cast list.</p>
    </div>
    
    <div xml:id="learn_encodeCastListTable_table">
        <head>Practice: Encode the Table</head>
        
        <p>We encode tables according to the following pattern:
            
            <egXML xmlns="http://www.tei-c.org/ns/Examples" valid="false">
                <table>
                    <row>
                        <cell/>
                    </row>
                </table>
            </egXML>
            
            To encode a cast list table, you will apply CSS and CSS Flex to this pattern. Style the elements in the hierarchical order they appear: first <gi>table</gi>, then <gi>row</gi>, and finally <gi>cell</gi>. Include as many <gi>row</gi> and <gi>cell</gi> elements as you need to accurately capture all the rows and columns of your table’s mise-en-page. To learn more about the basic encoding for a table, see <ptr target="doc:learn_critParatextTables"/>.
        </p>
        
        <p>Begin by adding CSS values to the <gi>table</gi> element. Using the <att>style</att> attribute, place two CSS values on <gi>table</gi>: <val>display: block;</val> and <val>width: 100%;</val>. These two values ensure that the table appears on its own line, and that it fills the available width of the page. Your completed <gi>table</gi> element should look like this:
            
            <egXML xmlns="http://www.tei-c.org/ns/Examples" valid="false">
                <table style="display: block; width: 100%;"></table>
            </egXML>
        </p>
        
        <p>After encoding <gi>table</gi>, apply the following CSS styling to each <gi>row</gi> element:
            
            <list rend="bulleted">
                <item><val>display: flex;</val> to define <gi>row</gi> as a flex container. This value establishes a specialized environment for its direct children (in this case, <gi>cell</gi>), which can be aligned, spaced, and resized as needed.</item>
                <item><val>flex-direction: row;</val> to align your flex content horizontally.</item>
                <item>(Optional) <val>min-height:</val> with a numerical value to set the minimum vertical space that each cell must take up. You may wish to use this if you have an empty row that needs to be a certain size.</item>
            </list>
        </p>
        
        <p>Then, apply the following CSS styling to each <gi>cell</gi> element:
        
            <list rend="bulleted">
                <item><val>display: flex;</val> to define <gi>cell</gi> as a flex item. This means that each cell can move around independently within the <gi>row</gi> element.</item>
                <item><val>flex-direction: row;</val> to align your flex content horizontally.</item>
                <item><val>align-items: center;</val> to align your flex content in the middle of the cell.</item>
                <item><val>flex: 1;</val> to allow your flex items to grow and shrink to fill available space as needed.</item>
                <item>(Optional) <val>padding:</val> with up to four numerical values to add space inside the cell between its border and its content. You may wish to add padding if you need to indent your text or create space away from the edges of the cell.</item>
            </list>
        </p>
        
        <p>When you finish styling the table, your encoding for one row should look like this (if it includes the optional padding):
            
            <egXML xmlns="http://www.tei-c.org/ns/Examples" valid="false">
                <table style="display: block; width: 100%;">
                    
                    <row style="display: flex; flex-direction: row; min-height: 6em;">
                        
                        <cell style="display: flex; flex-direction: row; align-items: center; flex: 1; padding: 0.4em 0.3em 0.4em 0.6em;"></cell>
                    
                    </row>
                </table>
            </egXML>
        </p>
    </div>
    
    <div xml:id="learn_encodeCastListTable_castList">
        <head>Practice: Style <gi>castList</gi>, <gi>castGroup</gi>, and <gi>castItem</gi></head>
        
        <p>Now that you have encoded your table, you can use it as a guide to style your cast list.</p>
        
        <p>Place a <gi>castList</gi> element inside each <gi>cell</gi>. <gi>castList</gi> contains three children in the following order:
            
            <list rend="numbered">
                <item>A <gi>castGroup</gi> element with a child <gi>castItem</gi>. Encode one <gi>castItem</gi> for each role and wrap the character’s name in the <gi>role</gi> element.</item>
                <item>A <gi>metamark</gi> element with the } bracket (character) in the text node. If your cast list contains a vertical line instead, you can use the | (pipe) character.</item>
                <item>A second <gi>castGroup</gi> with a child <gi>roleDesc</gi>. In the text node of <gi>roleDesc</gi>, include any casting notes (such as <q>For one man</q>).</item>
            </list>
            
            Before adding any styling, your cast list for one cell should look like this:
            
            <egXML xmlns="http://www.tei-c.org/ns/Examples" valid="false">
                <cell>
                    <castList>
                        <castGroup>
                            <castItem><role>Ambidexter</role></castItem>
                            <castItem><role>Triall.</role></castItem>
                        </castGroup>
                        <metamark>}</metamark>
                        <castGroup>
                            <roleDesc>For one man.</roleDesc>
                        </castGroup>
                    </castList>
                </cell>
            </egXML>
        </p> 
        
        <p>Generally, the styling for <gi>castList</gi>, <gi>castGroup</gi>, and <gi>castItem</gi> is consistent across plays. Apply the following styling to your cast list, ignoring (for now) the <gi>metamark</gi> and second <gi>castGroup</gi> elements:
            
            <egXML xmlns="http://www.tei-c.org/ns/Examples" valid="false">
                
                <castList style="display: flex; flex-direction: row; align-items: center; flex: 1; min-width: 0;">
                    <castGroup style="display: flex; flex-direction: column; justify-content: space-evenly; flex: 1; min-width: 0;">
                        <castItem style="display: block;"><role style="display: block; white-space: nowrap; line-height: 1.55em;">Ambidexter</role></castItem>
                        <castItem style="display: block;"><role style="display: block; white-space: nowrap; line-height: 1.55em;">Triall.</role></castItem>
                    </castGroup>
                    <metamark>}</metamark>
                    <castGroup>
                        <roleDesc>For one man.</roleDesc>
                    </castGroup>
                </castList>
            </egXML>
            
            This styling defines the cast list itself as a flex row (items will be stacked horizontally), but the list of names as a flex column (items will be stacked vertically). It also ensures that names don’t wrap and that all content is evenly spaced. If your table requires more specific placements, you can add <val>padding</val> to the first <gi>castGroup</gi> element.
        </p>
    </div>
    
    <div xml:id="learn_encodeCastListTable_metamark">
        <head>Practice: Style <gi>metamark</gi></head>
        
        <p>The curly bracket that groups a set of roles is encoded as a <gi>metamark</gi> element with the } character in the text node. To reproduce the stretched bracket used in many early print publications, we use the CSS value <val>transform</val> to scale the bracket along both the X and Y axes. Apply the following styling to your <gi>metamark</gi> element, keeping in mind the specific needs of your play’s cast list table:
            
            <list rend="bulleted">
                <item><val>display: flex;</val></item>
                <item><val>align-items: center;</val></item>
                <item><val>transform: scaleX(0) scaleY(0);</val>. The value 0 means that the bracket will be scaled 0 times its own size along the X and Y axes (so, not scaled at all). You want to change this number to something that better fits your particular cast list table. For example, <val>scaleX(3) scaleY(10)</val> would scale your bracket three times its width and ten times its height. You can always tweak your CSS using inspector view once your file builds on the website, so don’t worry about being exactly correct the first time.</item>
                <item><val>transform-origin: left center;</val> to anchor the scaling to the left edge so the bracket grows rightward without shifting its position.</item>
                <item><val>align-self: stretch;</val> to ensure the bracket spans the full height of its flex container, matching the height of the role list beside it.</item>
                <item><val>width: 2em; min-width: 2em;</val> to reserve space in the flex layout for the bracket before scaling is applied. You will likely not need to change these values.</item>
                <item>(Optional) <val>margin:</val> with up to four numerical values to move your bracket left, right, up, or down. You may not recognize that you need this value until after your initial CSS builds on the website, so keep it in mind when tweaking your encoding.</item>
            </list>
        
        </p>
    </div>
    
    <div xml:id="learn_encodeCastListTable_roleDesc">
        <head>Practice: Style <gi>roleDesc</gi></head>
        
        <p>The casting note is encoded in a <gi>roleDesc</gi> element. It must be wrapped in its own <gi>castGroup</gi> element, rather than placed directly inside the first <gi>castGroup</gi>, so that it can be independently styled with CSS Flex. Both <gi>castGroup</gi> and <gi>roleDesc</gi> require their own CSS styling.</p>
        
        <p>Begin by applying the following styling to your second <gi>castGroup</gi> element:
            
            <list rend="bulleted">
                <item><val>display: flex;</val></item>
                <item><val>align-items: center;</val></item>
                <item><val>align-self: stretch;</val></item>
                <item><val>padding-left: 3.5em;</val>. This value pushes the casting note away from the bracket so it doesn’t overlap. Although 3.5em is a standard value that works for most cast list tables, you may need to adjust it depending on the mise-en-page of your specific playbook.</item>
            </list>
            
            These values ensure that the casting note is vertically centered along the right side of the bracket.</p>
        
        <p>Next, apply the following styling to your <gi>roleDesc</gi> element:
            
            <list rend="bulleted">
                <item><val>display: block;</val></item>
                <item><val>white-space: nowrap;</val></item>
                <item><val>align-self: center;</val></item>
            </list>
            
            These values ensure that the text of the casting note appears on its own line, doesn’t wrap, and aligns itself to the centre of the space.
        </p>
    </div>
    
    <div xml:id="learn_encodeCastListTable_example">
        <head>Example: One Row</head>
        
        <p>This is a complete example of a single <gi>row</gi> with two cells that has been fully encoded and correctly styled using CSS and CSS Flex. You will need to repeat this pattern for each row in your cast list table, using as many <gi>cell</gi> elements as you need to accurately capture the table in your playbook.
            
            <egXML xmlns="http://www.tei-c.org/ns/Examples" valid="false">
                
                <row style="display: flex; flex-direction: row; min-height: 6em;">
                    
                    <cell style="display: flex; flex-direction: row; align-items: center; flex: 1; padding: 0.4em 0.3em 0.4em 0.6em;">
                        <castList style="display: flex; flex-direction: row; align-items: center; flex: 1; min-width: 0;">
                            <castGroup style="display: flex; flex-direction: column; justify-content: space-evenly; flex: 1; min-width: 0; padding-right: 0.2em;">
                                <castItem style="display: block;"><role style="display: block; white-space: nowrap; line-height: 1.55em;">Knight,</role></castItem>
                                <castItem style="display: block;"><role style="display: block; white-space: nowrap; line-height: 1.55em;">Snuf.</role></castItem>
                                <castItem style="display: block;"><role style="display: block; white-space: nowrap; line-height: 1.55em;">small habilitic.</role></castItem>
                                <castItem style="display: block;"><role style="display: block; white-space: nowrap; line-height: 1.55em;">Proof.</role></castItem>
                                <castItem style="display: block;"><role style="display: block; white-space: nowrap; line-height: 1.55em;">Execution.</role></castItem>
                                <castItem style="display: block;"><role style="display: block; white-space: nowrap; line-height: 1.55em;">Attendance.</role></castItem>
                                <castItem style="display: block;"><role style="display: block; white-space: nowrap; line-height: 1.55em;">second Lord.</role></castItem>
                            </castGroup>
                            <metamark style="display: flex; align-items: center; align-self: stretch; white-space: nowrap; width: 2em; min-width: 2em; margin: 0 0.25em; transform: scaleX(3) scaleY(13); transform-origin: left center; margin-bottom: 1.3em;">}</metamark>
                            <castGroup style="display: flex; align-items: center; align-self: stretch; padding-left: 2em;">
                                <roleDesc style="display: block; white-space: nowrap; align-self: center;" rendition="rnd:italic">For one man.</roleDesc>
                            </castGroup>
                        </castList>
                    </cell>
                    
                    <cell style="display: flex; flex-direction: row; align-items: center; flex: 1; padding: 0.4em 0.3em 0.4em 0.6em;">
                        <castList style="display: flex; flex-direction: row; align-items: center; flex: 1; min-width: 0;">
                            <castGroup style="display: flex; flex-direction: column; justify-content: space-evenly; flex: 1; min-width: 0; padding-right: 0.2em;">
                                <castItem style="display: block;"><role style="display: block; white-space: nowrap; line-height: 1.55em;">Meretrix.</role></castItem>
                                <castItem style="display: block;"><role style="display: block; white-space: nowrap; line-height: 1.55em;">Shame.</role></castItem>
                                <castItem style="display: block;"><role style="display: block; white-space: nowrap; line-height: 1.55em;">Otian.</role></castItem>
                                <castItem style="display: block;"><role style="display: block; white-space: nowrap; line-height: 1.55em;">Mother.</role></castItem>
                                <castItem style="display: block;"><role style="display: block; white-space: nowrap; line-height: 1.55em;">Lady.</role></castItem>
                                <castItem style="display: block;"><role style="display: block; white-space: nowrap; line-height: 1.55em;">Queene.</role></castItem>
                            </castGroup>
                            <metamark style="display: flex; align-items: center; align-self: stretch; white-space: nowrap; width: 2em; min-width: 2em; margin: 0 0.25em; transform: scaleX(3) scaleY(12); transform-origin: left center; margin-bottom: 1.8em;">}</metamark>
                            <castGroup style="display: flex; align-items: center; align-self: stretch; padding-left: 3.5em;">
                                <roleDesc style="display: block; white-space: nowrap; align-self: center;" rendition="rnd:italic">For one man.</roleDesc>
                            </castGroup>
                        </castList>
                    </cell>
                </row>
            </egXML>
        </p>
    </div>
</div>