python-visualization / python-visualization/folium
Add template parameters to JsCode objects
还没有人认领这个 Issue。
- 主要语言
- Python
- 星标
- 7.4k
- 派生
- 2.3k
- 平均合并
- 17 小时 22 分钟
- 30 天内合并 PR
- 11
描述
Is your feature request related to a problem? Please describe.
I'd like to be able to refer to other folium /leaflet objects inside a JsCode object. So far I have been using string interpolation inside the body of the JsCode object.
Describe the solution you'd like
I'd like to add parameters to the JsCode __init__ method, together with a basic string templating solution. For the string templating I'd prefer to use the good-old %(name)s format.
Describe alternatives you've considered
I considered using the newer formatting templates such as used in python format, or Jinja templates. However, due to brace heavy nature of javascript, I think a completely new variable marker will lead to more readable code.
Implementation
folium is maintained by volunteers. Can you help make a PR if we want to implement this feature?
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
首先阅读 JsCode init 入口点以及 JsCode 主体中当前对字符串插值的使用方式。将所请求的 %(name)s 参数行为与现有的 JavaScript 生成方式进行比较。当 JsCode 接受参数并使用提议的基本模板格式对其进行渲染,同时为新行为提供覆盖测试时,即可视为完成。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- javascript, python
- 领域
- data-visualization, web-dev
- Issue 类型
- 功能
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 35/100