1"""Code block (4 spaces padded).""" 
    2 
    3import logging 
    4 
    5from .state_block import StateBlock 
    6 
    7LOGGER = logging.getLogger(__name__) 
    8 
    9 
    10def code(state: StateBlock, startLine: int, endLine: int, silent: bool) -> bool: 
    11    LOGGER.debug("entering code: %s, %s, %s, %s", state, startLine, endLine, silent) 
    12 
    13    if not state.is_code_block(startLine): 
    14        return False 
    15 
    16    last = nextLine = startLine + 1 
    17 
    18    while nextLine < endLine: 
    19        if state.isEmpty(nextLine): 
    20            nextLine += 1 
    21            continue 
    22 
    23        if state.is_code_block(nextLine): 
    24            nextLine += 1 
    25            last = nextLine 
    26            continue 
    27 
    28        break 
    29 
    30    state.line = last 
    31 
    32    token = state.push("code_block", "code", 0) 
    33    token.content = state.getLines(startLine, last, 4 + state.blkIndent, False) + "\n" 
    34    token.map = [startLine, state.line] 
    35 
    36    return True