forked from infra/otc-metadata
update data and templates
This commit is contained in:
parent
b5439711d6
commit
7c55f348e8
@ -389,12 +389,14 @@ documents:
|
||||
service_type: ecs
|
||||
title: User Guide
|
||||
type: umn
|
||||
- html_location: docs/ed/umn
|
||||
pdf_name: edb-umn
|
||||
rst_location: umn/source
|
||||
service_type: edb
|
||||
- rst_location: api-ref/source
|
||||
service_type: ed
|
||||
title: API Reference
|
||||
type: api-ref
|
||||
- rst_location: umn/source
|
||||
service_type: ed
|
||||
title: User Guide
|
||||
type: manual
|
||||
type: umn
|
||||
- hc_location: api/eip
|
||||
html_location: docs/eip/api-ref
|
||||
link: /elastic-ip/api-ref/
|
||||
|
@ -22,12 +22,15 @@ deps =
|
||||
commands = {posargs}
|
||||
|
||||
[testenv:docs]
|
||||
deps = -r{toxinidir}/doc/requirements.txt
|
||||
commands =
|
||||
{%- for doc in docs %}
|
||||
{[testenv:{{ doc.type }}]commands}
|
||||
{[testenv:json-{{ doc.type }}]commands}
|
||||
{%- endfor %}
|
||||
|
||||
[testenv:docs-pdf]
|
||||
deps = -r{toxinidir}/doc/requirements.txt
|
||||
whitelist_externals =
|
||||
mkdir
|
||||
commands =
|
||||
@ -40,7 +43,9 @@ commands =
|
||||
|
||||
{% for doc in docs -%}
|
||||
{% set loc = doc.rst_location | replace('/source', '') %}
|
||||
# HTML version
|
||||
[testenv:{{ doc.type }}]
|
||||
deps = -r{toxinidir}/doc/requirements.txt
|
||||
whitelist_externals =
|
||||
cp
|
||||
mkdir
|
||||
@ -57,8 +62,32 @@ commands =
|
||||
cp -av doc/build/html/dev-guide dev_guide/build/html
|
||||
{%- endif %}
|
||||
|
||||
# Json version (for search)
|
||||
[testenv:json-{{ doc.type }}]
|
||||
deps = -r{toxinidir}/doc/requirements.txt
|
||||
whitelist_externals =
|
||||
cp
|
||||
mkdir
|
||||
find
|
||||
commands =
|
||||
sphinx-build -W --keep-going -b json {{ loc }}/source doc/build/json/{{ doc.type }}
|
||||
# Drop data useless for the search
|
||||
find doc/build/json -type d -and ( -name '_images' -or -name '_static' -or -name '_sources' ) -exec rm {:} ;
|
||||
{%- if doc.type == 'api-ref' %}
|
||||
mkdir -p api-ref/build/json
|
||||
cp -av doc/build/json/api-ref api-ref/build/json
|
||||
{%- elif doc.type == 'umn' %}
|
||||
mkdir -p umn/build/json
|
||||
cp -av doc/build/json/umn umn/build/json
|
||||
{%- elif doc.type == 'dev-guide' %}
|
||||
mkdir -p dev_guide/build/json
|
||||
cp -av doc/build/json/dev-guide dev_guide/build/json
|
||||
{%- endif %}
|
||||
|
||||
{% if doc.pdf_name -%}
|
||||
# PDF version
|
||||
[testenv:{{ doc.type }}-pdf-docs]
|
||||
deps = -r{toxinidir}/doc/requirements.txt
|
||||
whitelist_externals =
|
||||
rm
|
||||
mkdir
|
||||
|
@ -1,4 +1,5 @@
|
||||
import copy
|
||||
import re
|
||||
|
||||
import otc_metadata.services
|
||||
from ruamel.yaml import YAML
|
||||
@ -10,17 +11,15 @@ new_data = data._service_data
|
||||
|
||||
for doc in new_data["documents"]:
|
||||
hc_location = None
|
||||
if "type" in doc:
|
||||
if doc["type"] == "api-ref":
|
||||
hc_location = "api"
|
||||
elif doc["type"] == "umn":
|
||||
hc_location = "usermanual"
|
||||
elif doc["type"] == "dev":
|
||||
hc_location = "devg"
|
||||
if hc_location:
|
||||
hc_location += f"/{doc['service_type']}"
|
||||
doc["hc_location"] = hc_location
|
||||
|
||||
link = doc.get("link")
|
||||
if link:
|
||||
print(f"Parsing {link}")
|
||||
#(p1, p2) = link.split("/")
|
||||
doc["link"] = re.sub(
|
||||
r"/(.*)/(.*)/",
|
||||
r"/\2/\1/",
|
||||
link
|
||||
)
|
||||
|
||||
_yaml = YAML()
|
||||
_yaml.indent(mapping=2, sequence=4, offset=2)
|
||||
|
Loading…
x
Reference in New Issue
Block a user