Skip to content

[IMP] server: add wiki link to html repr #345

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion server/src/constants.rs
Original file line number Diff line number Diff line change
Expand Up @@ -120,4 +120,5 @@ pub const BUILT_IN_LIBS: &[&str] = &["string", "re", "difflib", "textwrap", "un
"cgi", "cgitb", "chunk", "crypt", "imghdr", "imp", "mailcap", "msilib", "nis", "nntplib", "optparse", "ossaudiodev",
"pipes", "smtpd", "sndhdr", "spwd", "sunau", "telnetlib", "uu", "xdrlib", "struct", "codecs"];

pub const DEFAULT_PYTHON: &str = "python3";
pub const DEFAULT_PYTHON: &str = "python3";
pub const CONFIG_WIKI_URL: &str = "https://github.com/odoo/odoo-ls/wiki/Configuration-files";
18 changes: 14 additions & 4 deletions server/src/core/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use ruff_python_ast::{Expr, Mod};
use ruff_python_parser::{Mode, ParseOptions};
use serde::{Deserialize, Deserializer, Serialize, Serializer};

use crate::constants::DEFAULT_PYTHON;
use crate::constants::{DEFAULT_PYTHON, CONFIG_WIKI_URL};
use crate::utils::{fill_validate_path, has_template, is_addon_path, is_odoo_path, is_python_path, PathSanitizer};
use crate::S;

Expand Down Expand Up @@ -213,10 +213,20 @@ impl ConfigFile {
color: #888;
font-size: 0.9em;
}
.config-wiki-link {
margin-bottom: 10px;
display: block;
font-family: sans-serif;
font-size: 1em;
color: #2d5fa4;
text-decoration: none;
font-weight: bold;
}
</style>
<div class="toml-table">
"#,
);
<a class="config-wiki-link" href=""#);
html.push_str(CONFIG_WIKI_URL);
html.push_str("\" target=\"_blank\" rel=\"noopener\">Configuration file documentation &rarr;</a>\n");
html.push_str("<div class=\"toml-table\">\n");
let entry_htmls: Vec<String> = self.config.iter().map(|entry| {
let entry_val = serde_json::to_value(entry).unwrap_or(serde_json::Value::Null);
let mut entry_html = String::new();
Expand Down