Skip to content

Commit

Permalink
feat: update docs, add license config
Browse files Browse the repository at this point in the history
  • Loading branch information
kitian616 committed Jun 23, 2018
1 parent 0c3c5e1 commit 84c58d0
Show file tree
Hide file tree
Showing 13 changed files with 121 additions and 16 deletions.
3 changes: 3 additions & 0 deletions _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,9 @@ paths:
excerpt_separator: <!--more-->
excerpt_type: html # text (default), html

## license
license: CC-BY-4.0 # "CC-BY-4.0", "CC-BY-SA-4.0", "CC-BY-NC-4.0", "CC-BY-ND-4.0"

## TOC
toc:
selectors: # "h1,h2,h3" (default)
Expand Down
16 changes: 16 additions & 0 deletions _data/licenses.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
CC-BY-4.0:
name: Attribution 4.0 International
url: https://creativecommons.org/licenses/by/4.0/
image: https://i.creativecommons.org/l/by/4.0/88x31.png
CC-BY-SA-4.0:
name: Attribution-ShareAlike 4.0 International
url: https://creativecommons.org/licenses/by-sa/4.0/
image: https://i.creativecommons.org/l/by-sa/4.0/88x31.png
CC-BY-NC-4.0:
name: Attribution-NonCommercial 4.0 International
url: https://creativecommons.org/licenses/by-nc/4.0/
image: https://i.creativecommons.org/l/by-nc/4.0/88x31.png
CC-BY-ND-4.0:
name: Attribution-NoDerivatives 4.0 International
url: https://creativecommons.org/licenses/by-nd/4.0/
image: https://i.creativecommons.org/l/by-nd/4.0/88x31.png
38 changes: 24 additions & 14 deletions _includes/article-footer/license.html
Original file line number Diff line number Diff line change
@@ -1,14 +1,24 @@
<div class="license">
{%- assign locale = site.data.locale -%}
{%- assign __locale = locale.LICENSE_ANNOUNCE -%}
{%- include snippets/locale-to-string.html -%}
{%- assign _license_announce = __return -%}
{%- assign __path = '/assets/images/license-cc4.png' -%}
{%- include snippets/prepend-baseurl.html -%}
{%- assign _license_img_src = __return -%}
<p>{{ _license_announce | replace: "[LICENSE]", '<a rel="license" href="http://creativecommons.org/licenses/by-nc/4.0/">CC-BY-NC-4.0</a>' }}
<a rel="license" href="http://creativecommons.org/licenses/by-nc/4.0/">
<img alt="Creative Commons License" src="{{ _license_img_src }}" />
</a>
</p>
</div>
{%- assign __locale = site.data.locale.LICENSE_ANNOUNCE -%}
{%- include snippets/locale-to-string.html -%}
{%- assign _license_announce = __return -%}

{%- assign _data_license = site.data.licenses-%}
{%- if site.license -%}
{%- assign _license = _data_license[site.license] -%}
{%- endif -%}
{%- if page.license != true -%}
{%- assign _license = _data_license[page.license] -%}
{%- endif -%}


{%- if _license -%}

{%-assign _license_name = '<a rel="license" href="[URL]">[NAME]</a>' | replace: "[URL]", _license.url | replace: "[NAME]", _license.name -%}
<div class="license">
<p>{{ _license_announce | replace: "[LICENSE]", _license_name }}
<a rel="license" href="{{ _license.url }}">
<img alt="{{ _license.name }}" src="{{ _license.image }}" />
</a>
</p>
</div>
{%- endif -%}
3 changes: 3 additions & 0 deletions docs/_config.dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,9 @@ paths:
excerpt_separator: <!--more-->
excerpt_type: html # text (default), html

## license
license: CC-BY-4.0 # "CC-BY-4.0", "CC-BY-SA-4.0", "CC-BY-NC-4.0", "CC-BY-ND-4.0"

