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

Commit

Permalink
Close #7
Browse files Browse the repository at this point in the history
  • Loading branch information
ShixiangWang committed May 25, 2021
1 parent c238f89 commit 974d035
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
1 change: 1 addition & 0 deletions doc.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

- `@hiplot` - 1 行,后面接 `start``end` 用来表示插件注释的起始和结束位置。
- `@appname` - 1 行,你的插件名字,显示为 Hiplot 网站 URL 最后一栏名字,例如 `diy-gsea` 对应到 <https://hiplot.com.cn/basic/diy-gsea>。插件名使用小写字母和数字的组合,如果要组合不同的单词请使用短斜线`-`
- `@alias` - 1行,你的插件的别名,显示在插件右侧边栏,**一般**使用首字母大写英文词,词中间使用短杠连接,例如:`Area-Chart`。当没有指定时,默认使用`@appname`指定的名字。
- `@apptitle` - 3 行,你的插件标题,一句话介绍你的插件。 输入 `@apptitle` 后重新起始一行开始输入文字。
- 第 2 行设置英文标题。
- 第 3 行设置中文标题。
Expand Down
1 change: 1 addition & 0 deletions examples/helloworld.R
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#
# @hiplot start
# @appname helloworld
# @alias An-Example
# @apptitle
# Hiplot Hello World
# Hiplot 示例插件
Expand Down
8 changes: 7 additions & 1 deletion hisub.R
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,11 @@
# 6. 基于配置和输入文件生成 plot.R
#
# ./hisub.R examples/helloworld.R test_hello
VERSION <- 0.2
VERSION <- 0.3

TEMPLATE <- '# @hiplot start
# @appname helloworld
# @alias An-Example
# @apptitle
# Hiplot Hello World
# Hiplot 示例插件
Expand Down Expand Up @@ -157,6 +158,9 @@ parse_tag_header <- function(x) sub("# *@[^ ]+ +", "", x[1])
parse_tag_appname <- function(x) {
list(type = "appname", value = parse_tag_value(x))
}
parse_tag_alias <- function(x) {
list(type = "alias", value = parse_tag_header(x))
}
parse_tag_apptitle <- function(x) {
list(
type = "apptitle",
Expand Down Expand Up @@ -331,6 +335,7 @@ parse_tag <- function(x, name) {
switch(
name,
appname = parse_tag_appname(x),
alias = parse_tag_alias(x),
apptitle = parse_tag_apptitle(x),
target = parse_tag_target(x),
tag = parse_tag_tag(x),
Expand Down Expand Up @@ -527,6 +532,7 @@ a$params <- collect_params(a)
# Metadata for the plugin
json_meta <- list(
name = list(zh_cn = a$apptitle$value$zh, en = a$apptitle$value$en),
alias = if (is.null(a$alias$value)) list(a$appname$value) else list(a$alias$value),
intro = list(zh_cn = a$description$value$zh, en = a$description$value$en),
src = "",
href = paste0("/", a$target$value, "/", a$appname$value),
Expand Down

0 comments on commit 974d035

Please sign in to comment.