Skip to content
This repository was archived by the owner on Apr 10, 2022. It is now read-only.

Commit 974d035

Browse files
committed
Close #7
1 parent c238f89 commit 974d035

File tree

3 files changed

+9
-1
lines changed

3 files changed

+9
-1
lines changed

doc.md

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
- `@hiplot` - 1 行,后面接 `start``end` 用来表示插件注释的起始和结束位置。
1010
- `@appname` - 1 行,你的插件名字,显示为 Hiplot 网站 URL 最后一栏名字,例如 `diy-gsea` 对应到 <https://hiplot.com.cn/basic/diy-gsea>。插件名使用小写字母和数字的组合,如果要组合不同的单词请使用短斜线`-`
11+
- `@alias` - 1行,你的插件的别名,显示在插件右侧边栏,**一般**使用首字母大写英文词,词中间使用短杠连接,例如:`Area-Chart`。当没有指定时,默认使用`@appname`指定的名字。
1112
- `@apptitle` - 3 行,你的插件标题,一句话介绍你的插件。 输入 `@apptitle` 后重新起始一行开始输入文字。
1213
- 第 2 行设置英文标题。
1314
- 第 3 行设置中文标题。

examples/helloworld.R

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
#
33
# @hiplot start
44
# @appname helloworld
5+
# @alias An-Example
56
# @apptitle
67
# Hiplot Hello World
78
# Hiplot 示例插件

hisub.R

+7-1
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,11 @@
1010
# 6. 基于配置和输入文件生成 plot.R
1111
#
1212
# ./hisub.R examples/helloworld.R test_hello
13-
VERSION <- 0.2
13+
VERSION <- 0.3
1414

1515
TEMPLATE <- '# @hiplot start
1616
# @appname helloworld
17+
# @alias An-Example
1718
# @apptitle
1819
# Hiplot Hello World
1920
# Hiplot 示例插件
@@ -157,6 +158,9 @@ parse_tag_header <- function(x) sub("# *@[^ ]+ +", "", x[1])
157158
parse_tag_appname <- function(x) {
158159
list(type = "appname", value = parse_tag_value(x))
159160
}
161+
parse_tag_alias <- function(x) {
162+
list(type = "alias", value = parse_tag_header(x))
163+
}
160164
parse_tag_apptitle <- function(x) {
161165
list(
162166
type = "apptitle",
@@ -331,6 +335,7 @@ parse_tag <- function(x, name) {
331335
switch(
332336
name,
333337
appname = parse_tag_appname(x),
338+
alias = parse_tag_alias(x),
334339
apptitle = parse_tag_apptitle(x),
335340
target = parse_tag_target(x),
336341
tag = parse_tag_tag(x),
@@ -527,6 +532,7 @@ a$params <- collect_params(a)
527532
# Metadata for the plugin
528533
json_meta <- list(
529534
name = list(zh_cn = a$apptitle$value$zh, en = a$apptitle$value$en),
535+
alias = if (is.null(a$alias$value)) list(a$appname$value) else list(a$alias$value),
530536
intro = list(zh_cn = a$description$value$zh, en = a$description$value$en),
531537
src = "",
532538
href = paste0("/", a$target$value, "/", a$appname$value),

0 commit comments

Comments
 (0)