## TOC
toc:
selectors: "h1,h2,h3,h4,h5,h6" # "h1,h2,h3" (default)
Expand Down
3 changes: 3 additions & 0 deletions docs/_config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,9 @@ paths:
excerpt_separator: <!--more-->
excerpt_type: html # text (default), html

## license
license: CC-BY-4.0 # "CC-BY-4.0", "CC-BY-SA-4.0", "CC-BY-NC-4.0", "CC-BY-ND-4.0"

## TOC
toc:
selectors: # "h1,h2,h3" (default)
Expand Down
16 changes: 16 additions & 0 deletions docs/_data/licenses.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
CC-BY-4.0:
name: Attribution 4.0 International
url: https://creativecommons.org/licenses/by/4.0/
image: https://i.creativecommons.org/l/by/4.0/88x31.png
CC-BY-SA-4.0:
name: Attribution-ShareAlike 4.0 International
url: https://creativecommons.org/licenses/by-sa/4.0/
image: https://i.creativecommons.org/l/by-sa/4.0/88x31.png
CC-BY-NC-4.0:
name: Attribution-NonCommercial 4.0 International
url: https://creativecommons.org/licenses/by-nc/4.0/
image: https://i.creativecommons.org/l/by-nc/4.0/88x31.png
CC-BY-ND-4.0:
name: Attribution-NoDerivatives 4.0 International
url: https://creativecommons.org/licenses/by-nd/4.0/
image: https://i.creativecommons.org/l/by-nd/4.0/88x31.png
8 changes: 8 additions & 0 deletions docs/en/2.1-configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,14 @@ excerpt_separator: <!--more-->
excerpt_type: text # text (default), html
```

### License

| Name | License |
| CC-BY-4.0 | [Attribution 4.0 International](https://creativecommons.org/licenses/by/4.0/) |
| CC-BY-SA-4.0 | [Attribution-ShareAlike 4.0 International](https://creativecommons.org/licenses/by-sa/4.0/) |
| CC-BY-NC-4.0 | [Attribution-NonCommercial 4.0 International](https://creativecommons.org/licenses/by-nc/4.0/) |
| CC-BY-ND-4.0 | [Attribution-NoDerivatives 4.0 International](https://creativecommons.org/licenses/by-nd/4.0/) |

### TOC

Elements to use as headings.
Expand Down
2 changes: 2 additions & 0 deletions docs/en/2.3-layouts.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ Base on Base Layout.
| **lang** | en | Language of this page |
| **show_header** | true(default), false | Set as `false` to hide header on this page |
| **show_title** | true(default), false | Set as `false` to hide title on this page |
| **show_edit_on_github** | true, false(default) | Set as `true` to show "Edit on Github" button. you need set `repository` and `repository_tree` in _config.yml first |
| **full_width** | true, false(default) | Set as `true` to make main full width on this page |
| **comment** | true(default), false | Set as `false` to disable comment on this page |
| **mathjax** | true, false(default) | Set as `true` to enable Mathjax on this page |
Expand All @@ -52,6 +53,7 @@ Base on Page Layout.

| Variable | Option Values | Description |
| **modify_date** | - | The last modified date of this article, the date is modified in the format `YYYY-MM-DD HH:MM:SS +/-TTTT`; hours, minutes, seconds, and timezone offset are optional. just like `date` variable |
| **license** | true, false, "CC-BY-4.0", "CC-BY-SA-4.0", "CC-BY-NC-4.0", "CC-BY-ND-4.0" | license of the article. Set true to use `license` variable setted in _config.yml, set false to enable it |

## Home Layout

Expand Down
13 changes: 12 additions & 1 deletion docs/en/3.3-additional-styles.md
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ Error Text.
| Type | Class Names |
| ---- | ---- |
| **base** | button |
| **type** | button\-\-primary, button\-\-secondary, button\-\-success, button\-\-info, button\-\-warning, button\-\-error |
| **type** | button\-\-primary, button\-\-secondary, button\-\-success, button\-\-info, button\-\-warning, button\-\-error, button\-\-outline\-primary, button\-\-outline\-secondary, button\-\-outline\-success, button\-\-outline\-info, button\-\-outline\-warning, button\-\-outline\-error |
| **shape** | button\-\-pill, button\-\-rounded, button\-\-circle |
| **size** | button\-\-md(default), button\-\-sm, button\-\-lg |

Expand Down Expand Up @@ -183,6 +183,17 @@ Error Text.
</div>
</div>

<div class="grid">
<div class="row">
<div class="col-3 col-md-3 col-sm-12" markdown="1">
[BUTTON](#){:.button.button--outline-success.button--pill}
</div>
<div class="col-9 col-md-9 col-sm-12 pl-2" markdown="1">
[BUTTON](#){:.button.button--outline-success.button--pill}
</div>
</div>
</div>

### Shape

<div class="grid">
Expand Down
8 changes: 8 additions & 0 deletions docs/zh/2.1-configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,14 @@ excerpt_separator: <!--more-->
excerpt_type: text # text (default), html
```

