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
|
service_type: ecs
|
||||||
title: User Guide
|
title: User Guide
|
||||||
type: umn
|
type: umn
|
||||||
- html_location: docs/ed/umn
|
- rst_location: api-ref/source
|
||||||
pdf_name: edb-umn
|
service_type: ed
|
||||||
rst_location: umn/source
|
title: API Reference
|
||||||
service_type: edb
|
type: api-ref
|
||||||
|
- rst_location: umn/source
|
||||||
|
service_type: ed
|
||||||
title: User Guide
|
title: User Guide
|
||||||
type: manual
|
type: umn
|
||||||
- hc_location: api/eip
|
- hc_location: api/eip
|
||||||
html_location: docs/eip/api-ref
|
html_location: docs/eip/api-ref
|
||||||
link: /elastic-ip/api-ref/
|
link: /elastic-ip/api-ref/
|
||||||
|
@ -22,12 +22,15 @@ deps =
|
|||||||
commands = {posargs}
|
commands = {posargs}
|
||||||
|
|
||||||
[testenv:docs]
|
[testenv:docs]
|
||||||
|
deps = -r{toxinidir}/doc/requirements.txt
|
||||||
commands =
|
commands =
|
||||||
{%- for doc in docs %}
|
{%- for doc in docs %}
|
||||||
{[testenv:{{ doc.type }}]commands}
|
{[testenv:{{ doc.type }}]commands}
|
||||||
|
{[testenv:json-{{ doc.type }}]commands}
|
||||||
{%- endfor %}
|
{%- endfor %}
|
||||||
|
|
||||||
[testenv:docs-pdf]
|
[testenv:docs-pdf]
|
||||||
|
deps = -r{toxinidir}/doc/requirements.txt
|
||||||
whitelist_externals =
|
whitelist_externals =
|
||||||
mkdir
|
mkdir
|
||||||
commands =
|
commands =
|
||||||
@ -40,7 +43,9 @@ commands =
|
|||||||
|
|
||||||
{% for doc in docs -%}
|
{% for doc in docs -%}
|
||||||
{% set loc = doc.rst_location | replace('/source', '') %}
|
{% set loc = doc.rst_location | replace('/source', '') %}
|
||||||
|
# HTML version
|
||||||
[testenv:{{ doc.type }}]
|
[testenv:{{ doc.type }}]
|
||||||
|
deps = -r{toxinidir}/doc/requirements.txt
|
||||||
whitelist_externals =
|
whitelist_externals =
|
||||||
cp
|
cp
|
||||||
mkdir
|
mkdir
|
||||||
@ -57,8 +62,32 @@ commands =
|
|||||||
cp -av doc/build/html/dev-guide dev_guide/build/html
|
cp -av doc/build/html/dev-guide dev_guide/build/html
|
||||||
{%- endif %}
|
{%- 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 -%}
|
{% if doc.pdf_name -%}
|
||||||
|
# PDF version
|
||||||
[testenv:{{ doc.type }}-pdf-docs]
|
[testenv:{{ doc.type }}-pdf-docs]
|
||||||
|
deps = -r{toxinidir}/doc/requirements.txt
|
||||||
whitelist_externals =
|
whitelist_externals =
|
||||||
rm
|
rm
|
||||||
mkdir
|
mkdir
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import copy
|
import copy
|
||||||
|
import re
|
||||||
|
|
||||||
import otc_metadata.services
|
import otc_metadata.services
|
||||||
from ruamel.yaml import YAML
|
from ruamel.yaml import YAML
|
||||||
@ -10,17 +11,15 @@ new_data = data._service_data
|
|||||||
|
|
||||||
for doc in new_data["documents"]:
|
for doc in new_data["documents"]:
|
||||||
hc_location = None
|
hc_location = None
|
||||||
if "type" in doc:
|
link = doc.get("link")
|
||||||
if doc["type"] == "api-ref":
|
if link:
|
||||||
hc_location = "api"
|
print(f"Parsing {link}")
|
||||||
elif doc["type"] == "umn":
|
#(p1, p2) = link.split("/")
|
||||||
hc_location = "usermanual"
|
doc["link"] = re.sub(
|
||||||
elif doc["type"] == "dev":
|
r"/(.*)/(.*)/",
|
||||||
hc_location = "devg"
|
r"/\2/\1/",
|
||||||
if hc_location:
|
link
|
||||||
hc_location += f"/{doc['service_type']}"
|
)
|
||||||
doc["hc_location"] = hc_location
|
|
||||||
|
|
||||||
|
|
||||||
_yaml = YAML()
|
_yaml = YAML()
|
||||||
_yaml.indent(mapping=2, sequence=4, offset=2)
|
_yaml.indent(mapping=2, sequence=4, offset=2)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user