ligarb 0.8.2 → 0.9.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -4,6 +4,22 @@
4
4
  <meta charset="UTF-8">
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
6
  <title><%= h(title) %></title>
7
+ <meta property="og:type" content="book">
8
+ <meta property="og:title" content="<%= h(title) %>">
9
+ <meta property="og:site_name" content="<%= h(title) %>">
10
+ <meta property="og:locale" content="<%= h(og_locale) %>">
11
+ <%- if og_url -%>
12
+ <meta property="og:url" content="<%= h(og_url) %>">
13
+ <link rel="canonical" href="<%= h(og_url) %>">
14
+ <%- end -%>
15
+ <%- if og_description && !og_description.empty? -%>
16
+ <meta name="description" content="<%= h(og_description) %>">
17
+ <meta property="og:description" content="<%= h(og_description) %>">
18
+ <%- end -%>
19
+ <meta name="twitter:card" content="summary">
20
+ <%- if author && !author.to_s.empty? -%>
21
+ <meta property="book:author" content="<%= h(author) %>">
22
+ <%- end -%>
7
23
  <%- if ai_generated -%>
8
24
  <meta name="robots" content="noindex, nofollow, noarchive">
9
25
  <meta name="robots" content="noai, noimageai">
@@ -50,7 +66,10 @@
50
66
  <h1 class="book-title"><%= h(title) %></h1>
51
67
  <%- end -%>
52
68
  <%- end -%>
69
+ <div class="sidebar-header-actions">
53
70
  <button class="theme-toggle" id="theme-toggle" aria-label="Toggle dark mode" title="Toggle dark mode">&#9790;</button>
71
+ <button class="sidebar-collapse" id="sidebar-collapse" aria-label="Collapse sidebar" title="Collapse sidebar">&#171;</button>
72
+ </div>
54
73
  </div>
55
74
  <%- if multilang -%>
56
75
  <%- langs.each do |ld| -%>
@@ -256,7 +275,7 @@
256
275
  <%- if multilang -%>
257
276
  <%- langs.each do |ld| -%>
258
277
  <%- ld[:chapters].select(&:cover?).each do |chapter| -%>
259
- <section class="chapter cover-page" id="chapter-<%= chapter.slug %>" data-lang="<%= ld[:lang] %>" style="display: none;">
278
+ <section class="chapter cover-page" id="chapter-<%= chapter.slug %>" data-lang="<%= ld[:lang] %>"<%= src_attrs(chapter, feedback) %> style="display: none;">
260
279
  <%= chapter.html %>
261
280
  </section>
262
281
  <%- end -%>
@@ -373,7 +392,7 @@
373
392
  <%- end -%>
374
393
  <%- else -%>
375
394
  <%- chapters.select(&:cover?).each do |chapter| -%>
376
- <section class="chapter cover-page" id="chapter-<%= chapter.slug %>" style="display: none;">
395
+ <section class="chapter cover-page" id="chapter-<%= chapter.slug %>"<%= src_attrs(chapter, feedback) %> style="display: none;">
377
396
  <%= chapter.html %>
378
397
  </section>
379
398
  <%- end -%>
@@ -1041,18 +1060,44 @@
1041
1060
  }
1042
1061
  }
1043
1062
 
1044
- // Sidebar toggle for mobile
1063
+ // Sidebar show/hide. Two behaviors share one breakpoint (kept in sync with
1064
+ // the 900px media query in style.css):
1065
+ // - narrow (iPad portrait, phones): the sidebar is off-canvas; the floating
1066
+ // toggle slides it in/out as an overlay.
1067
+ // - wide (desktop): the sidebar is fixed; the in-header « button collapses
1068
+ // it so the content reclaims full width. The collapsed state persists.
1045
1069
  var toggle = document.getElementById('sidebar-toggle');
1070
+ var collapseBtn = document.getElementById('sidebar-collapse');
1046
1071
  var sidebar = document.getElementById('sidebar');
1072
+ var narrow = window.matchMedia('(max-width: 900px)');
1073
+
1074
+ function setCollapsed(state) {
1075
+ document.body.classList.toggle('sidebar-collapsed', state);
1076
+ localStorage.setItem('ligarb-sidebar-collapsed', state ? '1' : '0');
1077
+ }
1078
+
1079
+ if (localStorage.getItem('ligarb-sidebar-collapsed') === '1') {
1080
+ document.body.classList.add('sidebar-collapsed');
1081
+ }
1082
+
1047
1083
  toggle.addEventListener('click', function() {
1048
- sidebar.classList.toggle('open');
1084
+ if (narrow.matches) {
1085
+ sidebar.classList.toggle('open'); // off-canvas overlay
1086
+ } else {
1087
+ setCollapsed(false); // wide: the floating toggle only
1088
+ // shows when collapsed, so reopen
1089
+ }
1090
+ });
1091
+
1092
+ collapseBtn.addEventListener('click', function() {
1093
+ setCollapsed(true);
1049
1094
  });