### 许可协议

| 名称 | 许可协议 |
| CC-BY-4.0 | [Attribution 4.0 International](https://creativecommons.org/licenses/by/4.0/) |
| CC-BY-SA-4.0 | [Attribution-ShareAlike 4.0 International](https://creativecommons.org/licenses/by-sa/4.0/) |
| CC-BY-NC-4.0 | [Attribution-NonCommercial 4.0 International](https://creativecommons.org/licenses/by-nc/4.0/) |
| CC-BY-ND-4.0 | [Attribution-NoDerivatives 4.0 International](https://creativecommons.org/licenses/by-nd/4.0/) |

### 目录

作为文章目录的元素。
Expand Down
2 changes: 2 additions & 0 deletions docs/zh/2.3-layouts.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ graph TB;
| **lang** | en | 该页的语言 |
| **show_header** | true(default), false | 该页是否显示 Header, 设置为 `false` 隐藏 |
| **show_title** | true(default), false | 该页是否显示标题,默认显示,设置为 `false` 隐藏 |
| **show_edit_on_github** | true, false(default) | 该页是否显示“在 Github 上修改”按钮,设置为 `true` 显示。你需要先在 _config.yml 中设置 `repository``repository_tree` |
| **full_width** | true, false(default) | 该页内容是否占据全部宽度,设置为 `true` 开启 |
| **comment** | true(default), false | 该页是否开启评论支持,默认开启,设置为 `false` 关闭 |
| **mathjax** | true, false(default) | 该页是否开启 Mathjax 公式支持,默认关闭,设置为 `true` 开启 |
Expand All @@ -52,6 +53,7 @@ graph TB;

| Variable | Option Values | Description |
| **modify_date** | - | 该文章的最后修改时间, 其格式为 `YYYY-MM-DD HH:MM:SS +/-TTTT``date` 的格式相同 |
| **license** | true, false, "CC-BY-4.0", "CC-BY-SA-4.0", "CC-BY-NC-4.0", "CC-BY-ND-4.0" | 该文章的许可协议。设置为 `true` 使用在 _config.yml 中设置的 `license` 值,设置为 `false` 不使用许可协议 |

## Home 布局

Expand Down
13 changes: 12 additions & 1 deletion docs/zh/3.3-additional-styles.md
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ Error Text.
| 类别 | 样式名称 |
| ---- | ---- |
| **base** | button |
| **type** | button\-\-primary, button\-\-secondary, button\-\-success, button\-\-info, button\-\-warning, button\-\-error |
| **type** | button\-\-primary, button\-\-secondary, button\-\-success, button\-\-info, button\-\-warning, button\-\-error, button\-\-outline\-primary, button\-\-outline\-secondary, button\-\-outline\-success, button\-\-outline\-info, button\-\-outline\-warning, button\-\-outline\-error |
| **shape** | button\-\-pill, button\-\-rounded, button\-\-circle |
| **size** | button\-\-md(default), button\-\-sm, button\-\-lg |

Expand Down Expand Up @@ -183,6 +183,17 @@ Error Text.
</div>
</div>

<div class="grid">
<div class="row">
<div class="col-3 col-md-3 col-sm-12" markdown="1">
[BUTTON](#){:.button.button--outline-success.button--pill}
</div>
<div class="col-9 col-md-9 col-sm-12 pl-2" markdown="1">
[BUTTON](#){:.button.button--outline-success.button--pill}
</div>
</div>
</div>

### Shape

<div class="grid">
Expand Down
12 changes: 12 additions & 0 deletions test/_posts/2017-08-08-additional-styles.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,14 +71,26 @@ Error Text.
| ---- | ---- | ---- | ---- | ---- | ---- |
| [BUTTON](#){:.button.button--primary.button--pill} | [BUTTON](#){:.button.button--secondary.button--pill} | [BUTTON](#){:.button.button--success.button--pill} | [BUTTON](#){:.button.button--info.button--pill} | [BUTTON](#){:.button.button--warning.button--pill} | [BUTTON](#){:.button.button--error.button--pill} |

| Primary | Secondary | Success | Info | Warning | Error |
| ---- | ---- | ---- | ---- | ---- | ---- |
| [BUTTON](#){:.button.button--outline-primary.button--pill} | [BUTTON](#){:.button.button--outline-secondary.button--pill} | [BUTTON](#){:.button.button--outline-success.button--pill} | [BUTTON](#){:.button.button--outline-info.button--pill} | [BUTTON](#){:.button.button--outline-warning.button--pill} | [BUTTON](#){:.button.button--outline-error.button--pill} |

| Primary | Secondary | Success | Info | Warning | Error |
| ---- | ---- | ---- | ---- | ---- | ---- |
| [BUTTON](#){:.button.button--primary.button--rounded} | [BUTTON](#){:.button.button--secondary.button--rounded} | [BUTTON](#){:.button.button--success.button--rounded} | [BUTTON](#){:.button.button--info.button--rounded} | [BUTTON](#){:.button.button--warning.button--rounded} | [BUTTON](#){:.button.button--error.button--rounded} |

| Primary | Secondary | Success | Info | Warning | Error |
| ---- | ---- | ---- | ---- | ---- | ---- |
| [BUTTON](#){:.button.button--outline-primary.button--rounded} | [BUTTON](#){:.button.button--outline-secondary.button--rounded} | [BUTTON](#){:.button.button--outline-success.button--rounded} | [BUTTON](#){:.button.button--outline-info.button--rounded} | [BUTTON](#){:.button.button--outline-warning.button--rounded} | [BUTTON](#){:.button.button--outline-error.button--rounded} |

| Primary | Secondary | Success | Info | Warning | Error |
| ---- | ---- | ---- | ---- | ---- | ---- |
| [X](#){:.button.button--primary.button--circle} | [X](#){:.button.button--secondary.button--circle} | [X](#){:.button.button--success.button--circle} | [X](#){:.button.button--info.button--circle} | [X](#){:.button.button--warning.button--circle} | [X](#){:.button.button--error.button--circle} |

| Primary | Secondary | Success | Info | Warning | Error |
| ---- | ---- | ---- | ---- | ---- | ---- |
| [X](#){:.button.button--outline-primary.button--circle} | [X](#){:.button.button--outline-secondary.button--circle} | [X](#){:.button.button--outline-success.button--circle} | [X](#){:.button.button--outline-info.button--circle} | [X](#){:.button.button--outline-warning.button--circle} | [X](#){:.button.button--outline-error.button--circle} |

| Small | Middle | Large |
| ---- | ---- | ---- |
| [BUTTON](#){:.button.button--secondary.button--pill.button--sm} | [BUTTON](#){:.button.button--secondary.button--pill.button--md} | [BUTTON](#){:.button.button--secondary.button--pill.button--lg} |
Expand Down

0 comments on commit 84c58d0

Please sign in to comment.