Pycharm文档模板变量
点击这里查看JetBrains官方英文源文件
本篇Blog只是搬运外加大概翻译一下。
File template variables
A file template can contain variables, which are replaced by their values when the template is applied. A variable is a string that starts with a dollar sign $ followed by the variable name. The variable name may optionally be enclosed in curly braces. For example: $MyVariable and ${MyVariable} are different notations of the same variable.
文档模板变量
文档模板可以包含变量,应用模板后,这些变量可以被它们的值替换。一个变量就是一个字符串,这个字符串以一个dollar符”$”开始后接变量名。变量名可以选择用大括号”{}”括起来。如:$MyVariable和${MyVariable}是相同的变量但符号不同。
Predefined template variables
The following predefined variables can be used in file templates:
| Variable | Description |
| ${DATE} | Current system date |
| ${DAY} | Current day of the month |
| ${DS} | Dollar sign $. This variable is used to escape the dollar character, so that it is not treated as a prefix of a template variable. |
| ${FILE_NAME} | Name of the new file |
| ${HOUR} | Current hour |
| ${MINUTE} | Current minute |
| ${MONTH} | Current month |
| ${MONTH_NAME_FULL} | Full name of the current month(January, February, and so on) |
| ${MONTH_NAME_SHORT} | First three letters of the current month name(Jan, Feb, and so on) |
| ${NAME} | Name of the new entity(file, class, interface, and so on) |
| ${ORGANIZATION_NAME} | Name of your organization specified in the project settings(Ctrl+Shift+Alt+S) |
| ${PRODUCT_NAME} | Name of the IDE(for example, PyCharm) |
| ${PROJECT_NAME} | Name of the current project |
| ${TIME} | Current system time |
| ${USER} | Login name of the current user |
| ${YEAR} | Current year |
预设模板变量
下表预设的变量可用在文档模板中:
| 变量 | 描述 |
| ${DATE} | 当前系统日期 |
| ${DAY} | 某个月的当前日 |
| ${DS} | Dollar符$。这个变量用来转义dollar字符,这样它就不会被视为模板变量的前缀 |
| ${FILE_NAME} | 新文件的名称 |
| ${HOUR} | 当前小时 |
| ${MINUTE} | 当前分钟 |
| ${MONTH} | 当前月份 |
| ${MONTH_NAME_FULL} | 当前月份的全称(January, February, 依此类推) |
| ${MONTH_NAME_SHORT} | 当前月份名称的头三个字母(Jan, Feb, 依此类推) |
| ${NAME} | 新实体的名称(文档,类,界面,依此类推) |
| ${ORGANIZATION_NAME} | 在项目设定中指定的单位名称(Ctrl+Shift+Alt+S) |
| ${PRODUCT_NAME} | IDE名称(如:PyCharm) |
| ${PROJECT_NAME} | 当前的项目名 |
| ${TIME} | 当前系统时间 |
| ${USER} | 当前用户的登录名 |
| ${YEAR} | 当前年份 |
Custom template variables
Besides predefined template variables, it is possible to specify custom variables. If necessary, you can define the values of custom variables right in the template using the #set directive.
For example, if you want to use your full name instead of your login name defined through the predefined variable ${USER}, use the following construct:
#set( $MyName = "John Smith" )
If the value of a variable is not defined in the template, PyCharm will ask you to specify it when the template is applied.
定制的模板变量
除了预设定的模板变量,定制的变量也是可以的。必要的话,你可以在模板中使用#set指令自定义一些变量的值。
举例,如果你想通过预设变量${USER}用你的全名替代你的登录名,就使用下面的语法结构:
#set( $MyName = "John Smith" )
在模板中,如果变量的值没有定义的话,当模板应用后PyCharm会要求你进行设定。
下面我们用PyCharm看下实例


