Skip to content

Commit 2c3e7f0

Browse files
committed
Add data files.
1 parent fb953d8 commit 2c3e7f0

File tree

6 files changed

+245
-252
lines changed

6 files changed

+245
-252
lines changed

.github/workflows/jekyll.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ on:
77

88
jobs:
99
jekyll:
10-
runs-on: ubuntu-18.04
10+
runs-on: ubuntu-22.04
1111
steps:
12-
- uses: actions/checkout@v2
12+
- uses: actions/checkout@v4
1313

1414
- name: Set up Ruby
1515
uses: ruby/setup-ruby@v1

Gemfile

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ source "https://rubygems.org"
77
#
88
# This will help ensure the proper Jekyll version is running.
99
# Happy Jekylling!
10-
gem "jekyll", "~> 4.0.0"
10+
gem "jekyll"
1111
gem "jekyll-paginate"
1212
# This is the default theme for new Jekyll sites. You may change this to anything you like.
1313
# If you want to use GitHub Pages, remove the "gem "jekyll"" above and
@@ -30,4 +30,4 @@ end
3030
gem "wdm", :install_if => Gem.win_platform?
3131
gem "rubyzip"
3232
gem "webrick"
33-
gem 'eventmachine', :git => 'https://github.com/eventmachine/eventmachine.git', :branch => 'master'
33+
gem "eventmachine"

LICENSE.md

-9
This file was deleted.

README.md

