fix about command (#3532)

* fix(docs): added margin between sections

* fix: about command

* fix: about command to match new docs

* sdk aout

* fix: fix homepage

* fix: features -> reference on generate; about on homepage

* fix: juan magic

* update on merge workflows

Co-authored-by: James Maslek <jmaslek11@gmail.com>
Co-authored-by: montezdesousa <79287829+montezdesousa@users.noreply.github.com>
Co-authored-by: Diogo Sousa <montezdesousa@gmail.com>
Co-authored-by: teh_coderer <me@tehcoderer.com>
This commit is contained in:
jose-donato
2022-11-26 00:42:07 +00:00
committed by GitHub
parent 7480c5efe0
commit 2e2e5e2fb6
9 changed files with 91 additions and 53 deletions

View File

@@ -75,6 +75,7 @@ jobs:
run: |
conda info
pip install --requirement requirements-full.txt
pip install docstring_parser
- name: List installed packages (Bash)
shell: bash -l {0}

View File

@@ -87,6 +87,7 @@ jobs:
run: |
conda info
pip install --requirement requirements-full.txt
pip install docstring_parser
- name: List installed packages (Bash)
shell: bash -l {0}

View File

@@ -35,21 +35,6 @@ def get_global_cases(country: str) -> pd.DataFrame:
-------
pd.DataFrame
Dataframe of historical cases
Examples
--------
>>> df = get_global_cases("United States")
Dataframe of historical cases for United States
>>> df = get_global_cases("Portugal")
Dataframe of historical cases for Portugal
>>> df = get_global_cases("Spain")
Dataframe of historical cases for Spain
"""
cases = pd.read_csv(global_cases_time_series)
cases = cases.rename(columns={"Country/Region": "Country"})

View File

@@ -140,7 +140,7 @@ class Breadcrumb:
import webbrowser
trail = self._trail
url = "https://openbb-finance.github.io/OpenBBTerminal/SDK/"
url = "https://docs.openbb.co/sdk/reference/"
url += "/".join(trail.split("."))
webbrowser.open(url)

View File

@@ -109,7 +109,7 @@ class Operation:
import webbrowser
trail = self._trail
url = "https://openbb-finance.github.io/OpenBBTerminal/SDK/"
url = "https://docs.openbb.co/sdk/reference/"
url += "/".join(trail.split("."))
webbrowser.open(url)

View File

@@ -419,7 +419,15 @@ class BaseController(metaclass=ABCMeta):
ns_parser = self.parse_known_args_and_warn(parser, other_args)
if ns_parser:
open_openbb_documentation(self.PATH, command=ns_parser.command)
arg_type = ""
if ns_parser.command in self.CHOICES_COMMANDS:
arg_type = "command"
elif ns_parser.command in self.CHOICES_MENUS:
arg_type = "menu"
open_openbb_documentation(
self.PATH, command=ns_parser.command, arg_type=arg_type
)
@log_start_end(log=logger)
def call_quit(self, _) -> None:

View File

@@ -118,42 +118,74 @@ def update_terminal():
def open_openbb_documentation(
path, url="https://openbb-finance.github.io/OpenBBTerminal/", command=None
path, url="https://docs.openbb.co/terminal", command=None, arg_type=""
):
"""Opens the documentation page based on your current location within the terminal. Make exceptions for menus
that are considered 'common' by adjusting the path accordingly."""
if "ta" in path:
path = "terminal/common/ta/"
elif "ba" in path:
path = "terminal/common/ba/"
elif "qa" in path:
path = "terminal/common/qa/"
elif "keys" in path:
path = "#accessing-other-sources-of-data-via-api-keys"
if path == "/" and command is None:
path = "/"
command = ""
elif "settings" in path or "featflags" in path or "sources" in path:
path = "#customizing-the-terminal"
elif "keys" in path:
path = "/guides/basics/keys"
command = ""
elif "settings" in path:
path = "/guides/basics/customizing_the_terminal"
command = ""
elif "featflags" in path:
path = "/guides/basics/customizing_the_terminal"
command = ""
elif "sources" in path:
path = "/guides/advanced/changing_sources"
command = ""
else:
path = f"terminal/{path}"
if arg_type == "command": # user passed a command name
path = f"/reference/{path}"
elif arg_type == "menu": # user passed a menu name
if command in ["ta", "ba", "qa"]:
menu = path.split("/")[-2]
path = f"/guides/intros/common/{menu}"
elif command == "forecast":
command = ""
path = "/guides/intros/forecast"
else:
path = f"/guides/intros/{path}"
else: # user didn't pass argument and is in a menu
menu = path.split("/")[-2]
if menu in ["ta", "ba", "qa"]:
path = f"/guides/intros/common/{menu}"
else:
path = f"/guides/intros/{path}"
if command:
if command in ["ta", "ba", "qa"]:
path = "terminal/common/"
elif "keys" == command:
path = "#accessing-other-sources-of-data-via-api-keys"
if "keys" == command:
path = "/guides/basics/keys"
command = ""
elif "settings" in path:
path = "/guides/basics/customizing_the_terminal"
command = ""
elif "featflags" in path:
path = "/guides/basics/customizing_the_terminal"
command = ""
elif "sources" in path:
path = "/guides/advanced/changing_sources"
command = ""
elif "exe" == command:
path = "/terminal/scripts/"
path = "/quickstart/scripts"
command = ""
elif command in ["settings", "featflags", "sources"]:
path = "#customizing-the-terminal"
path = ""
command = ""
elif command in ["ta", "ba", "qa"]:
path = f"/guides/intros/common/{command}"
command = ""
path += command
full_url = f"{url}{path}".replace("//", "/")
if full_url[-1] == "/":
full_url = full_url[:-1]
webbrowser.open(full_url)

View File

@@ -183,7 +183,7 @@ def add_todict(d: dict, location_path: list, cmd_name: str, full_path: str) -> d
else:
d[location_path[0]][
cmd_name
] = f"/terminal/features/{'/'.join(full_path)}/{cmd_name}"
] = f"/terminal/reference/{'/'.join(full_path)}/{cmd_name}"
return d
@@ -236,6 +236,11 @@ def main() -> bool:
console.print(f"[red]Failed to generate markdown for {ctrlstr}: {e}[/red]")
return False
terminal_ref = {
k: dict(sorted(v.items(), key=lambda item: item[0]))
for k, v in sorted(terminal_ref.items(), key=lambda item: item[0])
}
with open(content_path / "_category_.json", "w", **kwargs) as f:
f.write(json.dumps({"label": "Terminal Reference", "position": 4}, indent=2))

View File

@@ -1,42 +1,46 @@
import React from 'react';
import Translate, {translate} from '@docusaurus/Translate';
import {PageMetadata} from '@docusaurus/theme-common';
import Layout from '@theme/Layout';
import React from "react";
import Translate, { translate } from "@docusaurus/Translate";
import { PageMetadata } from "@docusaurus/theme-common";
import Layout from "@theme/Layout";
export default function NotFound() {
return (
<>
<PageMetadata
title={translate({
id: 'theme.NotFound.title',
message: 'Page Not Found',
id: "theme.NotFound.title",
message: "Page Not Found",
})}
/>
<Layout>
<main className="container margin-vert--xl">
<main className="container margin-vert--xl mb-20">
<div className="row">
<div className="col col--6 col--offset-3">
<h1 className="mt-10 !text-[32px] uppercase font-bold tracking-widest">
<Translate
id="theme.NotFound.title"
description="The title of the 404 page">
description="The title of the 404 page"
>
Page Not Found
</Translate>
</h1>
<p className='mt-6 mb-2'>
We could not find what you were looking for.
<p className="mt-6 mb-2">
We could not find what you were looking for.
</p>
<p>
We recently moved our documentation to a new location and some links may be broken. Popular links are listed below:
We recently moved our documentation to a new location and some
links may be broken. Popular links are listed below:
</p>
<ul className='space-y-1 max-w-md list-disc list-inside mt-4'>
<ul className="space-y-1 max-w-md list-disc list-inside mt-4">
<li>
<a href="/">Homepage</a>
</li>
<li>
<a href="/sdk">Terminal Documentation</a>
<ul className='space-y-1 max-w-md list-disc ml-4 mt-2 mb-3 list-inside'>
<ul className="space-y-1 max-w-md list-disc ml-4 mt-2 mb-3 list-inside">
<li>
<a href="/terminal/quickstart/installation">Terminal Installation</a>
<a href="/terminal/quickstart/installation">
Terminal Installation
</a>
</li>
<li>
<a href="/terminal/reference">Terminal Reference</a>
@@ -45,9 +49,11 @@ export default function NotFound() {
</li>
<li>
<a href="/sdk">SDK Documentation</a>
<ul className='space-y-1 max-w-md list-disc ml-4 mt-2 mb-3 list-inside'>
<ul className="space-y-1 max-w-md list-disc ml-4 mt-2 mb-3 list-inside">
<li>
<a href="/sdk/quickstart/installation">SDK Installation</a>
<a href="/sdk/quickstart/installation">
SDK Installation
</a>
</li>
<li>
<a href="/sdk/reference">SDK Reference</a>