summaryrefslogtreecommitdiff
path: root/src/index-pages.py
blob: 6dee7d062035b56e6e4df4dc1e84dc1416680485 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#!/usr/bin/env python3

import os
import re
import sys

sys.path.append(os.path.join(os.path.dirname(__file__), "..", "..", "..", "scripts"))
from create_table import create_table
from get_title import get_title
from insert import insert

def insert_page(db_path, html_path):
    page_name = get_title(html_path)
    page_name = page_name.replace('(GNU Coding Standards)', '')

    page_type = "Guide"

    insert(db_path, page_name, page_type, os.path.basename(html_path))

if __name__ == '__main__':
    db_path = sys.argv[1]

    create_table(db_path)
    for html_path in sys.argv[2:]:
        insert_page(db_path, html_path)