+24-23
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,24 @@
1-
Programming for Beginners
2-
===
3-
4-
![github pages](https://github.com/tatsy/programming-for-beginners/workflows/github%20pages/badge.svg)
5-
6-
はじめに
7-
---
8-
9-
このサイトは研究室の新入生向けが、Pythonを使った機械学習と、C++を使った形状処理の基礎について勉強するために作成いたしました。
10-
11-
執筆にあたっては、読者がPythonとC++(あるいはC言語)での最低限のプログラミング経験を持っていることを前提にしておりますので、少しハードルが高いと感じる場合には、入門書等の基礎について勉強した後にお読みいただければ幸いです。
12-
13-
もし、サイトの内容に誤りなどを見つけられました場合には、著者に直接ご連絡をいただくか、GitHubのissueないしpull requestを立ち上げていただければ幸いです。
14-
15-
ウェブサイト
16-
---
17-
18-
<https://tatsy.github.io/programming-for-beginners>
19-
20-
ライセンス
21-
---
22-
23-
MIT License (c) 2020-2021, Tatsuya Yatagawa
1+
Programming for Beginners
2+
===
3+
4+
![github pages](https://github.com/tatsy/programming-for-beginners/workflows/github%20pages/badge.svg)
5+
[![License: CC BY-NC-SA 4.0](https://img.shields.io/badge/License-CC_BY--NC--SA_4.0-lightgrey.svg)](https://creativecommons.org/licenses/by-nc-sa/4.0/)
6+
7+
はじめに
8+
---
9+
10+
このサイトは研究室の新入生向けが、Pythonを使った機械学習と、C++を使った形状処理の基礎について勉強するために作成いたしました。
11+
12+
執筆にあたっては、読者がPythonとC++(あるいはC言語)での最低限のプログラミング経験を持っていることを前提にしておりますので、少しハードルが高いと感じる場合には、入門書等の基礎について勉強した後にお読みいただければ幸いです。
13+
14+
もし、サイトの内容に誤りなどを見つけられました場合には、著者に直接ご連絡をいただくか、GitHubのissueないしpull requestを立ち上げていただければ幸いです。
15+
16+
ウェブサイト
17+
---
18+
19+
<https://tatsy.github.io/programming-for-beginners>
20+
21+
ライセンス
22+
---
23+
24+
Creative Commons License BY-NC-SA 4.0 (c) 2020-2024, Tatsuya Yatagawa

_plugins/archive.rb

+86-86
Original file line numberDiff line numberDiff line change
@@ -1,86 +1,86 @@
1-
require "zip"
2-
3-
def wrap_and_flush(zipfile, dest, source)
4-
ignore_start = Regexp.new("(.*)// {{(.*)")
5-
ignore_end = "// }}"
6-
7-
ignoring = false
8-
9-
reader = File.new(source, "r")
10-
writer = zipfile.get_output_stream(dest)
11-
reader.readlines().each do |line|
12-
match = line.match(ignore_start)
13-
if not match.nil?
14-
writer.write(match[1] + match[2].strip + "\n")
15-
ignoring = true
16-
end
17-
18-
if not ignoring
19-
writer.write(line)
20-
elsif not line.include?("{{") and not line.include?("}}")
21-
if line.strip.empty? or line.strip.start_with?("//")
22-
writer.write(line)
23-
end
24-
end
25-
26-
if line.strip == ignore_end
27-
ignoring = false
28-
end
29-
end
30-
reader.close()
31-
writer.close()
32-
33-
return
34-
end
35-
36-
Jekyll::Hooks.register :site, :post_write do |site|
37-
site.data["archives"].each do |name, inputs|
38-
# Create archive directory
39-
destdir = File.join(site.dest, "archives")
40-
if not Dir.exists?(destdir)
41-
Dir.mkdir(destdir)
42-
end
43-
44-
# Retrieve input files and exclusion patterns
45-
files = []
46-
excludes = []
47-
inputs.each do |input|
48-
if input.is_a?(String)
49-
files.append(input)
50-
elsif input.is_a?(Hash)
51-
if not input["exclude"].nil?
52-
input["exclude"].each do |exc|
53-
excludes.append(Regexp.new(exc))
54-
end
55-
end
56-
end
57-
end
58-
59-
tempfile = File.join(site.dest, "temp.txt")
60-
61-
# Create ZIP archives
62-
Zip.continue_on_exists_proc = true
63-
Zip::File.open(File.join(destdir, name + ".zip"), Zip::File::CREATE) do |zipfile|
64-
files.each do |file|
65-
if File.file?(file)
66-
zipfile.add(File.basename(file), File.join(site.config["source"], file))
67-
elsif File.directory?(file)
68-
Dir.glob(file + "/**/*.*").each do |subfile|
69-
is_include = true
70-
excludes.each do |exc|
71-
if not subfile.match(exc).nil?
72-
is_include = false
73-
break
74-
end
75-
end
76-
77-
if is_include
78-
dest = subfile.sub(file + "/", "")
79-
wrap_and_flush(zipfile, dest, subfile)
80-
end
81-
end
82-
end
83-
end
84-
end
85-
end
86-
end
1+
require "zip"
2+
3+
def wrap_and_flush(zipfile, dest, source)
4+
ignore_start = Regexp.new("(.*)// {{(.*)")
5+
ignore_end = "// }}"
6+
7+
ignoring = false
8+
9+
reader = File.new(source, "r")
10+
writer = zipfile.get_output_stream(dest)
11+
reader.readlines().each do |line|
12+
match = line.match(ignore_start)
13+
if not match.nil?
14+
writer.write(match[1] + match[2].strip + "\n")
15+
ignoring = true
16+
end
17+
18+
if not ignoring
19+
writer.write(line)
20+
elsif not line.include?("{{") and not line.include?("}}")
21+
if line.strip.empty? or line.strip.start_with?("//")
22+
writer.write(line)
23+
end
24+
end
25+
26+
if line.strip == ignore_end
27+
ignoring = false
28+
end
29+
end
30+
reader.close()
31+
writer.close()
32+
33+
return
34+
end
35+
36+
Jekyll::Hooks.register :site, :post_write do |site|
37+
site.data["archives"].each do |name, inputs|
38+
# Create archive directory
39+
destdir = File.join(site.dest, "archives")
40+
if not Dir.exist?(destdir)
41+
Dir.mkdir(destdir)
42+
end
43+
44+
# Retrieve input files and exclusion patterns
45+
files = []
46+
excludes = []
47+
inputs.each do |input|
48+
if input.is_a?(String)
49+
files.append(input)
50+
elsif input.is_a?(Hash)
51+
if not input["exclude"].nil?
52+
input["exclude"].each do |exc|
53+
excludes.append(Regexp.new(exc))
54+
end
55+
end
56+
end
57+
end
58+
59+
tempfile = File.join(site.dest, "temp.txt")
60+
61+
# Create ZIP archives
62+
Zip.continue_on_exists_proc = true
63+
Zip::File.open(File.join(destdir, name + ".zip"), Zip::File::CREATE) do |zipfile|
64+
files.each do |file|
65+
if File.file?(file)
66+
zipfile.add(File.basename(file), File.join(site.config["source"], file))
67+
elsif File.directory?(file)
68+
Dir.glob(file + "/**/*.*").each do |subfile|
69+
is_include = true
70+
excludes.each do |exc|
71+
if not subfile.match(exc).nil?
72+
is_include = false
73+
break
74+
end
75+
end
76+
77+
if is_include
78+
dest = subfile.sub(file + "/", "")
79+
wrap_and_flush(zipfile, dest, subfile)
80+
end
81+
end
82+
end
83+
end
84+
end
85+
end
86+
end

0 commit comments

Comments
 (0)