Skip to content
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

template comments #64

Open
linuxcaffe opened this issue Mar 31, 2015 · 5 comments
Open

template comments #64

linuxcaffe opened this issue Mar 31, 2015 · 5 comments

Comments

@linuxcaffe
Copy link

Is there some way that a template file could have comments, that were there for development or explanation of the template, but that was never translated to the generated file.

either a vim-style comment (which might not work great for vim-files where the commented part is desirable)

" a vim-style in-line comment

or something hopefully unique to vim-template, like

%%% this is a vim-template comment

or maybe a block-comment style, like this;

%COMMENT_START%
These are template comments,
and won't be included in the transformation
%COMMENT_END%
@linuxcaffe
Copy link
Author

for consistency, perhaps, if a line starts with;

%COMMENT% <-- a vim-template comment, this line will be ignored

and for block-comments;

%COMMENT_START% anything on this line will be ignored
These are template comments,
and these four lines won't be included in the transformation
%COMMENT_END% this line is ignored, too

@muff1nman
Copy link
Collaborator

Hmm. What is the use case of this? Do you have templates that are so complex that they need documentation? I would hope that the template files are readable as is.

@linuxcaffe
Copy link
Author

Here's one: a template specific modeline.
I'm editing templated for vimwiki, they have vimwiki formatting the with the *.wiki extension, the behaviors and mapping are not helpful, in editing the related templates, so

# vim: foldlevel=3
%COMMENT_START%
# vim: filetype=txt
%COMMENT_END%

(caveat: I don't know how to use modelines very well ;-)
The bottom modeline would (should) apply when editing the template, but would not apply to the transformed file.

@linuxcaffe
Copy link
Author

Another use-case might be this:

%COMMENT_START$-------------------------------
| This is a vim-template template            |
| http://github.com/aperezdc/vim-template    |
| ----                                       |
| Licensed under the BlaBlaBlaPublic License |
| http://licenses.com/BBBP/                  |
| ---                                        |
| Author: Edgar Allen Poe                    |
| ---                                        |
| This template designed for: vimwiki diary  |
|                                            |
| and requires:                              |
|                                            |
%COMMENT_END%---------------------------------

@aperezdc
Copy link
Owner

Probably matching comment start/end pairs would end up in some complex code. Personally I would prefer to only support single-line comments. I am not so sure about what would be the best character for commenting. From the less usual line-comment characters, probably % is the less used — I can only think about TeX. We could match a double (or triple?) percent character exactly at line start, to reduce the chance of clashing with other kinds of comments or valid syntax in some language:

%%% This would be a template comment.
% This would NOT be a comment. It could be a TeX comment, though.
   %%% This is NOT a comment either

This would also have the nice property that matches lines can be completely deleted, and there is no need to preserve the content present before %%% — because there's never content if the match is at the start of the lines.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants