Scribo

On this page

On this page

Code

Code highlighting in enabled by default.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
def get_order(filepath):
    """
    Return order found in index.md. if not found return 2**32 - 1.
    """
    with open(filepath) as markdown_file:
        file_string = markdown_file.read()
        matches = re.findall(r"order:\s+(\d+)", file_string, re.IGNORECASE)
        if matches:
            order = matches[-1]
            return int(order)
        else:
            return 2**32 - 1 

Syntax:

```python

def get_order(filepath):
    """
    Return order found in index.md. if not found return 2**32 - 1.
    """
    with open(filepath) as markdown_file:
        file_string = markdown_file.read()
        matches = re.findall(r"order:\s+(\d+)", file_string, re.IGNORECASE)
        if matches:
            order = matches[-1]
            return int(order)
        else:
            return 2**32 - 1

```