Files
kompas3d-mcp/docs/Kompas3D_SDK/guides/pages.md
T
mikhail e1337e4016 feat(sdk-docs): MD-база знаний SDK — в репозиторий; генератор и зеркало убраны
docs/Kompas3D_SDK/ становится каноническим источником справки КОМПАС SDK
и включается в репозиторий (2491 файл, ~14 МБ). HTML-зеркало
docs/KOMPAS_SDK_ru-RU/ (~1.4 ГБ, © АСКОН) и генератор
tools/build_kompas3d_sdk.py больше не нужны — регенерация не предполагается.

- .gitignore: MD-база разблокирована; зеркало остаётся проигнорированным
  (safety-net на случай повторной локальной выгрузки).
- CLAUDE.md / SKILL.md: убраны упоминания регенерации и зеркала.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-26 20:00:05 +03:00

79 lines
2.9 KiB
Markdown
Raw Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
---
title: "Pages.ру"
type: guide
api: [api7]
tags: [guide, api7, pages]
sources:
- pages.html
---
*Инструкция по созданию справки HTML для приложений > Локальная справка для приложений > База данных соответствия номеров команд и страниц справки*
#!/usr/bin/python
# -*- coding: utf-8 -*-
from xml.dom import minidom
import argparse
import sqlite3 as sqlite
import sys
con = None
try:
# Получение аргументов командной строки
ap = argparse.ArgumentParser(description="Формирование базы данных по связи идентификатора и html страницы")
ap.add_argument("--outfile", "-o", type = str, default = 'pages.db', \
help = "Путь к результирующему файлу базы данных")
ap.add_argument("--hhfile", "-hh", type = str, default = 'KOMPAS.hh', \
help = "Путь к hh-файлу КОМПАС")
# ap.add_argument("--hhafile", "-hha", type = str, default = 'KOMPAS.hha', \
#                 help = "Путь к hha-файлу КОМПАС")
args = ap.parse_args()
print("HH-file: %s, HHA-file: %s, output file: %s\n" % (args.hhfile, args.hhafile, args.outfile))
# print("HH-file: %s, output file: %s\n" % (args.hhfile, args.outfile))
con = sqlite.connect(args.outfile)
cur = con.cursor()
print("==> Clean up (1 of 3)")
# Удалить таблицу с соответствием идентификаторов из hh c html страницами
cur.execute("DROP TABLE IF EXISTS Page")
cur.execute("CREATE TABLE Page(Id INTEGER, Page TEXT)")
print("<== Clean up\n")
# Составляем словарь псевдонимов идентификаторов
print("==> Reading aliases (2 of 3)")
err_count_hha = 0
aliases = { }
with open(args.hhafile) as hha:
for line in hha:
# Trim comments and whitespace
s = line.split(';')[0].strip()
# Split by "="
parts = s.split('=', 1)
# Обработать ошибочную ситуацию
if len(parts) == 1 and len(parts[0]) > 0:
print("[ERROR] Invalid line format!")
err_count_hha = err_count_hha + 1
# Запомнить псевдоним
if len(parts) == 2:
print("[OK] %s=%s" % (parts[0], parts[1]))
aliases[parts[0]] = parts[1]
print("<== Reading aliases (ERRORS: %d)\n" % err_count_hha)
print("==> Creating Page table (3 of 3)")
with open(args.hhfile) as hh:
for line in hh:
words = line.split()
if len(words) >= 3:
identifier = int(words[2])
name = words[1]
if name in aliases:
name = aliases[name]
else:
name = name + ".html"
cur.execute("INSERT INTO Page VALUES(%d, '%s')" % (identifier, name))
cur.execute("CREATE INDEX page_id_index ON Page(Id)")
con.commit()
# Общий отчёт о результате
print("===DONE (ERRORS: %d)===" % int(err_count_hha))
except sqlite.Error as e:
print("ERROR: %s!" % e.args[0])
sys.exit(1)
finally:
if con:
con.close()