Files
OpenBB/website/content/sdk/reference/generate_index.py
James Maslek 69694332e6 Documentation push (#4501)
* hi didier

* Add files

* Add the changelogs from GH

* Api keys + cleaning up spelling + found some old refs

* spelling

* Merge branch 'feature/documentation3p0' of https://github.com/OpenBB-finance/OpenBBTerminal into feature/documentation3p0

* updates to faq sections

* spelling

* fixing FA so it runs

* adding guides - need pics

* telegram/discord docs markdown format conversion

* fix: added new reference styles

* adding examples to discord - remove play button

* updating bot docs

* image showing on docs

Co-authored-by: jose-donato <jose-donato@users.noreply.github.com>

* feat: added imageurl for examples

* updates Stocks SDK intro

* bot pics update

* updating rest of bot docs

* adding code for generating index and bot updates

* linting

* Downgrade scikit-learn to avoid DistanceMetric32 not being found

* add some updates to guide for auto select commands

* Add pytest-recorder to requirements.txt

---------

Co-authored-by: Theodore Aptekarev <aptekarev@gmail.com>
Co-authored-by: andrewkenreich <andrew.kenreich@gmail.com>
Co-authored-by: Danglewood <85772166+deeleeramone@users.noreply.github.com>
Co-authored-by: teh_coderer <me@tehcoderer.com>
Co-authored-by: jose-donato <zmcdonato@gmail.com>
Co-authored-by: jose-donato <jose-donato@users.noreply.github.com>
2023-03-23 17:36:47 +00:00

49 lines
1.7 KiB
Python

import os
# This script is used to generate the index.mdx files for the sdk reference
# section of the docs Copy paste the output of the
# .txt file into the section it generates relative to the index.mdx file
# get the file names of all the files in a given relative path
files_sdk = os.listdir(os.path.join(os.getcwd()))
print(files_sdk)
# remove last entry in a list cause it is not needed
files_sdk.pop()
print(files_sdk)
# create discord reference card
with open(os.path.join(os.getcwd(), "sdk.txt"), "w") as f:
for x in files_sdk:
desc_text = []
# if x is index.mdx or index.md then skip
if x == "index.md" or x == "index.mdx" or x == "generate_index.py":
pass
else:
try:
description = os.listdir(os.path.join(os.getcwd(), x))
for xx in description:
if (
xx == "index.md"
or xx == "index.mdx"
or xx == "generate_index.py"
):
pass
else:
desc_text.append(os.path.splitext(xx)[0])
f.write(
'<ReferenceCard title="{}" description="{}" url="/sdk/reference/{}" />\n'.format(
x, ", ".join(desc_text), x
)
)
except Exception as ex:
print(ex)
print("must be md file not in a folder - so adding a ref card")
f.write(
'<ReferenceCard title="{}" description="{}" url="/sdk/reference/{}" />\n'.format(
x, x, x
)
)