Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Han Support https://hanzi.pro/ #1558 #1222 #698 #1598

Merged
merged 2 commits into from
Apr 19, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,6 @@ source/lib/font-awesome/scss/

source/lib/ua-parser-js/*
!source/lib/ua-parser-js/dist/

source/lib/Han/*
!source/lib/Han/dist/
7 changes: 7 additions & 0 deletions _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,9 @@ mathjax:
cdn: //cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML


# Han Support docs: https://hanzi.pro/
han: false

# Swiftype Search API Key
#swiftype_key:

Expand Down Expand Up @@ -545,6 +548,10 @@ vendors:
# https://github.com/zproo/canvas-ribbon
canvas_ribbon:

# Internal version: 3.3.0
# https://github.com/ethantw/Han
han:



# Assets
Expand Down
3 changes: 2 additions & 1 deletion bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
"fastclick": "~1.0.6",
"font-awesome": "fontawesome#*",
"jquery_lazyload": "jquery.lazyload#~1.9.7",
"ua-parser-js": "~0.7.9"
"ua-parser-js": "~0.7.9",
"Han": "^3.3.0"
}
}
2 changes: 1 addition & 1 deletion layout/_macro/post.swig
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@
{% endif %}


<div class="post-body" itemprop="articleBody">
<div class="post-body han-init-context" itemprop="articleBody">
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where is the switch for han-init-context?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's just a hook. When Han is not enabled, it will not have any effect.

Copy link
Collaborator

@ivan-nginx ivan-nginx Apr 20, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But it's will be in default class style. It was hard to do this?

<div class="post-body{% if theme.han %} han-init-context{% endif %}" itemprop="articleBody">

Copy link
Contributor Author

@geekrainy geekrainy Apr 20, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your suggestion. :) 756c49c

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In ideal, this switches must be anywhere on any custom options.


{# Gallery support #}
{% if post.photos and post.photos.length %}
Expand Down
9 changes: 9 additions & 0 deletions layout/_partials/head.swig
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,15 @@
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"/>


{% if theme.han %}
{% set Han_uri = url_for(theme.vendors._internal + '/Han/dist/han.min.css?v=3.3') %}
{% if theme.vendors.Han %}
{% set Han_uri = theme.vendors.Han %}
{% endif %}
<link rel="stylesheet" media="all" href="{{ Han_uri }}">
{% endif %}


{# #238, Disable Baidu tranformation #}
<meta http-equiv="Cache-Control" content="no-transform" />
<meta http-equiv="Cache-Control" content="no-siteapp" />
Expand Down
3 changes: 3 additions & 0 deletions source/css/_common/components/third-party/han.styl
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.fa {
font-family: FontAwesome!important;
}
1 change: 1 addition & 0 deletions source/css/_common/components/third-party/third-party.styl
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
@import "duoshuo";
@import "gentie";
@import "jiathis";
@import "han";
@import "baidushare";
@import "localsearch";
@import "busuanzi-counter";
Expand Down
Binary file added source/lib/Han/dist/font/han-space.otf
Binary file not shown.
Binary file added source/lib/Han/dist/font/han-space.woff
Binary file not shown.
Binary file added source/lib/Han/dist/font/han.otf
Binary file not shown.
Binary file added source/lib/Han/dist/font/han.woff
Binary file not shown.
Loading