Skip to content

Commit

Permalink
Merge pull request #632 from kkoomen/feature/html-parser
Browse files Browse the repository at this point in the history
[Feature] Support HTML, SvelteJS and VueJS
  • Loading branch information
kkoomen authored Oct 3, 2023
2 parents 0ba8ed3 + af4c73e commit bd0215b
Show file tree
Hide file tree
Showing 15 changed files with 315 additions and 246 deletions.
43 changes: 22 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,24 +74,24 @@ Is your favorite language not supported?
Is your favorite doc standard not supported?
[Suggest a new doc standard][suggest-doc-standard] :tada:

| | Language | Doc standards |
| :----------------- | :--------------------------------------------- | :--------------------------------------------------------------------------- |
| :white_check_mark: | Python | [reST][py-rest], [Numpy][py-numpy], [Google][py-google], [Sphinx][py-sphinx] |
| :white_check_mark: | PHP | [phpdoc][phpdoc] |
| :white_check_mark: | JavaScript (Including: ES6, FlowJS and NodeJS) | [JSDoc][jsdoc] |
| :white_check_mark: | TypeScript | [JSDoc][jsdoc] |
| :white_check_mark: | Svelte | [JSDoc][jsdoc] |
| :white_check_mark: | Lua | [LDoc][ldoc] |
| :white_check_mark: | Java | [JavaDoc][javadoc] |
| :white_check_mark: | Groovy | [JavaDoc][javadoc] |
| :white_check_mark: | Ruby | [YARD][yard] |
| :white_check_mark: | C++ | [Doxygen][doxygen] |
| :white_check_mark: | C | [Doxygen][doxygen], [KernelDoc][kerneldoc] |
| :white_check_mark: | C# | [XMLDoc][xmldoc] |
| :white_check_mark: | Bash | [Google][sh-google] |
| :white_check_mark: | Rust | [RustDoc][rustdoc] |
| :white_check_mark: | R | [Roxygen2][roxygen2] |
| :white_check_mark: | Scala | [ScalaDoc][scaladoc] |
| | Language | Doc standards |
| :----------------- | :----------------------------------------------------- | :--------------------------------------------------------------------------- |
| :white_check_mark: | Python | [reST][py-rest], [Numpy][py-numpy], [Google][py-google], [Sphinx][py-sphinx] |
| :white_check_mark: | PHP | [phpdoc][phpdoc] |
| :white_check_mark: | JavaScript (Vanilla, ES6, FlowJS, NodeJS, Svelte, Vue) | [JSDoc][jsdoc] |
| :white_check_mark: | TypeScript | [JSDoc][jsdoc] |
| :white_check_mark: | HTML (through inline `<script>` tags) | [JSDoc][jsdoc] |
| :white_check_mark: | Lua | [LDoc][ldoc] |
| :white_check_mark: | Java | [JavaDoc][javadoc] |
| :white_check_mark: | Groovy | [JavaDoc][javadoc] |
| :white_check_mark: | Ruby | [YARD][yard] |
| :white_check_mark: | C++ | [Doxygen][doxygen] |
| :white_check_mark: | C | [Doxygen][doxygen], [KernelDoc][kerneldoc] |
| :white_check_mark: | C# | [XMLDoc][xmldoc] |
| :white_check_mark: | Bash | [Google][sh-google] |
| :white_check_mark: | Rust | [RustDoc][rustdoc] |
| :white_check_mark: | R | [Roxygen2][roxygen2] |
| :white_check_mark: | Scala | [ScalaDoc][scaladoc] |

# Getting started

Expand Down Expand Up @@ -165,7 +165,7 @@ Here is the full list of available doc standards per filetype:
| `g:doge_doc_standard_python` | `'reST'` | `'reST'`, `'numpy'`, `'google'`, `'sphinx'` |
| `g:doge_doc_standard_php` | `'phpdoc'` | `'phpdoc'` |
| `g:doge_doc_standard_javascript` | `'jsdoc'` | `'jsdoc'` |
| `g:doge_doc_standard_svelte` | `'jsdoc'` | `'jsdoc'` |
| `g:doge_doc_standard_html` | `'jsdoc'` | `'jsdoc'` |
| `g:doge_doc_standard_lua` | `'ldoc'` | `'ldoc'` |
| `g:doge_doc_standard_java` | `'javadoc'` | `'javadoc'` |
| `g:doge_doc_standard_groovy` | `'javadoc'` | `'javadoc'` |
Expand Down Expand Up @@ -221,6 +221,7 @@ Default:
'typescript',
'typescript.tsx',
],
'html': ['svelte', 'vue'],
'java': ['groovy'],
}
```
Expand All @@ -233,11 +234,11 @@ Example:

```vim
let g:doge_filetype_aliases = {
\ 'javascript': ['vue']
\ 'javascript': ['typescript']
\}
```

If you use the above settings and you open `myfile.vue` then it will behave like
If you use the above settings and you open `myfile.ts` then it will behave like
you're opening a JavaScript filetype.

### `g:doge_buffer_mappings`
Expand Down
16 changes: 16 additions & 0 deletions ftplugin/html.vim
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
let s:save_cpo = &cpoptions
set cpoptions&vim

" The HTML filetype also gets triggerred for PHP files (and perhaps others).
if &filetype !=? 'html'
finish
endif

let b:doge_parser = 'html'
let b:doge_insert = 'above'

let b:doge_supported_doc_standards = ['jsdoc']
let b:doge_doc_standard = doge#buffer#get_doc_standard('html')

let &cpoptions = s:save_cpo
unlet s:save_cpo
11 changes: 0 additions & 11 deletions ftplugin/svelte.vim

This file was deleted.

Loading

0 comments on commit bd0215b

Please sign in to comment.