什么是从PHP文件中删除注释的最佳方法?
我想做类似strip-whitespace()的东西 - 但它也不应该删除换行符.
例如:
我要这个:
<?PHP
// something
if ($whatsit) {
do_something(); # we do something here
echo '<html>Some embedded HTML</html>';
}
/* another long
comment
*/
some_more_code();
?>
Run Code Online (Sandbox Code Playgroud)
成为:
<?PHP
if ($whatsit) {
do_something();
echo '<html>Some embedded HTML</html>';
}
some_more_code();
?>
Run Code Online (Sandbox Code Playgroud)
(虽然如果删除注释的空行仍然存在,那就不行了).
这可能是不可能的,因为需要保留嵌入式HTML - 这就是在谷歌上出现的东西绊倒了.
如何在Jinja2参数列表声明中添加注释?
我尝试的所有内容都会出错: jinja2.exceptions.TemplateSyntaxError:unexpected char u'#'
{{ Switch('var',
[('1', 'foo'), # comment 1
('2', 'bar'), ## comment 2
('3', 'rum'), {# comment 3 #}
]) }}
{% macro Switch(var, caselist) %}
{% for case, action in caselist%}
CMP {{var}} {{case}}
JNE {{LABEL}}
{{action}}
JMP {{LABELF}}
{{LABEL}}: NOP
{%- endfor %}
{{LABELF}}: NOP
{%- endmacro -%}
Run Code Online (Sandbox Code Playgroud) 有没有办法使用Jekyll在HTML文件中注释掉include语句?
例如,我在我的一个HTML文件中有这个,我想暂时注释掉.标准HTML评论似乎不起作用.
{% include navbar.html %}
Run Code Online (Sandbox Code Playgroud) 我需要*/在我的JavaDoc评论中包含这些内容.问题是这也是关闭评论的顺序.引用/逃避这个的正确方法是什么?
例:
/**
* Returns true if the specified string contains "*/".
*/
public boolean containsSpecialSequence(String str)
Run Code Online (Sandbox Code Playgroud)
跟进:似乎我可以使用/斜线.唯一的缺点是,在文本编辑器中直接查看代码时,这并非完全可读.
/**
* Returns true if the specified string contains "*/".
*/
Run Code Online (Sandbox Code Playgroud) Java有Javadoc,Python有docstring.JavaScript中有类似的东西吗?
通过这样的标签的android sdk看时注意到:
<eat-comment/>
Run Code Online (Sandbox Code Playgroud)
它是干什么用的?例如,对它的引用如下:
https://github.com/android/platform_frameworks_base/blob/master/core/res/AndroidManifest.xml
我正在使用CheckStyle,FindBugs和PMD来验证我的Java代码.我已经修复了这些工具捕获的几乎所有错误.
我无法理解如何编写"包评论",这是checkstyle捕获的错误.我已经阅读了CheckStyle的文档,但我不明白.
有人可以帮助我在Java中编写包级别的注释吗?
我听到有人说有,所以我在想.
HTML评论:
<!-- Comment goes here. -->
Run Code Online (Sandbox Code Playgroud)
PHP评论:
<?php // Comment goes here. ?>
Run Code Online (Sandbox Code Playgroud) 我正在使用Eclipse Indigo for Java.
我曾经写过关于这些方法的评论.每当我使用@author标签时,它会自动获取当前登录系统的用户名.
我的问题是:如何更改此@author标记配置,使其采用我指定的名称.
我通过以下链接:
但它建议改变classpath变量的值$user.我不想那样做.我想通过配置更改评论模板.