Skip to content

Commit e4b636f

Browse files
authored
Update to Codemirror 6, fix copy/paste of examples, remove sass dependency, misc other improvements (#19)
1 parent 24ce68a commit e4b636f

25 files changed

+1993
-1905
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ bin/
1515
.DS_Store
1616
.idea/
1717
.vscode/
18+
.nova/
1819
*.iml
1920

2021
# ENV

README.md

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,10 @@ original V [docs.md](https://github.com/vlang/v/blob/master/doc/docs.md)
77

88
## External dependencies
99

10-
You'll need V, of course. Best to
10+
This project only requires V. Best to
1111
[install it from source](https://github.com/vlang/v?tab=readme-ov-file#installing-v-from-source)
1212
if you don't already have it.
1313

14-
Make sure you have [sass](https://sass-lang.com/install/) installed
15-
locally to build the css files.
16-
1714

1815
## Contributing
1916
To setup the generator and contribute changes to it, do this once:
@@ -31,14 +28,20 @@ To build the documentation, after the setup, run the following commands:
3128
```shell
3229
v run .
3330
```
34-
This will download the latest version
31+
This will download the latest version
3532
of [docs.md](https://github.com/vlang/v/edit/master/doc/docs.md),
3633
then it will regenerate the documentation from it, and save it in the `output`
3734
directory.
3835

3936

4037
## Testing the output
38+
39+
Use V to serve your local copy of the documentation.
40+
4141
```shell
4242
v -e 'import net.http.file; file.serve(folder: "output/")'
4343
```
44-
Now load http://localhost:4001/ in your browser.
44+
45+
The line of code executed will start a basic web server with the documentation created in the "outputs" folder.
46+
47+
Access the documentation on your browser using this url http://localhost:4001/.

main.v

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ fn main() {
2020
commit_res := os.execute_or_exit('git ls-remote -h https://github.com/vlang/v.git refs/heads/master')
2121
latest_v_commit_hash := commit_res.output.all_before('\t')
2222

23-
update_sass()
23+
//Removed need for sass, using css variables
24+
//update_sass()
2425

2526
mut ctx := Context{
2627
full_text: response.body
@@ -39,11 +40,18 @@ mut:
3940
}
4041

4142
fn (mut ctx Context) write_mapping() ! {
42-
content := '
43-
const titles_to_fnames = ${json.encode_pretty(ctx.titles_to_fnames)};
44-
const fnames = ${json.encode_pretty(ctx.pages)};
45-
'
46-
write_output_file('assets/scripts/titles_to_fnames.js', content)!
43+
js_file_index := '
44+
// Lookups of sections to files
45+
vdocs.titles_to_fnames = ${json.encode_pretty(ctx.titles_to_fnames)};
46+
vdocs.fnames = ${json.encode_pretty(ctx.pages)};'
47+
48+
js_src := os.read_file('templates/assets/scripts/v-docs.js') or {
49+
eprintln('Failed to read file: $err')
50+
return
51+
}
52+
53+
write_output_file('assets/scripts/v-docs.js', js_src + js_file_index)!
54+
4755
eprintln('> Total titles: ${ctx.titles_to_fnames.len}')
4856
eprintln('> HTML pages: ${ctx.pages.len}')
4957
}

sass.v

Lines changed: 0 additions & 22 deletions
This file was deleted.

0 commit comments

Comments
 (0)