1050
1095
 
1051
- // Close sidebar when clicking a link on mobile
1096
+ // Close the off-canvas sidebar after tapping a link (narrow only)
1052
1097
  var tocLinks = document.querySelectorAll('.toc a');
1053
1098
  tocLinks.forEach(function(link) {
1054
1099
  link.addEventListener('click', function() {
1055
- if (window.innerWidth <= 768) {
1100
+ if (narrow.matches) {
1056
1101
  sidebar.classList.remove('open');
1057
1102
  }
1058
1103
  });
@@ -1,7 +1,8 @@
1
1
  name: Build and deploy book
2
2
 
3
3
  # master に push すると ligarb で本をビルドし、GitHub Pages に公開する。
4
- # 事前設定: リポジトリ Settings > Pages > Source "GitHub Actions" にしておくこと。
4
+ # Pages configure-pages enablement: true で自動有効化されるため事前設定は不要。
5
+ # 手動で設定する場合は Settings > Pages > Source を "GitHub Actions" にする。
5
6
 
6
7
  on:
7
8
  push:
@@ -31,6 +32,9 @@ jobs:
31
32
  - name: Build book
32
33
  run: ligarb build # build/index.html を生成
33
34
  - uses: actions/configure-pages@v5
35
+ with:
36
+ # Pages が未設定でもワークフロー側で有効化する(初回 push のレースを防ぐ)。
37
+ enablement: true
34
38
  - uses: actions/upload-pages-artifact@v3
35
39
  with:
36
40
  path: build
@@ -108,7 +108,9 @@ gh を使わない場合や、設定の意味を確認したいときの参照
108
108
 
109
109
  ### GitHub Pages(手順 C-4 の代替)
110
110
 
111
- - Settings > Pages > Source を **"GitHub Actions"** にする。
111
+ - 基本的には設定不要。`deploy-book.yml` が初回実行時に Pages を自動で有効化する
112
+ (`configure-pages` の `enablement: true`)。
113
+ - 手動で設定する場合は Settings > Pages > Source を **"GitHub Actions"** にする。
112
114
 
113
115
  ### Actions の権限(手順 C-5 の代替)
114
116
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ligarb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.2
4
+ version: 0.9.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - ligarb contributors
@@ -65,6 +65,20 @@ dependencies:
65
65
  - - ">="
66
66
  - !ruby/object:Gem::Version
67
67
  version: '1.1'
68
+ - !ruby/object:Gem::Dependency
69
+ name: base64
70
+ requirement: !ruby/object:Gem::Requirement
71
+ requirements:
72
+ - - ">="
73
+ - !ruby/object:Gem::Version
74
+ version: '0.1'
75
+ type: :runtime
76
+ prerelease: false
77
+ version_requirements: !ruby/object:Gem::Requirement
78
+ requirements:
79
+ - - ">="
80
+ - !ruby/object:Gem::Version
81
+ version: '0.1'
68
82
  - !ruby/object:Gem::Dependency
69
83
  name: rake
70
84
  requirement: !ruby/object:Gem::Requirement
@@ -102,10 +116,12 @@ extra_rdoc_files: []
102
116
  files:
103
117
  - assets/feedback.css
104
118
  - assets/feedback.js
119
+ - assets/mermaid_check.mjs
105
120
  - assets/review.css
106
121
  - assets/review.js
107
122
  - assets/serve.js
108
123
  - assets/style.css
124
+ - docs/help.md
109
125
  - exe/ligarb
110
126
  - lib/ligarb/asset_manager.rb
111
127
  - lib/ligarb/builder.rb
@@ -116,6 +132,7 @@ files:
116
132
  - lib/ligarb/github_review.rb
117
133
  - lib/ligarb/initializer.rb
118
134
  - lib/ligarb/inotify.rb
135
+ - lib/ligarb/mermaid_checker.rb
119
136
  - lib/ligarb/review_store.rb
120
137
  - lib/ligarb/server.rb
121
138
  - lib/ligarb/template.rb