INNER CODE UNIT · Python

end

wgpsec/AboutSecurity · scripts/generate-index.py:30

    if end == -1:
        return {}

    frontmatter = content[3:end].strip()
    result = {}

    # 简易 YAML 解析(不依赖外部库)
    current_key = None
    current_value = ""
    in_metadata = False

    for line in frontmatter.split("\n"):
        # 顶级字段
        match = re.match(r'^(\w+):\s*(.*)$', line)
        if match:
            # 保存前一个键
            if current_key and current_key != "metadata":
                result[current_key] = current_value.strip().strip('"')

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…