Pycharm文档模板变量的更多相关文章
- 魔改——MFC MDI程序 定制 文档模板 运行时全部打开 禁用关闭按钮
==================================声明================================== 本文原创,转载在正文中显要的注明作者和出处,并保证文章的完 ...
- DDD领域驱动设计 - 设计文档模板
设计文档模板: 系统背景和定位 业务需求描述 系统用例图 关键业务流程图 领域语言整理,主要是整理领域中的各种术语的定义,名词解释 领域划分(分析出子域.核心域.支撑域) 每个子域的领域模型设计(实体 ...
- “Word自动更改后的内容保存到通用文档模板上。是否加载该模板?“的解决办法
在win7系统下,Word2010出现了不能正常关闭.打开一个已有word文档,点击右上角关闭按钮后,先提示"word已停止工作,windows正在检查该问题的解决方案",随后提示 ...
- 自定义WIZ文档模板
WIZ文档模板 1.在wiz笔记里面新建一个笔记,并将其做成一个模板 例子: 2.该作为模板的笔记制作完成后,右键-高级-另存为 导出为html格式 3.将导出的文件和文件夹(有时候只有一个htm文 ...
- Java中常用到的文件操作那些事(一)——替换doc文档模板,生成真实合同案例
工作中,我们时常会遇到一些操作文件的操作,比如在线生成合同模板,上传/下载/解析Excel,doc文档转为pdf等操作.本文就已工作中遇到的在线生成合同为例,简要地介绍一种文档替换写法. 本文目的:给 ...
- Dynamics CRM 2015/2016新特性之七:有了文档模板,打印分析So Easy
关注本人微信和易信公众号: 微软动态CRM专家罗勇 ,回复190或者20160216可方便获取本文,同时可以在第一时间得到我发布的最新的博文信息,follow me! 从CRM 2015 UR1开始, ...
- Python之word文档模板套用 - 真正的模板格式套用
Python之word文档模板套用: 1 ''' 2 #word模板套用2:套用模板 3 ''' 4 5 #导入所需库 6 from docx import Document 7 ''' 8 #另存w ...
- KnockOut文档--模板绑定
目的 模板绑定使用数据render模板,然后把渲染的结果填充到Dom树中.模板通过重复或嵌套块(通常为您的视图模型数据的函数)用一种简单,方便的方式来建立复杂的UI结构 . 有两种方式使用模板: Na ...
- 五分钟轻松搞定产品需求文档!这可能史上最全PRD文档模板
本文由 @JustWu 原创发布于社区 为什么写这篇文章? 第一:写PMCAFF的PRD文档,大家都是用户,比较好参考与理解,方便大家来找我写的不好的地方. 第二:我在自学PRD文档的编写过程中,总 ...
随机推荐
- mysql查找表名
SELECT *FROM information_schema.TABLESWHERE 1=1 AND table_name LIKE '%order%' AND table_comment like ...
- 【leetcode】1008. Construct Binary Search Tree from Preorder Traversal
题目如下: Return the root node of a binary search tree that matches the given preorder traversal. (Recal ...
- centos7下安装storm步骤
前言 真是后知后觉,最近忙也要学习,把以前丢的都要拾起来.原理懂不懂也把环境搭起来学习. 环境 centos7 jdk 1.8 zookeeper 3.4.13 storm 1.2.2 安装 ...
- 一双木棋(chess)
一双木棋(chess) 题目描述 菲菲和牛牛在一块 nn 行 mm 列的棋盘上下棋,菲菲执黑棋先手,牛牛执白棋后手. 棋局开始时,棋盘上没有任何棋子,两人轮流在格子上落子,直到填满棋盘时结束.落子的规 ...
- MySQL按首字母查询
DELIMITER $$ CREATE /*[DEFINER = { user | CURRENT_USER }]*/ ))) CHARSET utf8 BEGIN ); ); )); SET V_R ...
- 【转】 Linux 命令解释(Linux基础二)
前言 对服务器来讲,图形界面会占用更多的系统资源,而且会安装更多的服务.开放更多的端口,这对服务器的稳定性和安全性都有负面影响.其实,服务器是一个连显示器都没有的家伙,要图形界面干十么? 说到这里,有 ...
- java继承方法覆盖
public class TestB { private void f() { System.out.println("TestB"); } public static void ...
- nginx配置相关问题
1. nginx配置ssl相关问题 1.1 报错nginx: [emerg] the "ssl" parameter requires ngx_http_ssl_module in ...
- PHP DOMDocument操作 XML类 属性、方法
属性: Attributes 存储节点的属性列表(只读) childNodes 存储节点的子节点列表(只读) dataType 返回此节点的数据类型 Definition 以DTD或XML模式给出的节 ...
- 1.OpenCV数据类型
基础类型 1.模板类cv::Vec<> 固定向量类,维度已知的小型向量——处理效率高 2.cv::Point类(Point2i,Point2f,Point2d;Point3i,Point3 ...