diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..45c1505 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +_site +.sass-cache +.jekyll-metadata diff --git a/404.html b/404.html new file mode 100644 index 0000000..c472b4e --- /dev/null +++ b/404.html @@ -0,0 +1,24 @@ +--- +layout: default +--- + + + +
+

404

+ +

Page not found :(

+

The requested page could not be found.

+
diff --git a/Gemfile b/Gemfile new file mode 100644 index 0000000..9d2f64d --- /dev/null +++ b/Gemfile @@ -0,0 +1,30 @@ +source "https://rubygems.org" + +# Hello! This is where you manage which Jekyll version is used to run. +# When you want to use a different version, change it below, save the +# file and run `bundle install`. Run Jekyll with `bundle exec`, like so: +# +# bundle exec jekyll serve +# +# This will help ensure the proper Jekyll version is running. +# Happy Jekylling! +gem "jekyll", "~> 3.8.4" + +# This is the default theme for new Jekyll sites. You may change this to anything you like. +gem "minima", "~> 2.0" + +# If you want to use GitHub Pages, remove the "gem "jekyll"" above and +# uncomment the line below. To upgrade, run `bundle update github-pages`. +# gem "github-pages", group: :jekyll_plugins + +# If you have any plugins, put them here! +group :jekyll_plugins do + gem "jekyll-feed", "~> 0.6" +end + +# Windows does not include zoneinfo files, so bundle the tzinfo-data gem +gem "tzinfo-data", platforms: [:mingw, :mswin, :x64_mingw, :jruby] + +# Performance-booster for watching directories on Windows +gem "wdm", "~> 0.1.0" if Gem.win_platform? + diff --git a/Gemfile.lock b/Gemfile.lock new file mode 100644 index 0000000..a77bb6d --- /dev/null +++ b/Gemfile.lock @@ -0,0 +1,78 @@ +GEM + remote: https://rubygems.org/ + specs: + addressable (2.7.0) + public_suffix (>= 2.0.2, < 5.0) + colorator (1.1.0) + concurrent-ruby (1.1.8) + em-websocket (0.5.2) + eventmachine (>= 0.12.9) + http_parser.rb (~> 0.6.0) + eventmachine (1.2.7-x64-mingw32) + ffi (1.14.2-x64-mingw32) + forwardable-extended (2.6.0) + http_parser.rb (0.6.0) + i18n (0.9.5) + concurrent-ruby (~> 1.0) + jekyll (3.8.7) + addressable (~> 2.4) + colorator (~> 1.0) + em-websocket (~> 0.5) + i18n (~> 0.7) + jekyll-sass-converter (~> 1.0) + jekyll-watch (~> 2.0) + kramdown (= 2.3.1) + liquid (~> 4.0) + mercenary (~> 0.3.3) + pathutil (~> 0.9) + rouge (>= 1.7, < 4) + safe_yaml (~> 1.0) + jekyll-feed (0.15.1) + jekyll (>= 3.7, < 5.0) + jekyll-sass-converter (1.5.2) + sass (~> 3.4) + jekyll-seo-tag (2.7.1) + jekyll (>= 3.8, < 5.0) + jekyll-watch (2.2.1) + listen (~> 3.0) + kramdown (1.17.0) + liquid (4.0.3) + listen (3.4.1) + rb-fsevent (~> 0.10, >= 0.10.3) + rb-inotify (~> 0.9, >= 0.9.10) + mercenary (0.3.6) + minima (2.5.1) + jekyll (>= 3.5, < 5.0) + jekyll-feed (~> 0.9) + jekyll-seo-tag (~> 2.1) + pathutil (0.16.2) + forwardable-extended (~> 2.6) + public_suffix (4.0.6) + rb-fsevent (0.10.4) + rb-inotify (0.10.1) + ffi (~> 1.0) + rouge (3.26.0) + safe_yaml (1.0.5) + sass (3.7.4) + sass-listen (~> 4.0.0) + sass-listen (4.0.0) + rb-fsevent (~> 0.9, >= 0.9.4) + rb-inotify (~> 0.9, >= 0.9.7) + tzinfo (2.0.4) + concurrent-ruby (~> 1.0) + tzinfo-data (1.2021.1) + tzinfo (>= 1.0.0) + wdm (0.1.1) + +PLATFORMS + x64-mingw32 + +DEPENDENCIES + jekyll (~> 3.8.4) + jekyll-feed (~> 0.6) + minima (~> 2.0) + tzinfo-data + wdm (~> 0.1.0) + +BUNDLED WITH + 2.2.1 diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..48b74aa --- /dev/null +++ b/LICENSE @@ -0,0 +1,7 @@ +Copyright 2020 ShrekShao + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file diff --git a/_config.yml b/_config.yml new file mode 100644 index 0000000..196370a --- /dev/null +++ b/_config.yml @@ -0,0 +1,49 @@ +# Welcome to Jekyll! +# +# This config file is meant for settings that affect your whole blog, values +# which you are expected to set up once and rarely edit after that. If you find +# yourself editing this file very often, consider using Jekyll's data files +# feature for the data you need to update frequently. +# +# For technical reasons, this file is *NOT* reloaded automatically when you use +# 'bundle exec jekyll serve'. If you change this file, please restart the server process. + +# Site settings +# These are used to personalize your new site. If you look in the HTML files, +# you will see them accessed via {{ site.title }}, {{ site.email }}, and so on. +# You can create any custom variable you would like, and they will be accessible +# in the templates via {{ site.myvariable }}. +title: NCCSF +author: 北加州华人足球联盟 +# email: sul@sul.com +description: >- # this means to ignore newlines until "baseurl:" + 北加州华人足球联盟(Northern California Chinese Soccer Federation, aka NCCSF) 是由旧金山湾区华人球队共同发起成立的, 经美国联邦和加州政府认证的非盈利组织(501c.4 nonprofit organization)。 NCCSF 致力于发展华人社区群众足球运动,提高社区球员/球队数量及足球水平,促进社区球队/球员之间友好交流,从而达到提高足球运动在北加州/北美社区的普及度及增强华人体质的目标。 + 通过参与组织各类有有益社区的足球比赛及活动,NCCSF 力争为北加州华人社区足球队提供良好的后勤保障服务,为成员球队和广大足球爱好者打造一个资源共享的公共平台。 +baseurl: "" # the subpath of your site +url: "" # the base hostname & protocol for your site, e.g. http://example.com +lang: zh +languages: ["zh"] +exclude_from_localizations: ["_posts", javascript", "images", "css"] + +# Build settings +markdown: kramdown +theme: minima +plugins: + - jekyll-feed + - jekyll-seo-tag + +# Exclude from processing. +# The following items will not be processed, by default. Create a custom list +# to override the default setting. +exclude: + - Gemfile + - Gemfile.lock + - node_modules + - vendor/bundle/ + - vendor/cache/ + - vendor/gems/ + - vendor/ruby/ + - docs/ + +# exclude: + \ No newline at end of file diff --git a/_data/seasons/21s/config.json b/_data/seasons/21s/config.json new file mode 100644 index 0000000..42c870e --- /dev/null +++ b/_data/seasons/21s/config.json @@ -0,0 +1,6 @@ +{ + "display_name": "21夏", + "description": "2021年夏季联赛", + "type": "league", + "rules": "*本次联赛为友谊比赛,不计名次。\n*本次联赛有16支球队,分为A,B,两个小组,组内单循环赛制。各组比赛在不同场地进行,上场比赛人数也有不同要求\n*A组采用9人制, 在 Irvington Community Park (以下简称ICP) 举行, 地址:41885 Blacow Rd, Fremont, CA 94538\n*B组采用8人制, 在 Newark Sportsfield Park(以下简称Newark)举行, 地址: 6800 Mowry Avenue, Newark, CA 94560\n*比赛时间是90分钟,分上下半场各45分钟,中间休息10分钟" +} \ No newline at end of file diff --git a/_data/seasons/21s/games/2021-07-17-2.json b/_data/seasons/21s/games/2021-07-17-2.json new file mode 100644 index 0000000..f7b6bec --- /dev/null +++ b/_data/seasons/21s/games/2021-07-17-2.json @@ -0,0 +1,19 @@ +{ + "date": "2021-07-17 02:00PM", + "type": "#1", + "schedule": true, + "images": [ + ], + "home": { + "key": "CalBlue", + "score": 0, + "events": [ + ] + }, + "away": { + "key": "ICP", + "score": 0, + "events": [ + ] + } +} \ No newline at end of file diff --git a/_data/seasons/21s/teams/CalBlue.json b/_data/seasons/21s/teams/CalBlue.json new file mode 100644 index 0000000..ccd7ff9 --- /dev/null +++ b/_data/seasons/21s/teams/CalBlue.json @@ -0,0 +1,12 @@ +{ + "display_name": "CalBlue加蓝", + "description": "CalBlue是一支有20年历史,活跃在湾区的老牌华人足球劲旅。", + "logo": "teams/CalBlue/logo.jpg", + "image": "teams/CalBlue/team.jpg", + "players": { + "starting": [ + ], + "subs": [ + ] + } +} \ No newline at end of file diff --git a/_data/seasons/21s/teams/ICP.json b/_data/seasons/21s/teams/ICP.json new file mode 100644 index 0000000..19ceb15 --- /dev/null +++ b/_data/seasons/21s/teams/ICP.json @@ -0,0 +1,80 @@ +{ + "display_name": "ICP", + "description": "ICP成立于2017年,由一帮在Irvington Community Park租场踢PICKUP的朋友组成。第一次组队参加2017八人制联赛,喜获勇者组冠军。2018年与兄弟队联合组队参加北加足联西贡渔港足球杯长青组(40+),以黑马身份夺得长青组亚军。", + "logo": "teams/ICP/logo.png", + "image": "teams/ICP/team.jpg", + "players": { + "starting": [ + { + "number": 1, + "name": "名字", + "img": "teams/ICP/a/gk.jpg", + "position": "门将", + "locator": "GK" + } + ,{ + "number": 14, + "name": "名字", + "img": "teams/ICP/a/gk.jpg", + "position": "后卫", + "locator": "RCB" + } + ,{ + "number": 16, + "name": "名字", + "img": "teams/ICP/a/gk.jpg", + "position": "后卫", + "locator": "LB" + } + ,{ + "number": 55, + "name": "名字", + "img": "teams/ICP/a/gk.jpg", + "position": "后卫", + "locator": "RWB" + } + ,{ + "number": 4, + "name": "名字", + "img": "teams/ICP/a/gk.jpg", + "position": "中场", + "locator": "CDM" + } + ,{ + "number": 9, + "name": "名字", + "img": "teams/ICP/a/gk.jpg", + "position": "中场", + "locator": "LCM" + } + ,{ + "number": 10, + "name": "名字", + "img": "teams/ICP/a/gk.jpg", + "position": "前锋", + "locator": "LW" + } + ,{ + "number": 11, + "name": "名字", + "img": "teams/ICP/a/gk.jpg", + "position": "前锋", + "locator": "ST" + } + ], + "subs": [ + { + "number": 12, + "name": "名字", + "position": "前锋", + "locator": "LW" + } + ,{ + "number": 13, + "name": "名字", + "position": "前锋", + "locator": "ST" + } + ] + } +} \ No newline at end of file diff --git a/_data/seasons/21s/teams/OverPower.json b/_data/seasons/21s/teams/OverPower.json new file mode 100644 index 0000000..5ba6890 --- /dev/null +++ b/_data/seasons/21s/teams/OverPower.json @@ -0,0 +1,11 @@ +{ + "display_name": "OverPower加州风暴", + "description": "OverPower是一支由热爱足球的湾区华人青年组成的队伍,我们活跃于湾区各大足球比赛,成绩斐然,近三年来队伍不断壮大,成绩不断提高,成为北加成长最快的队伍。", + "logo": "teams/OverPower/logo.jpg", + "players": { + "starting": [ + ], + "subs": [ + ] + } +} \ No newline at end of file diff --git a/_i18n/en.yml b/_i18n/en.yml new file mode 100644 index 0000000..a74ab12 --- /dev/null +++ b/_i18n/en.yml @@ -0,0 +1,51 @@ +posts_title: Posts +schedule: Schedule +goal_scorers: Goal Scorers +season: Season +player: + photo: Pic + name: Name + team: Team + goals_penalty: | + Goals + (Penalty) + number: No. + position: Position + goals: Goals +champion: Champion +knockout_stage: Knockout Stage +group_stage: Group Stage +games_list: Games +table: + team_name: Team + played: Played + win: Wins + tie: Draws + lose: Loses + goals_for: GF + goals_against: GA + goals_diff: GD + avg: Avg + points: P + stats: Stats +games: + final: Final + 1/2: 1/2 Final + 1/2-final: 1/2 Final + semi-final: 1/2 Final + 1/4: 1/4 Final + 1/4-final: 1/4 Final + 1/8: 1/8 Final + 1/8-final: 1/8 Final + 1/16: 1/16 Final + 1/16-final: 1/16 Final + third-place-playoff: Third Place Playoff + rank-playoff: Ranking Playoff + group: Group + group-r1: Group Round 1 + group-r2: Group Round 2 + group-r3: Group Round 3 + group-r4: Group Round 4 + group-r5: Group Round 5 + group-r6: Group Round 6 + league: League \ No newline at end of file diff --git a/_i18n/zh.yml b/_i18n/zh.yml new file mode 100644 index 0000000..43844b3 --- /dev/null +++ b/_i18n/zh.yml @@ -0,0 +1,51 @@ +posts_title: 战报 +schedule: 赛程 +goal_scorers: 射手榜 +season: 赛季 +player: + photo: 头像 + name: 姓名 + team: 队伍 + goals_penalty: | + 进球数 + (点球) + number: 号码 + position: 位置 + goals: 进球 +champion: 冠军 +knockout_stage: 淘汰赛阶段 +group_stage: 小组赛阶段 +games_list: 比赛 +table: + team_name: 队名 + played: 场次 + win: 胜 + tie: 平 + lose: 负 + goals_for: 进球 + goals_against: 失球 + goals_diff: 净胜 + points: 积分 + avg: 场均 + stats: 统计 +games: + final: 决赛 + 1/2: 半决赛 + 1/2-final: 半决赛 + semi-final: 半决赛 + 1/4: 1/4决赛 + 1/4-final: 1/4决赛 + 1/8: 1/8决赛 + 1/8-final: 1/8决赛 + 1/16: 1/16决赛 + 1/16-final: 1/16决赛 + third-place-playoff: 三四名决赛 + rank-playoff: 排位赛 + group: 小组赛 + group-r1: 小组赛第1轮 + group-r2: 小组赛第2轮 + group-r3: 小组赛第3轮 + group-r4: 小组赛第4轮 + group-r5: 小组赛第5轮 + group-r6: 小组赛第6轮 + league: 联赛 \ No newline at end of file diff --git a/_includes/footer.html b/_includes/footer.html new file mode 100644 index 0000000..306f3c7 --- /dev/null +++ b/_includes/footer.html @@ -0,0 +1,37 @@ + diff --git a/_includes/game_lines.html b/_includes/game_lines.html new file mode 100644 index 0000000..4ee402f --- /dev/null +++ b/_includes/game_lines.html @@ -0,0 +1,16 @@ + +{{include.game.date}} +{% translate {{include.game.type | prepend: "games."}} %} + {{ include.game.home.display_name }} + + {% if include.game.schedule %} +  VS  + {% else %} + {{include.game.home.score}} + : + {{ include.game.away.score }} + {% endif %} + + {{include.game.away.display_name}} + +
\ No newline at end of file diff --git a/_includes/game_lines.md b/_includes/game_lines.md new file mode 100644 index 0000000..507c035 --- /dev/null +++ b/_includes/game_lines.md @@ -0,0 +1 @@ +{{include.game.date}} {% translate {{include.game.type | prepend: "games."}} %} {{ include.game.home.display_name }}{% if include.game.schedule %} VS {% else %}{{include.game.home.score}} : {{ include.game.away.score }}{% endif %}{{include.game.away.display_name}}
\ No newline at end of file diff --git a/_includes/game_link.html b/_includes/game_link.html new file mode 100644 index 0000000..0a4b3e2 --- /dev/null +++ b/_includes/game_link.html @@ -0,0 +1,9 @@ + + {{ include.game.home.display_name }} + + {{ include.game.home.score }} + : + {{ include.game.away.score }} + + {{include.game.away.display_name}} + \ No newline at end of file diff --git a/_includes/head.html b/_includes/head.html new file mode 100644 index 0000000..30d59d4 --- /dev/null +++ b/_includes/head.html @@ -0,0 +1,13 @@ + + + + + {%- seo -%} + + + {%- feed_meta -%} + {%- if jekyll.environment == 'production' and site.google_analytics -%} + {%- include google-analytics.html -%} + {%- endif -%} + + diff --git a/_includes/header.html b/_includes/header.html new file mode 100644 index 0000000..afe66f4 --- /dev/null +++ b/_includes/header.html @@ -0,0 +1,33 @@ + diff --git a/_includes/knockout_game_link.html b/_includes/knockout_game_link.html new file mode 100644 index 0000000..3048a41 --- /dev/null +++ b/_includes/knockout_game_link.html @@ -0,0 +1,12 @@ + + {% if include.game[1].schedule %} +  VS  + {% else %} + {{include.game[1].home.score}} + : + {{ include.game[1].away.score }} + {% endif %} + {% if include.game[1].extra != nil %} +   {{include.game[1].extra}} + {% endif %} + \ No newline at end of file diff --git a/_includes/player_table_line.html b/_includes/player_table_line.html new file mode 100644 index 0000000..4666dcb --- /dev/null +++ b/_includes/player_table_line.html @@ -0,0 +1,15 @@ + + {{ include.player.number }} + + {% if include.player.img != nil %} + + {% else %} + + {% endif %} + + + {{ include.player.name }} + {{ include.player.position }} + + {{ include.player.goals }} + \ No newline at end of file diff --git a/_includes/season_tabs.html b/_includes/season_tabs.html new file mode 100644 index 0000000..ac948bc --- /dev/null +++ b/_includes/season_tabs.html @@ -0,0 +1,13 @@ +

{{ include.name }}

+ +{% if include.description != nil %} +

{{include.description | newline_to_br}}

+{% endif %} + +
+ {% translate schedule %} +   + | +   + {% translate goal_scorers %} +
\ No newline at end of file diff --git a/_includes/squad.html b/_includes/squad.html new file mode 100644 index 0000000..09aae0c --- /dev/null +++ b/_includes/squad.html @@ -0,0 +1,13 @@ +
+ + + {% for player in include.squad %} + {% if player.locator != nil %} +
+ +

{{player.number}} {{player.name}}

+
+ {% endif %} + {% endfor %} + +
\ No newline at end of file diff --git a/_includes/team_link.html b/_includes/team_link.html new file mode 100644 index 0000000..9d7dd1a --- /dev/null +++ b/_includes/team_link.html @@ -0,0 +1,6 @@ +{% if include.team != nil %} + +{{ include.team.display_name }} +{% else %} +  +{% endif %} \ No newline at end of file diff --git a/_layouts/game.html b/_layouts/game.html new file mode 100644 index 0000000..56c8957 --- /dev/null +++ b/_layouts/game.html @@ -0,0 +1,75 @@ +--- +layout: page +--- + +
+
+ + +

+ + {{ page.game.home.display_name }} + +

+
+
+ + {% for event in page.game.home.events %} +

+ + {{event.time}}' + {{event.player}} +

+ {% endfor %} +
+ +
+

{% translate {{ page.game.type | prepend: "games."}} %}

+

{{ page.game.date }}

+ {% if page.game.schedule %} +

 VS 

+ {% else %} +

{{ page.game.home.score }} : {{ page.game.away.score }}

+ {% endif %} + {% if page.game.extra %} +

{{page.game.extra}}

+ {% endif %} +
+ +
+ +

+ + {{ page.game.away.display_name }} + +

+
+
+ + {% for event in page.game.away.events %} +

+ + {{event.time}}' + {{event.player}} +

+ {% endfor %} +
+
+ +{% if page.game.video %} +
+
+ {{page.game.video | url_decode}} +
+
+{% endif %} + +{% if page.game.images %} +
+
+ {% for url in page.game.images %} + + {% endfor %} +
+
+{% endif %} \ No newline at end of file diff --git a/_layouts/game_post.md b/_layouts/game_post.md new file mode 100644 index 0000000..9872eda --- /dev/null +++ b/_layouts/game_post.md @@ -0,0 +1,12 @@ +--- +layout: post +--- + +{% if page.season_key != nil and page.game_key != nil %} +{% assign gk = page.game_key %} +{% assign g = site.data.seasons[page.season_key].games[gk] %} +{% include game_lines.md game_key=gk game=g season_key=page.season_key %} +{% endif %} + +
+{{content}} \ No newline at end of file diff --git a/_layouts/goal_scorers.html b/_layouts/goal_scorers.html new file mode 100644 index 0000000..0e07b72 --- /dev/null +++ b/_layouts/goal_scorers.html @@ -0,0 +1,59 @@ +--- +layout: default +--- + +{% include season_tabs.html name=page.display_name description=page.description %} +
 
+ +

{% t goal_scorers %}

+ + + + + + + + {% capture gp %} + {% t player.goals_penalty %} + {% endcapture %} + + + + + {% for player in page.rank_table %} + + + + + + + {% endfor %} + + +
{% t player.photo %}{% t player.name %}{% t player.team %}{{ gp | newline_to_br }}
+ {% if player.img != nil %} + + {% else %} + + {% endif %} + + {% case forloop.index %} + {% when 1 %} + 🥇 + {% when 2 %} + 🥈 + {% when 3 %} + 🥉 + {% else %} + {% endcase %} + {{ player.name }} + + {% assign team = page.team_hash[player.teamkey] %} + {% include team_link.html team=team %} + + {{ player.goals }} + {% if player.penalty > 0 %} + ({{ player.penalty }}) + {% endif %} +
+ diff --git a/_layouts/home.html b/_layouts/home.html new file mode 100644 index 0000000..228dcdf --- /dev/null +++ b/_layouts/home.html @@ -0,0 +1,38 @@ +--- +layout: default +--- + +
+ {%- if page.title -%} +

{{ page.title }}

+ {%- endif -%} + + {{ content }} + + {%- if site.posts.size > 0 -%} +

+ {% if page.list_title != nil %} + {% t page.list_title %} + {% else %} + Posts + {% endif %} +

+ + {%- endif -%} + +
diff --git a/_layouts/season.html b/_layouts/season.html new file mode 100644 index 0000000..8f124d5 --- /dev/null +++ b/_layouts/season.html @@ -0,0 +1,60 @@ +--- +layout: default +--- + +{% include season_tabs.html name=page.display_name description=page.description %} +
 
+ +{% if page.winner != nil and page.winner != "" %} +

🏆 {% translate champion %}

+{% include team_link.html team=page.winner %} +{% endif %} + +
 
+ + + + + + + + + + + + + + + + + {% for team in page.table %} + + + + + + + + + + + + {% endfor %} + + +
{% translate table.team_name %}{% translate table.played %}{% translate table.win %}{% translate table.tie %}{% translate table.lose %}{% translate table.goals_for %}{% translate table.goals_against %}{% translate table.goals_diff %}{% translate table.points %}
+ {% include team_link.html team=team %} + {{ team.table.games_played }}{{ team.table.wins }}{{ team.table.draws }}{{ team.table.loses }}{{ team.table.goals_for }}{{ team.table.goals_against }}{{ team.table.goals_diff }}{{ team.table.points }}
+ +

{% translate games_list %}

+ +{% for game in page.games_pair %} +{% assign gk = game[0] %} +{% assign g = game[1] %} +{% include game_lines.html game_key=gk game=g season_base_url="" %} +{% endfor %} + +{% if page.rules != nil %} +  +

{{page.rules | newline_to_br}}

+{% endif %} \ No newline at end of file diff --git a/_layouts/season_group_knockout.html b/_layouts/season_group_knockout.html new file mode 100644 index 0000000..4d168ee --- /dev/null +++ b/_layouts/season_group_knockout.html @@ -0,0 +1,123 @@ +--- +layout: default +--- + + +{% include season_tabs.html name=page.display_name description=page.description %} +
 
+ +{% if page.winner != nil and page.winner != "" %} +

🏆 {% translate champion %}

+{% include team_link.html team=page.winner %} +{% endif %} + +
 
+ +

{% translate knockout_stage %}

+ + +
+{% for round in page.knockout_array %} + + {% endfor %} + + + +
+ +{% if page.group_tables != nil %} + +

{% translate group_stage %}

+ +{% for group in page.group_tables %} +{% assign group_key = group[0] %} + + + + + + + + + + + + + + + + {% for team in group[1] %} + + + + + + + + + + + + {% endfor %} + +
{{group_key}}{% translate table.played %}{% translate table.win %}{% translate table.tie %}{% translate table.lose %}{% translate table.goals_for %}{% translate table.goals_against %}{% translate table.goals_diff %}{% translate table.points %}
+ {% include team_link.html team=team %} + {{ team.table.games_played }}{{ team.table.wins }}{{ team.table.draws }}{{ team.table.loses }}{{ team.table.goals_for }}{{ team.table.goals_against }}{{ team.table.goals_diff }}{{ team.table.points }}
+ +{% for game in page.group_games[group_key] %} +{% assign gk = game[0] %} +{% assign g = game[1] %} +{% include game_lines.html game_key=gk game=g season_base_url="" %} +{% endfor %} +
+
+{% endfor %} + +{% comment %} +{% for game in page.games_pair %} +{% if game[1].type contains "group" %} +{% assign gk = game[0] %} +{% assign g = game[1] %} +{% include game_lines.html game_key=gk game=g season_base_url="" %} +{% endif %} +{% endfor %} +{% endcomment %} + +{% endif %} + +{% if page.rules != nil %} +  +

{{page.rules | newline_to_br}}

+{% endif %} \ No newline at end of file diff --git a/_layouts/team.html b/_layouts/team.html new file mode 100644 index 0000000..b3bb8a9 --- /dev/null +++ b/_layouts/team.html @@ -0,0 +1,100 @@ +--- +layout: page +--- + + + + +

+ + {{ page.team.display_name }} +

+ +

{{ page.team.description }}

+
+ +
+ + + + + + + + + + + + + + {% for pair in page.history_stats %} + {% assign stats=pair[1] %} + {% if pair[0] == page.season_key %} + + {% else %} + + {% endif %} + + + + + + + + + + {% endfor %} +
{% t season %}{% t table.played %}{% t table.win %}{% t table.tie %}{% t table.lose %}{% t table.goals_for %}{% t table.goals_against %}{% t table.avg %}
{%if stats.is_winner == true %}🏆{%endif%} {{ stats.season_name }}{{ stats.games_played }}{{ stats.wins }}{{ stats.draws }}{{ stats.loses }}{{ stats.goals_for }}{{ stats.goals_against }}+{{ stats.avg_gf }} / -{{ stats.avg_ga }}
+
+ +
+ + +
+ + + + + + + + + + + + {% for player in page.team.players.starting %} + {% include player_table_line.html player=player %} + {% endfor %} + + {% for player in page.team.players.subs %} + {% include player_table_line.html player=player %} + {% endfor %} + +
{% translate player.number %}{% translate player.photo %}{% translate player.name %}{% translate player.position %}{% translate player.goals %}
+ +
+ + + +
+ {% include squad.html squad=page.team.players.starting %} +
+ +
+ +
+{% for game in page.team.games %} +{% assign gk = game[0] %} +{% assign g = game[1] %} +{% include game_lines.html game_key=gk game=g season_base_url="../" %} +{% endfor %} +
+ + +{% if page.team.image %} +
+
+ +
+
+{% endif %} \ No newline at end of file diff --git a/_plugins/jekyll-multiple-languages-plugin/lib/jekyll-multiple-languages-plugin.rb b/_plugins/jekyll-multiple-languages-plugin/lib/jekyll-multiple-languages-plugin.rb new file mode 100644 index 0000000..af716e9 --- /dev/null +++ b/_plugins/jekyll-multiple-languages-plugin/lib/jekyll-multiple-languages-plugin.rb @@ -0,0 +1,593 @@ +=begin + +Jekyll Multiple Languages is an internationalization plugin for Jekyll. It +compiles your Jekyll site for one or more languages with a similar approach as +Rails does. The different sites will be stored in sub folders with the same name +as the language it contains. + +Please visit https://github.com/screeninteraction/jekyll-multiple-languages-plugin +for more details. + +=end + + + +require_relative "plugin/version" + +module Jekyll + + #***************************************************************************** + # :site, :post_render hook + #***************************************************************************** + Jekyll::Hooks.register :site, :pre_render do |site, payload| + lang = site.config['lang'] + puts "Loading translation from file #{site.source}/_i18n/#{lang}.yml" + site.parsed_translations[lang] = YAML.load_file("#{site.source}/_i18n/#{lang}.yml") + end + + #***************************************************************************** + # :site, :post_write hook + #***************************************************************************** + Jekyll::Hooks.register :site, :post_write do |site| + + # Moves excluded paths from the default lang subfolder to the root folder + #=========================================================================== + default_lang = site.config["default_lang"] + current_lang = site.config["lang"] + exclude_paths = site.config["exclude_from_localizations"] + + if (default_lang == current_lang && site.config["default_locale_in_subfolder"]) + files = Dir.glob(File.join("_site/" + current_lang + "/", "*")) + files.each do |file_path| + parts = file_path.split('/') + f_path = parts[2..-1].join('/') + if (f_path == 'base.html') + new_path = parts[0] + "/index.html" + puts "Moving '" + file_path + "' to '" + new_path + "'" + File.rename file_path, new_path + else + exclude_paths.each do |exclude_path| + if (exclude_path == f_path) + new_path = parts[0] + "/" + f_path + puts "Moving '" + file_path + "' to '" + new_path + "'" + if (Dir.exists?(new_path)) + FileUtils.rm_r new_path + end + File.rename file_path, new_path + end + end + end + end + end + + #=========================================================================== + + end + + Jekyll::Hooks.register :site, :post_render do |site, payload| + + # Removes all static files that should not be copied to translated sites. + #=========================================================================== + default_lang = payload["site"]["default_lang"] + current_lang = payload["site"][ "lang"] + + static_files = payload["site"]["static_files"] + exclude_paths = payload["site"]["exclude_from_localizations"] + + default_locale_in_subfolder = site.config["default_locale_in_subfolder"] + + if default_lang != current_lang + static_files.delete_if do |static_file| + next true if (static_file.name == 'base.html' && default_locale_in_subfolder) + + # Remove "/" from beginning of static file relative path + if static_file.instance_variable_get(:@relative_path) != nil + static_file_r_path = static_file.instance_variable_get(:@relative_path).dup + if static_file_r_path + static_file_r_path[0] = '' + + exclude_paths.any? do |exclude_path| + Pathname.new(static_file_r_path).descend do |static_file_path| + break(true) if (Pathname.new(exclude_path) <=> static_file_path) == 0 + end + end + end + end + end + end + + #=========================================================================== + + end + + + + ############################################################################## + # class Site + ############################################################################## + class Site + + attr_accessor :parsed_translations # Hash that stores parsed translations read from YAML files. + + alias :process_org :process + + #====================================== + # process + # + # Reads Jekyll and plugin configuration parameters set on _config.yml, sets + # main parameters and processes the website for each language. + #====================================== + def process + # Check if plugin settings are set, if not, set a default or quit. + #------------------------------------------------------------------------- + self.parsed_translations ||= {} + + self.config['exclude_from_localizations'] ||= [] + + self.config['default_locale_in_subfolder'] ||= false + + if ( !self.config['languages'] or + self.config['languages'].empty? or + !self.config['languages'].all? + ) + puts 'You must provide at least one language using the "languages" setting on your _config.yml.' + + exit + end + + + # Variables + #------------------------------------------------------------------------- + + # Original Jekyll configurations + baseurl_org = self.config[ 'baseurl' ].to_s # Baseurl set on _config.yml + dest_org = self.dest # Destination folder where the website is generated + + # Site building only variables + languages = self.config['languages'] # List of languages set on _config.yml + + # Site wide plugin configurations + self.config['default_lang'] = languages.first # Default language (first language of array set on _config.yml) + self.config[ 'lang'] = languages.first # Current language being processed + self.config['baseurl_root'] = baseurl_org # Baseurl of website root (without the appended language code) + self.config['translations'] = self.parsed_translations # Hash that stores parsed translations read from YAML files. Exposes this hash to Liquid. + + # Build the website for all languages + #------------------------------------------------------------------------- + + # Remove .htaccess file from included files, so it wont show up on translations folders. + self.include -= [".htaccess"] + + languages.each do |lang| + + # Language specific config/variables + if lang != self.config['default_lang'] || self.config['default_locale_in_subfolder'] + @dest = dest_org + "/" + lang + self.config['baseurl'] = baseurl_org + "/" + lang + self.config['lang'] = lang + end + + puts "Building site for language: \"#{self.config['lang']}\" to: #{self.dest}" + + process_org + end + + # Revert to initial Jekyll configurations (necessary for regeneration) + self.config[ 'baseurl' ] = baseurl_org # Baseurl set on _config.yml + @dest = dest_org # Destination folder where the website is generated + + puts 'Build complete' + end + + + + if Gem::Version.new(Jekyll::VERSION) < Gem::Version.new("3.0.0") + alias :read_posts_org :read_posts + + #====================================== + # read_posts + #====================================== + def read_posts(dir) + translate_posts = !self.config['exclude_from_localizations'].include?("_posts") + + if dir == '' && translate_posts + read_posts("_i18n/#{self.config['lang']}/") + else + read_posts_org(dir) + end + + end + end + + end + + + + ############################################################################## + # class PageReader + ############################################################################## + class PageReader + alias :read_org :read + + #====================================== + # read + # + # Monkey patched this method to remove excluded languages. + #====================================== + def read(files) + read_org(files).reject do |page| + page.data['languages'] && !page.data['languages'].include?(site.config['lang']) + end + end + end + + + + ############################################################################## + # class PostReader + ############################################################################## + class PostReader + + if Gem::Version.new(Jekyll::VERSION) >= Gem::Version.new("3.0.0") + alias :read_posts_org :read_posts + + #====================================== + # read_posts + #====================================== + def read_posts(dir) + translate_posts = !site.config['exclude_from_localizations'].include?("_posts") + if dir == '' && translate_posts + read_posts("_i18n/#{site.config['lang']}/") + else + read_posts_org(dir) + end + end + end + end + + + + #----------------------------------------------------------------------------- + # + # Include (with priority—prepend)the translated + # permanent link for Page and document + # + #----------------------------------------------------------------------------- + + module Permalink + #====================================== + # permalink + #====================================== + def permalink + return nil if data.nil? || data['permalink'].nil? + + if site.config['relative_permalinks'] + File.join(@dir, data['permalink']) + elsif site.config['lang'] + # Look if there's a permalink overwrite specified for this lang + data['permalink_' + site.config['lang']] || data['permalink'] + else + data['permalink'] + end + + end + end + + Page.prepend(Permalink) + Document.prepend(Permalink) + + + ############################################################################## + # class Post + ############################################################################## + class Post + + if Gem::Version.new(Jekyll::VERSION) < Gem::Version.new("3.0.0") + alias :populate_categories_org :populate_categories + + #====================================== + # populate_categories + # + # Monkey patched this method to remove unwanted strings + # ("_i18n" and language code) that are prepended to posts categories + # because of how the multilingual posts are arranged in subfolders. + #====================================== + def populate_categories + categories_from_data = Utils.pluralized_array_from_hash(data, 'category', 'categories') + self.categories = ( + Array(categories) + categories_from_data + ).map {|c| c.to_s.downcase}.flatten.uniq + + self.categories.delete("_i18n") + self.categories.delete(site.config['lang']) + + return self.categories + end + end + end + + + + ############################################################################## + # class Document + ############################################################################## + class Document + + if Gem::Version.new(Jekyll::VERSION) >= Gem::Version.new("3.0.0") + alias :populate_categories_org :populate_categories + + #====================================== + # populate_categories + # + # Monkey patched this method to remove unwanted strings + # ("_i18n" and language code) that are prepended to posts categories + # because of how the multilingual posts are arranged in subfolders. + #====================================== + def populate_categories + data['categories'].delete("_i18n") + data['categories'].delete(site.config['lang']) + + merge_data!({ + 'categories' => ( + Array(data['categories']) + Utils.pluralized_array_from_hash(data, 'category', 'categories') + ).map(&:to_s).flatten.uniq + }) + end + end + end + + + + #----------------------------------------------------------------------------- + # + # The next classes implements the plugin Liquid Tags and/or Filters + # + #----------------------------------------------------------------------------- + + + ############################################################################## + # class LocalizeTag + # + # Localization by getting localized text from YAML files. + # User must use the "t" or "translate" liquid tags. + ############################################################################## + class LocalizeTag < Liquid::Tag + + #====================================== + # initialize + #====================================== + def initialize(tag_name, key, tokens) + super + @key = key.strip + end + + + + #====================================== + # render + #====================================== + def render(context) + if "#{context[@key]}" != "" # Check for page variable + key = "#{context[@key]}" + else + key = @key + end + + key = Liquid::Template.parse(key).render(context) # Parses and renders some Liquid syntax on arguments (allows expansions) + + site = context.registers[:site] # Jekyll site object + + lang = site.config['lang'] + + translation = site.parsed_translations[lang].access(key) if key.is_a?(String) + + if translation.nil? or translation.empty? + translation = site.parsed_translations[site.config['default_lang']].access(key) + + if site.config["verbose"] + puts "Missing i18n key: #{lang}:#{key}" + puts "Using translation '%s' from default language: %s" %[translation, site.config['default_lang']] + end + end + + translation + end + end + + + + ############################################################################## + # class LocalizeInclude + # + # Localization by including whole files that contain the localization text. + # User must use the "tf" or "translate_file" liquid tags. + ############################################################################## + module Tags + class LocalizeInclude < IncludeTag + + #====================================== + # render + #====================================== + def render(context) + if "#{context[@file]}" != "" # Check for page variable + file = "#{context[@file]}" + else + file = @file + end + + file = Liquid::Template.parse(file).render(context) # Parses and renders some Liquid syntax on arguments (allows expansions) + + site = context.registers[:site] # Jekyll site object + + default_lang = site.config['default_lang'] + + validate_file_name(file) + + includes_dir = File.join(site.source, '_i18n/' + site.config['lang']) + + # If directory doesn't exist, go to default lang + if !Dir.exist?(includes_dir) + includes_dir = File.join(site.source, '_i18n/' + default_lang) + elsif + # If file doesn't exist, go to default lang + Dir.chdir(includes_dir) do + choices = Dir['**/*'].reject { |x| File.symlink?(x) } + if !choices.include?( file) + includes_dir = File.join(site.source, '_i18n/' + default_lang) + end + end + end + + Dir.chdir(includes_dir) do + choices = Dir['**/*'].reject { |x| File.symlink?(x) } + + if choices.include?( file) + source = File.read(file) + partial = Liquid::Template.parse(source) + + context.stack do + context['include'] = parse_params( context) if @params + contents = partial.render(context) + ext = File.extname(file) + + converter = site.converters.find { |c| c.matches(ext) } + contents = converter.convert(contents) unless converter.nil? + + contents + end + else + raise IOError.new "Included file '#{file}' not found in #{includes_dir} directory" + end + + end + end + end + + # Override of core Jekyll functionality, to get rid of deprecation + # warning. See https://github.com/jekyll/jekyll/pull/7117 for more + # details. + class PostComparer + def initialize(name) + @name = name + + all, @path, @date, @slug = *name.sub(%r!^/!, "").match(MATCHER) + unless all + raise Jekyll::Errors::InvalidPostNameError, + "'#{name}' does not contain valid date and/or title." + end + + escaped_slug = Regexp.escape(slug) + @name_regex = %r!_posts/#{path}#{date}-#{escaped_slug}\.[^.]+| + ^#{path}_posts/?#{date}-#{escaped_slug}\.[^.]+!x + end + end + end + + + + ############################################################################## + # class LocalizeLink + # + # Creates links or permalinks for translated pages. + # User must use the "tl" or "translate_link" liquid tags. + ############################################################################## + class LocalizeLink < Liquid::Tag + + #====================================== + # initialize + #====================================== + def initialize(tag_name, key, tokens) + super + @key = key + end + + + + #====================================== + # render + #====================================== + def render(context) + if "#{context[@key]}" != "" # Check for page variable + key = "#{context[@key]}" + else + key = @key + end + + key = Liquid::Template.parse(key).render(context) # Parses and renders some Liquid syntax on arguments (allows expansions) + + site = context.registers[:site] # Jekyll site object + + key = key.split + namespace = key[0] + lang = key[1] || site.config[ 'lang'] + default_lang = site.config['default_lang'] + baseurl = site.baseurl + pages = site.pages + url = ""; + + if default_lang != lang || site.config['default_locale_in_subfolder'] + baseurl = baseurl + "/" + lang + end + + collections = site.collections.values.collect{|x| x.docs}.flatten + pages = site.pages + collections + + for p in pages + unless p['namespace'].nil? + page_namespace = p['namespace'] + + if namespace == page_namespace + permalink = p['permalink_'+lang] || p['permalink'] + url = baseurl + permalink + end + end + end + + url + end + end + + +end # End module Jekyll + + + +################################################################################ +# class Hash +################################################################################ +unless Hash.method_defined? :access + class Hash + + #====================================== + # access + #====================================== + def access(path) + ret = self + + path.split('.').each do |p| + + if p.to_i.to_s == p + ret = ret[p.to_i] + else + ret = ret[p.to_s] || ret[p.to_sym] + end + + break unless ret + end + + ret + end + end +end + + + +################################################################################ +# Liquid tags definitions + +Liquid::Template.register_tag('t', Jekyll::LocalizeTag ) +Liquid::Template.register_tag('translate', Jekyll::LocalizeTag ) +Liquid::Template.register_tag('tf', Jekyll::Tags::LocalizeInclude) +Liquid::Template.register_tag('translate_file', Jekyll::Tags::LocalizeInclude) +Liquid::Template.register_tag('tl', Jekyll::LocalizeLink ) +Liquid::Template.register_tag('translate_link', Jekyll::LocalizeLink ) diff --git a/_plugins/jekyll-multiple-languages-plugin/lib/plugin/version.rb b/_plugins/jekyll-multiple-languages-plugin/lib/plugin/version.rb new file mode 100644 index 0000000..c46b7ae --- /dev/null +++ b/_plugins/jekyll-multiple-languages-plugin/lib/plugin/version.rb @@ -0,0 +1,6 @@ +module Jekyll + module MultipleLanguagesPlugin + VERSION = "1.7.0" + end +end + diff --git a/_plugins/league_generator.rb b/_plugins/league_generator.rb new file mode 100644 index 0000000..9706107 --- /dev/null +++ b/_plugins/league_generator.rb @@ -0,0 +1,478 @@ +require 'json' + +module League + + class GoalScorerPage < Jekyll::Page + def initialize(site, base, dir, season_name, rank_table, team_hash) + @site = site + @base = base + @dir = dir + @name = 'goal_scorers.html' + + self.process(@name) + self.read_yaml(File.join(base, '_layouts'), 'goal_scorers.html') + + self.data['rank_table'] = rank_table + self.data['team_hash'] = team_hash + self.data['display_name'] = season_name + end + end + + class TeamPage < Jekyll::Page + def initialize(site, base, dir, team_key, team, season_key, season, history_stats) + @site = site + @base = base + @dir = dir + @name = 'index.html' + + self.process(@name) + self.read_yaml(File.join(base, '_layouts'), 'team.html') + + + self.data['team_key'] = team_key + self.data['team'] = team + self.data['season_key'] = season_key + self.data['season'] = season + + self.data['history_stats'] = history_stats + end + end + + class GamePage < Jekyll::Page + def initialize(site, base, dir, key, game) + @site = site + @base = base + @dir = dir + @name = 'index.html' + + self.process(@name) + self.read_yaml(File.join(base, '_layouts'), 'game.html') + + + self.data['key'] = key + self.data['game'] = game + # self.data['home_team'] = home_team + # self.data['away_team'] = away_team + + + end + end + + def self.calculate_table (team_hash, games_pair, entry) + # Iterate games to calculate data + + # clear data + for team in team_hash + team[1][entry] = { + 'games_played' => 0, + 'wins' => 0, + 'draws' => 0, + 'loses' => 0, + 'goals_for' => 0, + 'goals_against' => 0, + 'goals_diff' => 0, + 'points' => 0 + } + end + + for p in games_pair + key = p[0] + game = p[1] + + if game['schedule'] + next + end + + t0 = team_hash[game['home']['key']][entry] + t0['games_played'] += 1; + t0['goals_for'] += game['home']['score']; + t0['goals_against'] += game['away']['score']; + + t1 = team_hash[game['away']['key']][entry] + t1['games_played'] += 1; + t1['goals_for'] += game['away']['score']; + t1['goals_against'] += game['home']['score']; + + if game['home']['score'] > game['away']['score'] + t0['wins'] += 1; + t1['loses'] += 1; + elsif game['home']['score'] < game['away']['score'] + t1['wins'] += 1; + t0['loses'] += 1; + else + t0['draws'] += 1; + t1['draws'] += 1; + end + end + + # post process + for team in team_hash + t = team[1][entry] + t['goals_diff'] = t['goals_for'] - t['goals_against'] + t['points'] = t['wins'] * 3 + t['draws'] + + t['avg_gf'] = t['games_played'] == 0 ? 0.0 : t['goals_for'].fdiv(t['games_played']) + t['avg_ga'] = t['games_played'] == 0 ? 0.0 : t['goals_against'].fdiv(t['games_played']) + + t['avg_gf'] = sprintf("%0.1f", t['avg_gf']) + t['avg_ga'] = sprintf("%0.1f", t['avg_ga']) + end + end + + # default SeasonPage (League table) + class LeagueSeasonPage < Jekyll::Page + # class LeagueSeasonPage < Jekyll::PageWithoutAFile + def initialize(site, base, dir, season, team_hash, games_pair, config, season_name) + @site = site + @base = base + @dir = dir + # @name = "#{season[0]}.html" + @name = "index.html" + # @layout = 'season.html' + # @path = if site.in_theme_dir(base) == base # we're in a theme + # site.in_theme_dir(base, dir, name) + # else + # site.in_source_dir(base, dir, name) + # end + + # puts @path + + self.process(@name) + + + # self.data = season[1] + # puts base + self.read_yaml(File.join(base, "_layouts"), "season.html") + + # self.data = {} + + # if config != nil and config['display_name'] != nil + # self.data['display_name'] = config['display_name'] + # else + # self.data['display_name'] = season + # end + # self.data["title"] = self.data['display_name'] + + self.data['display_name'] = season_name + self.data["title"] = season_name + self.data['winner'] = config['winner'] ? team_hash[config['winner']] : nil + + + # League.calculate_table(team_hash, games_pair, 'table') + team_tables = team_hash.map{ |key, value| value } + + # team_array = (season[1]['teams'].to_a).map{|key, team| team} + + sorted = (team_tables.sort_by { |team| [ -team['table']['points'], -team['table']['goals_diff'], -team['table']['goals_for'], team['table']['goals_against'], team['table']['games_played'] ] }) + # sorted = (team_array.sort_by { |team| [ -team['table']['points'], -team['table']['goals_for'] + team['table']['goals_against'], -team['table']['goals_for'] ] }) + # puts sorted + + self.data['table'] = sorted + + self.data['games_pair'] = games_pair + + self.data['description'] = config['description'] + self.data['rules'] = config['rules'] + end + end + + # group + knockout for jxcup + class GroupAndKnockOutSeasonPage < Jekyll::Page + def initialize(site, base, dir, season, team_hash, games_hash, games_pair, config, season_name) + @site = site + @base = base + @dir = dir + @name = "index.html" + self.process(@name) + self.read_yaml(File.join(base, "_layouts"), "season_group_knockout.html") + # if self.data['display_name'] != nil + # self.data['display_name'] = config['display_name'] + # else + # self.data['display_name'] = season + # end + # self.data["title"] = self.data['display_name'] + self.data['display_name'] = season_name + self.data["title"] = season_name + + knockout_stage = config['knockout_stage'] + # puts knockout_stage + + if config['display_name'] != nil + self.data['display_name'] = config['display_name'] + end + + # knock out stage + + # make it in correct order + # self.data['knockout_teams'] + knockout_array = Array.new(knockout_stage.length) + + # puts knockout_stage.length + + for i in 0..(knockout_stage.length-1) + round = knockout_stage[i] + round_array = Array.new(round.length) + + for j in 0..(round.length-1) + game = round[j] + game_array = Array.new(3) + + # there's team info in game + # but we still write team info + # because we display versus before game happens + game_array[0] = team_hash[game[0]] + game_array[1] = team_hash[game[1]] + game_array[2] = [game[2], games_hash[game[2]]] + + round_array[j] = game_array + end + + knockout_array[i] = round_array + + # puts knockout_array[i] + # puts team_hash[round[0]] + # puts team_hash['613111'] + end + + # puts knockout_array + + self.data['knockout_array'] = knockout_array + self.data['winner'] = config['winner'] ? team_hash[config['winner']] : nil + + + # group stage + + groups = config['group_stage'] + + if groups != nil + + ############################################## + + # Iterate games to calculate data + group_games_pair = games_pair.select{|key, game| game['type'].include? 'group'} + League.calculate_table(team_hash, group_games_pair,'table') + + ############################################## + + + # puts groups.count + group_tables = Hash.new + group_games = Hash.new + + groups.each do |group_key, team_keys| + # simple not points version first + team_array = team_keys.map{|key| team_hash[key]} + team_keys_set = team_keys.to_set + sorted = (team_array.sort_by { |team| [ -team['table']['points'], -team['table']['goals_diff'], -team['table']['goals_for'], team['table']['goals_against'], team['table']['games_played'] ] }) + group_tables[group_key] = sorted + + # puts team_keys_set + cur_group_games_pair = group_games_pair.select{|key, game| team_keys_set.include?(game['home']['key'])} + + group_games[group_key] = cur_group_games_pair + end + + self.data['group_tables'] = group_tables + self.data['group_games'] = group_games + + end + + + + # self.data['games_pair'] = games_pair + self.data['description'] = config['description'] + self.data['rules'] = config['rules'] + + end + end + + class SeasonPageGenerator < Jekyll::Generator + safe true + + def generate(site) + # puts site.pages + + # team_key => { season_key => stats } + site.data['history_teams_stats'] = Hash.new + + + site.data['seasons'].each do |season| + # convert nilClass to array + + team_hash = season[1]['teams'] + team_hash.each do |key, team| + team['games'] = Array.new + team['key'] = key + + team['player_hash'] = Hash.new + if team['players'] != nil + + starting = team['players']['starting'] + if starting != nil + starting.each do |p| + p['goals'] = 0 + p['penalty'] = 0 + team['player_hash'][p['name']] = p + end + end + + subs = team['players']['subs'] + if subs != nil + subs.each do |p| + p['goals'] = 0 + p['penalty'] = 0 + team['player_hash'][p['name']] = p + end + end + end + + # team['players']['starting'].each{|p| puts p} + end + # team_array = (team_hash.to_a).map{|key, team| team} + + + + games_pair = season[1]['games'].to_a + + # puts games_pair + + games_hash = Hash.new + + + # generate each game page + games_pair.each do |p| + key = p[0] + game = p[1] + games_hash[key] = game + # puts key + # puts game + + # puts game['away']['key'] + + home_team = team_hash[game['home']['key']] + away_team = team_hash[game['away']['key']] + + home_team['games'] << p + away_team['games'] << p + + game['home']['display_name'] = home_team['display_name'] + game['home']['logo'] = home_team['logo'] + game['away']['display_name'] = away_team['display_name'] + game['away']['logo'] = away_team['logo'] + + game['home']['events'].each do |e| + if e['type'] == 'goal' or e['type'] == 'penalty' + player = home_team['player_hash'][e['player']] + if player == nil + # puts e['player'] + home_team['player_hash'][e['player']] = {'name' => e['player'], 'goals' => 0, 'penalty' => 0} + player = home_team['player_hash'][e['player']] + end + + player['goals'] += 1 + if e['type'] == 'penalty' + player['penalty'] += 1 + end + end + end + + game['away']['events'].each do |e| + if e['type'] == 'goal' or e['type'] == 'penalty' + player = away_team['player_hash'][e['player']] + if player == nil + # puts e['player'] + away_team['player_hash'][e['player']] = {'name' => e['player'], 'goals' => 0, 'penalty' => 0} + player = away_team['player_hash'][e['player']] + end + + player['goals'] += 1 + if e['type'] == 'penalty' + player['penalty'] += 1 + end + end + end + + site.pages << GamePage.new(site, site.source, File.join('seasons', season[0], 'games', key), key, game) + end + + + goal_scorers = Array.new + + # include all games (groups and knockout for tournament) + League.calculate_table(team_hash, games_pair, 'stats') + + config = season[1]['config'] + season_name = season[0] + if config != nil and config['display_name'] != nil + season_name = config['display_name'] + end + + stats_is_table = false + if config == nil or config['type'] == 'league' + stats_is_table = true + end + + history_team_stats = site.data['history_teams_stats'] + team_hash.each do |key, team| + + team['player_hash'].each do |pk, p| + if p['goals'] > 0 + p['teamkey'] = key + goal_scorers << p + end + end + + if stats_is_table + team['table'] = team['stats'] + end + + if history_team_stats[key] == nil + history_team_stats[key] = Hash.new + end + history_team_stats[key][season[0]] = team['stats'] + history_team_stats[key][season[0]]['season_key'] = season[0] + history_team_stats[key][season[0]]['season_name'] = season_name + history_team_stats[key][season[0]]['is_winner'] = config['winner'] == key + + # site.pages << TeamPage.new(site, site.source, File.join('seasons', season[0], key), key, team, season[0], season[1]) + end + + sorted_goal_scorers = (goal_scorers.sort_by { |p| [ -p['goals'], p['penalty'] ] }) + + + # puts games_hash + + + + + # puts config + if config == nil or config['type'] == 'league' + site.pages << LeagueSeasonPage.new(site, site.source, File.join('seasons', season[0]), season[0], team_hash, games_pair, config, season_name) + elsif config['type'] == 'group + knockout' + site.pages << GroupAndKnockOutSeasonPage.new(site, site.source, File.join('seasons', season[0]), season[0], team_hash, games_hash, games_pair, config, season_name) + end + + + site.pages << GoalScorerPage.new(site, site.source, File.join('seasons', season[0]), season_name, sorted_goal_scorers, team_hash) + + + # puts games_hash + # puts games_pair + # season table page + + end # each season + + site.data['seasons'].each do |season_key, season| + team_hash = season['teams'] + team_hash.each do |team_key, team| + history_stats = site.data['history_teams_stats'][team_key].to_a.reverse() + site.pages << TeamPage.new(site, site.source, File.join('seasons', season_key, team_key), team_key, team, season_key, season, history_stats) + end + end + + + + end + end + +end \ No newline at end of file diff --git a/_posts/2021-07-10-league-rules.md b/_posts/2021-07-10-league-rules.md new file mode 100644 index 0000000..f0e55d5 --- /dev/null +++ b/_posts/2021-07-10-league-rules.md @@ -0,0 +1,76 @@ +--- +layout: game_post +season_key: "21s" + +title: "2021年夏季联赛规则简版以及赛前赛后各队任务" +date: 2013-11-17 +categories: news +--- + +* 竞赛及决定名次办法 + 1. 本次联赛为友谊比赛,不计名次。 + 1. 本次联赛有16支球队,分为A,B,两个小组,组内单循环赛制。各组比赛在不同场地进行,上场比赛人数也有不同要求 + 1. A组采用9人制, 在 Irvington Community Park (以下简称ICP) 举行, 地址:41885 Blacow Rd, Fremont, CA 94538 + 1. B组采用8人制, 在 Newark Sportsfield Park(以下简称Newark)举行, 地址: 6800 Mowry Avenue, Newark, CA 94560 + 1. 比赛时间是90分钟,分上下半场各45分钟,中间休息10分钟 +* 参赛队员资格 + 1. 球员必须年满18周岁才能参加比赛 + 1. 每队参赛球员没有限制,无须在OLE上加入队员名单 +* 着装与装备要求 + 1. 上场队员必须带护腿板,穿长筒球袜,并完全覆盖护腿板,否则不允许上场比赛。 + 1. 上场球员不允许佩戴任何首饰戒指及其他佩戴物,除非有医生证明需要日常佩戴以维持身体健康之需要。不允许佩戴普通眼镜,只允许球类专用的运动眼镜。 + 1. 每个队员上场比赛的球衣要有号码且不能重复。当场比赛两个队员不能使用相同的球衣号码。 + 1. 组委会准备了不同颜色有号码的背心,如果一些参赛队短期内没有统一的有号码的队服,在比赛前可以向组委会申请借用带有号码的背心。 +* 上场队员资格审核 + 1. 本联赛为友谊比赛,每场比赛无须对上场队员资格进行审核。 +* 比赛弃权 + 1. 球队弃权的决定必须在比赛48小时之前(星期四晚12点前)通知组委会,否则弃权球队须交纳$50罚金给对手球队。 +* 不可抗力影响 + 1. 如果因为天气或场地等不可抗原因取消比赛,组委会不会再安排补赛。 + +### 比赛规则与特殊规定 +* **执行国际足联最新版本的《足球竞赛规则》,及以下特殊规定** + 1. A组采用9人制在 ICP 进行的比赛,执行国际足联最新版本的《足球竞赛规则》,(但禁止铲球) + 1. B组采用8人制在 Newark 进行的比赛,有以下特殊规定 + 1. B组采用8人制的比赛没有越位 + 1. 禁止以铲球的方式争抢球权,铲球队员会得到黄牌警告,甚至红牌罚下。守门员在禁区内有铲球的特权,在禁区外等同于普通球员,不能铲球。 + 1. 守门员用手拿球后,在球落地前不能直接用脚踢球,只能用手把球丢出,或在球着地后再踢,违反则对方发角球 + 1. 守门员二次触球的违例则对方发间接任意球,包括: 1、守门员把球放到地上后又抱起; 2、守门员把球向上或斜上方向抛起后又把球接住; 3、守门员把球扔到脚上踢起后又抓住。 + 1. 定位球:当一方发定位球时,无球方队员要退到距离罚球点6米以外。如果无球方队员故意在近距离阻碍对方快发任意球,则该无球方队员应被黄牌警告。 + 1. 点球: 队员在本方罚球区内 ,违反可判罚直接任意球的规定,无论当时球在何处,应判罚点球。点球离球门8米(从大禁区线上向球门方向跨一步的位置)。 + 1. 换人:不限人次。替补队员在中场线外就绪后向裁判提出换人及人数,在裁判批准后,场上队员跑步下场,替补队员才能上场。裁判有权否决无球权球队的换人申请。 + 1. 在比赛进行中未经裁判允许下,任何球员擅自进出场地,会被黄牌警告 + 1. 裁判员认为,如果队员草率地、鲁莽地或使用过分的力量在双方进行争抢或对方队员控制球时实施铲抢,被视为严重犯规,判给对方直接任意球,可根据犯规严重情况给予黄牌警告或红牌罚出场。 + 1. 犯规情节严重,或明显伤人的一律红牌,情节特别严重的要追加处罚 + 1. 场外队员只能在指定区域观看比赛,禁止站在场边。只有需要换上场的队员才能在中场线外等待 +* 红黄牌规定 + 1. 黄牌:黄牌罚立即下场等待五分钟,可换其他队员上场。守门员得到黄牌后不需离场。 + 1. 红牌:得到红牌的队员罚立即终止当场比赛,下一场比赛可以上场,不停赛,所在球队要被罚款$100,从压金中扣除。红牌犯规情节严重者要加罚。 +* 裁判权威 + 1. 裁判有绝对权威,禁止在任何情况下和裁判争执。场上场外任何队员辱骂裁判一律红牌,并停赛至少4场。情节特别严重者要加罚。 + 1. 场上球员对裁判判罚的意见只能通过队长与裁判交涉。对裁判判罚说三道四的队员,在口头警告无效后,要黄牌警告。 + 1. 不服从裁判判罚,(用言语或动作表示异议),藐视裁判权威的队员,直接黄牌警告。 + 1. 对裁判当场执法有意见,请通过球队队长向NCCSF组委会提交。 + 1. 严禁场外队员大声喧哗干扰指责裁判,如果在裁判提出2次正式警告后,仍屡禁不止,则裁判有权终止比赛,并判对方球队3:0胜。而且球队要被罚款$50,从压金中扣除。 +* 禁令 + 1. 严格禁止场内场外球员用任何言语或肢体动作辱骂他人,裁判视情况可以给黄牌警告或红牌罚下 + 1. 严格禁止打架闹事,挑起打架的队员直接禁止后续赛事并由NCCSF记录在案,情节严重的或有前科的终身禁止参加NCCSF组织的赛事。如果有违反体育道德行为禁赛本赛季余下所有比赛,如果余下比赛不满8场则禁赛8场 + 1. 如果违反体育道德行为情节特别严重的禁赛12个月或终生禁止参加NCCSF组织的所有比赛 + 1. 追加处罚自动带入足联组织的所有比赛 + 1. 人工草地场内禁止抽烟,如果有球场围栏内吸烟者将罚款$200,罚款由当事球队负责 +* 申诉与仲裁 + 1. 当场比赛结束后,比分,红黄牌纪录即为不可更改的最终结果。不在申诉范畴之内。 + 1. 申诉只适用于对违反体育道德行为所受到的追加处罚。 + 1. 球队如果对追加处罚有异议,可以缴纳$100申诉费后向赛事DRC申诉,申诉费只会在申诉成功后退回。 + +NCCSF保留最终解释权 + +### 各队比赛前后任务 + +* 赛前任务 + 1. 赛前交$20裁判费给裁判 + 1. A组上周拿球网的值班球队必须在比赛前提前把球网带回球场,并安装好。 + 1. B组第一场比赛各队要setup各自的球门 +* 赛后任务 + 1. 每场比赛结束后,参赛两队要清理场地垃圾。最后一场比赛结束后,参赛两队要负责清理整个场地的垃圾。如果由于场地垃圾未清理而遭到City的罚款,罚金由最后两支球队均摊,又押金中扣除 + 1. A组最后比赛的本周值班球队负责拆除球门球网,带回保管,并在下周比赛前提前到场地安装 \ No newline at end of file diff --git a/assets/css/custom-football-squad.css b/assets/css/custom-football-squad.css new file mode 100644 index 0000000..a592036 --- /dev/null +++ b/assets/css/custom-football-squad.css @@ -0,0 +1,226 @@ +.row-game { + display: -ms-flex; display: -webkit-flex; display: flex; +} + +.row-game:after { + content: ""; + display: table; + clear: both; + float: none; +} + +.column { + float: left; + width: 50%; + + flex: 1; +} + + +@media all and (max-width: 600px) { + .column { + float: none; + width: 100%; + } +} + +/* Clear floats after the columns */ +.row:after { + content: ""; + display: table; + clear: both; + float: none; +} + + +.block { + float: none; + width: 100%; + +} + + +.football_field_background { + background-image: url("../img/field.png") +} + +.football_field { + position: relative; +} + +.player { + position: absolute; + width: 20%; +} + +.player img { + display: block; + margin-left: auto; + margin-right: auto; + border-radius: 50%; + border: 2px solid #cccccc; + width: 50%; +} + +.player p { + text-align: center; + font-size: 14px; +} + +/* GK */ +.player.GK { + bottom: 2%; + left: 50%; + transform: translateX(-50%); +} + +/* Defender */ +.player.LWB { + bottom: 35%; + left: 5%; +} + +.player.LB { + bottom: 20%; + left: 8%; +} + +.player.LCB { + bottom: 20%; + left: 30%; +} + +.player.CB { + bottom: 20%; + left: 50%; + transform: translateX(-50%); +} + +.player.RCB { + bottom: 20%; + right: 30%; +} + +.player.RB { + bottom: 20%; + right: 8%; +} + +.player.RWB { + bottom: 35%; + right: 5%; +} + +/* Defending Midfielder */ + +.player.LDM { + bottom: 35%; + left: 30%; +} + +.player.CDM { + bottom: 35%; + left: 50%; + transform: translateX(-50%); +} + +.player.RDM { + bottom: 35%; + right: 30%; +} + +/* Midfielder */ + +.player.LM { + bottom: 50%; + left: 8%; +} + +.player.LCM { + bottom: 50%; + left: 30%; +} + +.player.CM { + bottom: 50%; + left: 50%; + transform: translateX(-50%); +} + +.player.RCM { + bottom: 50%; + right: 30%; +} + +.player.RM { + bottom: 50%; + right: 8%; +} + +/* Wingers, CAM */ + +.player.LW { + bottom: 65%; + left: 10%; +} + +.player.CAM { + bottom: 65%; + left: 50%; + transform: translateX(-50%); +} + +.player.RW { + bottom: 65%; + right: 10%; +} + +/* Strikers */ + +.player.LS { + bottom: 79%; + left: 25%; +} + +.player.ST { + bottom: 79%; + left: 50%; + transform: translateX(-50%); +} + +.player.RS { + bottom: 79%; + right: 25%; +} + + +/* player list table */ +table { + text-align: center; +} +table.playerlist img { + width: 40px; +} +table.playerlist th { + padding: 0.3em; +} +table.playerlist td { + padding: 0.3em; +} + +.team-logo { + width: 30px !important; +} + +/* team history stats table */ +.cur-season-line { + font-weight: bold; +} + +/* hack for embed video*/ +iframe { + width: 100%; + max-width: 600px; + height: auto; + min-height: 400px; +} \ No newline at end of file diff --git a/assets/css/knockout-bracket.css b/assets/css/knockout-bracket.css new file mode 100644 index 0000000..4073238 --- /dev/null +++ b/assets/css/knockout-bracket.css @@ -0,0 +1,66 @@ +/* p { + color: red; +} */ + +/* + * Flex Layout Specifics +*/ +.tournament { + display:flex; + flex-direction:row; +} +.tournament .round{ + display:flex; + flex-direction:column; + justify-content:center; + width:200px; + list-style:none; + padding:0; +} +.tournament .round .spacer{ flex-grow:1; } +.tournament .round .spacer:first-child, +.tournament .round .spacer:last-child{ flex-grow:.5; } + +.tournament .round .game-spacer{ + flex-grow:1; + } + +/* + * General Styles +*/ +/* body{ + font-family:sans-serif; + font-size:small; + padding:10px; + line-height:1.4em; +} */ + +.tournament li.game{ + padding-left:20px; +} + +.tournament li.game.winner{ + font-weight:bold; + } + .tournament li.game span{ + float:right; + margin-right:5px; + } + + .tournament li.game-top{ border-bottom:1px solid #aaa; } + + .tournament li.game-spacer{ + border-right:1px solid #aaa; + min-height: 10px; + text-align: center; + } + + .tournament li.game-spacer-text{ + border-right:1px solid #aaa; + text-align: center; + vertical-align: middle; + } + + .tournament li.game-bottom{ + border-top:1px solid #aaa; + } diff --git a/assets/img/field.svg b/assets/img/field.svg new file mode 100644 index 0000000..2dcaf6d --- /dev/null +++ b/assets/img/field.svg @@ -0,0 +1,200 @@ + + + + diff --git a/assets/img/grass2.png b/assets/img/grass2.png new file mode 100644 index 0000000..f066196 Binary files /dev/null and b/assets/img/grass2.png differ diff --git a/assets/img/icon/goal.png b/assets/img/icon/goal.png new file mode 100644 index 0000000..5c49c8a Binary files /dev/null and b/assets/img/icon/goal.png differ diff --git a/assets/img/icon/off.png b/assets/img/icon/off.png new file mode 100644 index 0000000..2c0c076 Binary files /dev/null and b/assets/img/icon/off.png differ diff --git a/assets/img/icon/owngoal.png b/assets/img/icon/owngoal.png new file mode 100644 index 0000000..cb6d8a6 Binary files /dev/null and b/assets/img/icon/owngoal.png differ diff --git a/assets/img/icon/penalty.png b/assets/img/icon/penalty.png new file mode 100644 index 0000000..5e83a35 Binary files /dev/null and b/assets/img/icon/penalty.png differ diff --git a/assets/img/icon/red.png b/assets/img/icon/red.png new file mode 100644 index 0000000..2588174 Binary files /dev/null and b/assets/img/icon/red.png differ diff --git a/assets/img/icon/sub.png b/assets/img/icon/sub.png new file mode 100644 index 0000000..a961586 Binary files /dev/null and b/assets/img/icon/sub.png differ diff --git a/assets/img/icon/yellow.png b/assets/img/icon/yellow.png new file mode 100644 index 0000000..cfb859f Binary files /dev/null and b/assets/img/icon/yellow.png differ diff --git a/assets/img/mud.png b/assets/img/mud.png new file mode 100644 index 0000000..76282ba Binary files /dev/null and b/assets/img/mud.png differ diff --git a/assets/img/news/2013-11-17/1.jpg b/assets/img/news/2013-11-17/1.jpg new file mode 100644 index 0000000..a84c57c Binary files /dev/null and b/assets/img/news/2013-11-17/1.jpg differ diff --git a/assets/img/news/2013-11-17/2.jpg b/assets/img/news/2013-11-17/2.jpg new file mode 100644 index 0000000..d917a8a Binary files /dev/null and b/assets/img/news/2013-11-17/2.jpg differ diff --git a/assets/img/news/2013-11-17/3.jpg b/assets/img/news/2013-11-17/3.jpg new file mode 100644 index 0000000..a210f8a Binary files /dev/null and b/assets/img/news/2013-11-17/3.jpg differ diff --git a/assets/img/news/2013-11-17/4.jpg b/assets/img/news/2013-11-17/4.jpg new file mode 100644 index 0000000..737409b Binary files /dev/null and b/assets/img/news/2013-11-17/4.jpg differ diff --git a/assets/img/placeholder-club.jpg b/assets/img/placeholder-club.jpg new file mode 100644 index 0000000..27f0cca Binary files /dev/null and b/assets/img/placeholder-club.jpg differ diff --git a/assets/img/placeholder-player.jpg b/assets/img/placeholder-player.jpg new file mode 100644 index 0000000..893d3d5 Binary files /dev/null and b/assets/img/placeholder-player.jpg differ diff --git a/assets/img/teams/CalBlue/logo.jpg b/assets/img/teams/CalBlue/logo.jpg new file mode 100644 index 0000000..bcd6a6e Binary files /dev/null and b/assets/img/teams/CalBlue/logo.jpg differ diff --git a/assets/img/teams/CalBlue/team.jpg b/assets/img/teams/CalBlue/team.jpg new file mode 100644 index 0000000..34a1570 Binary files /dev/null and b/assets/img/teams/CalBlue/team.jpg differ diff --git a/assets/img/teams/ICP/a/gk.jpg b/assets/img/teams/ICP/a/gk.jpg new file mode 100644 index 0000000..7e030bc Binary files /dev/null and b/assets/img/teams/ICP/a/gk.jpg differ diff --git a/assets/img/teams/ICP/logo.png b/assets/img/teams/ICP/logo.png new file mode 100644 index 0000000..4011dda Binary files /dev/null and b/assets/img/teams/ICP/logo.png differ diff --git a/assets/img/teams/ICP/team.jpg b/assets/img/teams/ICP/team.jpg new file mode 100644 index 0000000..ccac443 Binary files /dev/null and b/assets/img/teams/ICP/team.jpg differ diff --git a/assets/img/teams/OverPower/logo.jpg b/assets/img/teams/OverPower/logo.jpg new file mode 100644 index 0000000..650bbc9 Binary files /dev/null and b/assets/img/teams/OverPower/logo.jpg differ diff --git a/favicon.jpg b/favicon.jpg new file mode 100644 index 0000000..76f47eb Binary files /dev/null and b/favicon.jpg differ diff --git a/index.md b/index.md new file mode 100644 index 0000000..ce738f1 --- /dev/null +++ b/index.md @@ -0,0 +1,7 @@ +--- +# Feel free to add content and custom Front Matter to this file. +# To modify the layout, see https://jekyllrb.com/docs/themes/#overriding-theme-defaults + +layout: home +list_title: posts_title +---