Loading .gitignore 0 → 100644 +2 −0 Original line number Diff line number Diff line # Tags are generated by Vim automatically doc/tags CONTRIBUTING.rst 0 → 100644 +23 −0 Original line number Diff line number Diff line ########################### Contributing to jinja.vim ########################### .. default-role:: code The main repository is on GitLab_, there is a mirror on GitHub_. Bug reports Bugs can be submitted to either GitLab or GitHub, but GitLab is preferred. Make sure you describe how to reproduce the issue, ideally you should provide a minimum example that reproduces the issue. Merge requests Please submit merge request (pull request) to GitLab only. If you are fixing a bug go ahead and make your submissions, but if you intend a new feature please file an issue first so we can discuss it. See also the `HACKING` file for finding your way around the code. .. _GitLab: https://gitlab.com/HiPhish/jinja.vim/ .. _GitHub: https://github.com/HiPhish/jinja.vim/ HACKING.rst 0 → 100644 +82 −0 Original line number Diff line number Diff line .. default-role:: code ###################### Working on jinja.vim ###################### This document is intended for those who want to work on jinja.vim, improve it, fix bugs, or add new features. Overview of the plugin design ############################# Jinja.vim is intentionally a very minimal plugin. It provides the basics of file type support of Jinja files: syntax highlighting and file type detection. This does not mean that we cannot add more features, but the goal is to make Jinja a first-class citizen to Vim, not to provide a Jinja IDE. About Jinja =========== Jinja is a template engine: you write your files in a format of you choice (e.g. HTML) with pieces of Jinja syntax added in. Then you invoke the Jinja API from within your Python program. Here is what a piece of Jinja code in HTML looks like: .. code-block:: jinja {% extends "layout.html" %} {% block body %} <ul> {% for user in users %} <li><a href="{{ user.url }}">{{ user.username }}</a></li> {% endfor %} </ul> {% endblock %} Despite HTML being the format most often used, Jinja can be used with any language, such as XML or TeX. Therefore it is important to *not* limit jinja.vim to HTML only. Components of jinja.vim ####################### This is an overview of the problems jinja.vim solves and the files relevant to the task. Syntax highlighting The code is entirely contained in `syntax/jinja.vim`, it's exactly what you would expect. File type detection Detection of pure Jinja files is handled in `ftdetect/jinja.vim`. Detecting the presence of Jinja code in a file from different file type (e.g. HTML) is handled by `autoload/jinja.vim` and the function `jinja#DetectJinja`. File type adjustment The file type can be automatically adjusted by calling the function `jinja#AdjustFiletype` from the file `autoload/jinja.vim`. It will check the first few lines for the presence of Jinja and if necessary attach `.jinja` to the file type. We do not automatically adjust the file type. Instead the user should set up the automatic calling of the function if they want to. Testing ####### The testing framework is vader.vim_; execute `:Vader test/*.vader` to run all tests. These are are test suites: ft-detection Test for the correct detection of Jinja code and file type adjustment. syntax Test the syntax elements of a sample Jinja file. .. _vader.vim: https://github.com/junegunn/vader.vim LICENSE.txt 0 → 100644 +63 −0 Original line number Diff line number Diff line The MIT License (MIT) Copyright (c) 2016 Alejandro "HiPhish" Sanchez Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. =============================================================================== The above license applies to all parts of jinja.vim except for the following files: - 'syntax/jinja.vim': Syntax file from the Jinja project, 3-clause BSD license, has been modified. ====[ License for 'syntax/jinja.vim' ] Copyright (c) 2009 by the Jinja Team, see AUTHORS for more details. Some rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * The names of the contributors may not be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. README.rst 0 → 100644 +105 −0 Original line number Diff line number Diff line .. default-role:: code Jinja syntax and file type detection for Vim ############################################ This plugin adds support for the Jinja_ template engine to Vim the Right Way™ by making use of Vim's dotted filetype syntax. This makes the plugin smaller and simpler to maintain, while at the same time being more flexible by letting Vim combine support for any host language (such as HTML) rather than pulling it in through some hacky means. There are a number of Jinja plugins out there, including an official one, but they all force the file type to `jinja` and then pull in the HTML settings. By making use of the dotted file type syntax we are not limited to HTML alone, we can support any other host file type as well at no extra cost. To quote the Jinja documentation: A Jinja template is simply a text file. Jinja can generate any text-based format (HTML, XML, CSV, LaTeX, etc.). A Jinja template doesn’t need to have a specific extension: `.html`, `.xml`, or any other extension is just fine. .. _Jinja: http://jinja.pocoo.org/ Installation ============ Use your preferred method of installing Vim plugins, manually or via package manager. There is nothing out of the ordinary here. Configuration ============= Since this is just a syntax and filetype-detection plugin there is nothing to configure, once a file has been identified as a Jinja file it will be highlighted appropriately. Any file with the extension `.jinja` will be recognised as a Jinja file. On the other hand, if you want to use Jinja highlighting in other file types like HTML you will have to set it up appropriately. For HTML support add the following line to your `ftdetect/html.vim` file inside the `~/.vim/` (Vim) or `$XDG_CONFIG_HOME/nvim/` (Neovim) directory: .. code-block:: vim autocmd! BufRead,BufNewFile *.html call jinja#AdjustFiletype() The function `AdjustFiletype` is explained below. The `AdjustFiletype` funtion ---------------------------- `AdjustFiletype` is a function provided by the plugin as a convenient way of detecting the presence of Jinja code in a buffer and changing the file type if necessary by appending `.jinja` to it. Bugs and Caveats ================ Even though the dotted file type notation is the Right Way not all Vim plugins are respecting it. If that is the case please bring the issue to the plugin authors' attention; fixing the issue once in that plugin will forever benefit everyone while applying a hack to my plugin is just shoving the problem under the rug for the time being. Another issue is detection of files with compound names, such as `.html.jina`; I don't know how to handle them and the resulting file type will be just plain `jinja`. Help would be greatly appreciated. License ####### Jinja.vim is licensed under the MIT license, except for files where otherwise noted. The syntax file has been adapted from the official Jinja syntax file for Vim, with all the superfluous content stripped away. The original was written by Armin Ronacher. https://github.com/pallets/jinja The MIT License (MIT) ===================== Copyright (c) 2016 Alejandro "HiPhish" Sanchez Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Loading
.gitignore 0 → 100644 +2 −0 Original line number Diff line number Diff line # Tags are generated by Vim automatically doc/tags
CONTRIBUTING.rst 0 → 100644 +23 −0 Original line number Diff line number Diff line ########################### Contributing to jinja.vim ########################### .. default-role:: code The main repository is on GitLab_, there is a mirror on GitHub_. Bug reports Bugs can be submitted to either GitLab or GitHub, but GitLab is preferred. Make sure you describe how to reproduce the issue, ideally you should provide a minimum example that reproduces the issue. Merge requests Please submit merge request (pull request) to GitLab only. If you are fixing a bug go ahead and make your submissions, but if you intend a new feature please file an issue first so we can discuss it. See also the `HACKING` file for finding your way around the code. .. _GitLab: https://gitlab.com/HiPhish/jinja.vim/ .. _GitHub: https://github.com/HiPhish/jinja.vim/
HACKING.rst 0 → 100644 +82 −0 Original line number Diff line number Diff line .. default-role:: code ###################### Working on jinja.vim ###################### This document is intended for those who want to work on jinja.vim, improve it, fix bugs, or add new features. Overview of the plugin design ############################# Jinja.vim is intentionally a very minimal plugin. It provides the basics of file type support of Jinja files: syntax highlighting and file type detection. This does not mean that we cannot add more features, but the goal is to make Jinja a first-class citizen to Vim, not to provide a Jinja IDE. About Jinja =========== Jinja is a template engine: you write your files in a format of you choice (e.g. HTML) with pieces of Jinja syntax added in. Then you invoke the Jinja API from within your Python program. Here is what a piece of Jinja code in HTML looks like: .. code-block:: jinja {% extends "layout.html" %} {% block body %} <ul> {% for user in users %} <li><a href="{{ user.url }}">{{ user.username }}</a></li> {% endfor %} </ul> {% endblock %} Despite HTML being the format most often used, Jinja can be used with any language, such as XML or TeX. Therefore it is important to *not* limit jinja.vim to HTML only. Components of jinja.vim ####################### This is an overview of the problems jinja.vim solves and the files relevant to the task. Syntax highlighting The code is entirely contained in `syntax/jinja.vim`, it's exactly what you would expect. File type detection Detection of pure Jinja files is handled in `ftdetect/jinja.vim`. Detecting the presence of Jinja code in a file from different file type (e.g. HTML) is handled by `autoload/jinja.vim` and the function `jinja#DetectJinja`. File type adjustment The file type can be automatically adjusted by calling the function `jinja#AdjustFiletype` from the file `autoload/jinja.vim`. It will check the first few lines for the presence of Jinja and if necessary attach `.jinja` to the file type. We do not automatically adjust the file type. Instead the user should set up the automatic calling of the function if they want to. Testing ####### The testing framework is vader.vim_; execute `:Vader test/*.vader` to run all tests. These are are test suites: ft-detection Test for the correct detection of Jinja code and file type adjustment. syntax Test the syntax elements of a sample Jinja file. .. _vader.vim: https://github.com/junegunn/vader.vim
LICENSE.txt 0 → 100644 +63 −0 Original line number Diff line number Diff line The MIT License (MIT) Copyright (c) 2016 Alejandro "HiPhish" Sanchez Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. =============================================================================== The above license applies to all parts of jinja.vim except for the following files: - 'syntax/jinja.vim': Syntax file from the Jinja project, 3-clause BSD license, has been modified. ====[ License for 'syntax/jinja.vim' ] Copyright (c) 2009 by the Jinja Team, see AUTHORS for more details. Some rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * The names of the contributors may not be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
README.rst 0 → 100644 +105 −0 Original line number Diff line number Diff line .. default-role:: code Jinja syntax and file type detection for Vim ############################################ This plugin adds support for the Jinja_ template engine to Vim the Right Way™ by making use of Vim's dotted filetype syntax. This makes the plugin smaller and simpler to maintain, while at the same time being more flexible by letting Vim combine support for any host language (such as HTML) rather than pulling it in through some hacky means. There are a number of Jinja plugins out there, including an official one, but they all force the file type to `jinja` and then pull in the HTML settings. By making use of the dotted file type syntax we are not limited to HTML alone, we can support any other host file type as well at no extra cost. To quote the Jinja documentation: A Jinja template is simply a text file. Jinja can generate any text-based format (HTML, XML, CSV, LaTeX, etc.). A Jinja template doesn’t need to have a specific extension: `.html`, `.xml`, or any other extension is just fine. .. _Jinja: http://jinja.pocoo.org/ Installation ============ Use your preferred method of installing Vim plugins, manually or via package manager. There is nothing out of the ordinary here. Configuration ============= Since this is just a syntax and filetype-detection plugin there is nothing to configure, once a file has been identified as a Jinja file it will be highlighted appropriately. Any file with the extension `.jinja` will be recognised as a Jinja file. On the other hand, if you want to use Jinja highlighting in other file types like HTML you will have to set it up appropriately. For HTML support add the following line to your `ftdetect/html.vim` file inside the `~/.vim/` (Vim) or `$XDG_CONFIG_HOME/nvim/` (Neovim) directory: .. code-block:: vim autocmd! BufRead,BufNewFile *.html call jinja#AdjustFiletype() The function `AdjustFiletype` is explained below. The `AdjustFiletype` funtion ---------------------------- `AdjustFiletype` is a function provided by the plugin as a convenient way of detecting the presence of Jinja code in a buffer and changing the file type if necessary by appending `.jinja` to it. Bugs and Caveats ================ Even though the dotted file type notation is the Right Way not all Vim plugins are respecting it. If that is the case please bring the issue to the plugin authors' attention; fixing the issue once in that plugin will forever benefit everyone while applying a hack to my plugin is just shoving the problem under the rug for the time being. Another issue is detection of files with compound names, such as `.html.jina`; I don't know how to handle them and the resulting file type will be just plain `jinja`. Help would be greatly appreciated. License ####### Jinja.vim is licensed under the MIT license, except for files where otherwise noted. The syntax file has been adapted from the official Jinja syntax file for Vim, with all the superfluous content stripped away. The original was written by Armin Ronacher. https://github.com/pallets/jinja The MIT License (MIT) ===================== Copyright (c) 2016 Alejandro "HiPhish" Sanchez Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.