Skip to content

Commit 6c007a7

Browse files
committed
[IMP] server: add wiki link to html repr
1 parent 5d3735d commit 6c007a7

File tree

2 files changed

+16
-5
lines changed

2 files changed

+16
-5
lines changed

server/src/constants.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,4 +120,5 @@ pub const BUILT_IN_LIBS: &[&str] = &["string", "re", "difflib", "textwrap", "un
120120
"cgi", "cgitb", "chunk", "crypt", "imghdr", "imp", "mailcap", "msilib", "nis", "nntplib", "optparse", "ossaudiodev",
121121
"pipes", "smtpd", "sndhdr", "spwd", "sunau", "telnetlib", "uu", "xdrlib", "struct", "codecs"];
122122

123-
pub const DEFAULT_PYTHON: &str = "python3";
123+
pub const DEFAULT_PYTHON: &str = "python3";
124+
pub const CONFIG_WIKI_URL: &str = "https://github.com/odoo/odoo-ls/wiki/Configuration-files";

server/src/core/config.rs

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ use ruff_python_ast::{Expr, Mod};
1010
use ruff_python_parser::{Mode, ParseOptions};
1111
use serde::{Deserialize, Deserializer, Serialize, Serializer};
1212

13-
use crate::constants::DEFAULT_PYTHON;
13+
use crate::constants::{DEFAULT_PYTHON, CONFIG_WIKI_URL};
1414
use crate::utils::{fill_validate_path, has_template, is_addon_path, is_odoo_path, is_python_path, PathSanitizer};
1515
use crate::S;
1616

@@ -213,10 +213,20 @@ impl ConfigFile {
213213
color: #888;
214214
font-size: 0.9em;
215215
}
216+
.config-wiki-link {
217+
margin-bottom: 10px;
218+
display: block;
219+
font-family: sans-serif;
220+
font-size: 1em;
221+
color: #2d5fa4;
222+
text-decoration: none;
223+
font-weight: bold;
224+
}
216225
</style>
217-
<div class="toml-table">
218-
"#,
219-
);
226+
<a class="config-wiki-link" href=""#);
227+
html.push_str(CONFIG_WIKI_URL);
228+
html.push_str("\" target=\"_blank\" rel=\"noopener\">Configuration file documentation &rarr;</a>\n");
229+
html.push_str("<div class=\"toml-table\">\n");
220230
let entry_htmls: Vec<String> = self.config.iter().map(|entry| {
221231
let entry_val = serde_json::to_value(entry).unwrap_or(serde_json::Value::Null);
222232
let mut entry_html = String::new();

0 commit comments

Comments
 (0)