jekyll-awesome-nav 0.1.2 → 0.1.3

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2cfc859de2a4762ba5046338aa7bc12049da70bfb2d9ac27d727eace95322f11
4
- data.tar.gz: 0f14a593b81ec5882b65db61b82e93d8bd8f9a3656a8d730cd0f4175a2da65e3
3
+ metadata.gz: 76b40b8ac598c39b7d6ea9b1235a4089893bd73e52d8722e8a2c4af8115aa468
4
+ data.tar.gz: d4109676b6da69d8f40d623b55d40087d57c45f46c718fa349116a9080807bf9
5
5
  SHA512:
6
- metadata.gz: 39eccdb01ce4ecd9c828f2c66b6997b6ef769ec199ffb6a94a206fa6f449c615f84edf7928290029adde02b97bdc24a9050ae70654047915181c26bd81c72a49
7
- data.tar.gz: '008767e37db8c06b2b2c77ffa4a1cc9f437653a33684a90994d7e7da854b836b5c39687ed3065d0adcd1e6692f757a1e9346cec259e85725d5853495112f33bb'
6
+ metadata.gz: 89bb231311898453666edc086e0a54d6593d6c2644749e4f8a021253b0d272bb56f9bb0c522b9eac17314ea94ccd33e0d2289bd01dde5b69fc9f5f95b2b61ec9
7
+ data.tar.gz: 7c05e014b8ad8ae8d6fc31f3382af750f10bde1d481f1ad1e19def058645c85e6a4db8b95514a674736da12170e2a49d30898a248ed8c4296d526f967257823c
@@ -1,5 +1,5 @@
1
1
  # Changes here will be overwritten by Copier; NEVER EDIT MANUALLY
2
- _commit: afa589e
2
+ _commit: 618054b
3
3
  _src_path: gh:athackst/ci
4
4
  automerge_mode: poll
5
5
  bump_script_path: ''
data/.vscode/tasks.json CHANGED
@@ -65,6 +65,59 @@
65
65
  "endsPattern": ".*Server address:.*"
66
66
  }
67
67
  }
68
+ },
69
+ {
70
+ "label": "Build Fixture Preview",
71
+ "type": "shell",
72
+ "command": "bundle exec jekyll build --source test/fixtures/${input:fixtureName} --config test/fixtures/${input:fixtureName}/_config.yml,test/fixtures/_preview_theme/_config.preview.yml --destination _site/fixtures/${input:fixtureName}",
73
+ "options": {
74
+ "cwd": "${workspaceFolder}"
75
+ },
76
+ "group": "build",
77
+ "problemMatcher": []
78
+ },
79
+ {
80
+ "label": "Serve Fixture Preview",
81
+ "type": "shell",
82
+ "command": "bundle exec jekyll serve --source test/fixtures/${input:fixtureName} --config test/fixtures/${input:fixtureName}/_config.yml,test/fixtures/_preview_theme/_config.preview.yml --destination _site/fixtures/${input:fixtureName} --livereload --port 4011",
83
+ "options": {
84
+ "cwd": "${workspaceFolder}"
85
+ },
86
+ "isBackground": true,
87
+ "problemMatcher": {
88
+ "owner": "jekyll",
89
+ "pattern": {
90
+ "regexp": ".",
91
+ "file": 1,
92
+ "location": 1,
93
+ "message": 1
94
+ },
95
+ "background": {
96
+ "activeOnStart": true,
97
+ "beginsPattern": ".*Generating.*",
98
+ "endsPattern": ".*Server address:.*"
99
+ }
100
+ }
101
+ }
102
+ ],
103
+ "inputs": [
104
+ {
105
+ "id": "fixtureName",
106
+ "type": "pickString",
107
+ "description": "Choose which Jekyll fixture to preview",
108
+ "default": "site",
109
+ "options": [
110
+ "external_override",
111
+ "invalid_override",
112
+ "manual_dedup",
113
+ "nav_features",
114
+ "nested_manual_dedup",
115
+ "readme_index",
116
+ "readme_manual_section",
117
+ "root_site",
118
+ "site",
119
+ "untitled_index"
120
+ ]
68
121
  }
69
122
  ]
70
123
  }
@@ -54,6 +54,9 @@ module Jekyll
54
54
  crumb
55
55
  end
56
56
 
57
+ breadcrumbs = trim_root_breadcrumb(breadcrumbs)
58
+ return breadcrumbs if @root_dir.empty?
59
+
57
60
  prepend_root_breadcrumb(breadcrumbs)
58
61
  end
59
62
 
@@ -95,11 +98,24 @@ module Jekyll
95
98
  "url" => Utils.normalize_url(@root_page&.url || "/#{@root_dir}/")
96
99
  }
97
100
 
98
- return breadcrumbs if breadcrumbs.first == root_crumb
101
+ return [root_crumb] + breadcrumbs[1..] if same_breadcrumb_url?(breadcrumbs.first, root_crumb)
99
102
 
100
103
  [root_crumb] + breadcrumbs
101
104
  end
102
105
 
106
+ def trim_root_breadcrumb(breadcrumbs)
107
+ return breadcrumbs if breadcrumbs.empty?
108
+
109
+ root_crumb = {
110
+ "title" => resolved_root_title,
111
+ "url" => Utils.normalize_url(@root_page&.url || "/#{@root_dir}/")
112
+ }
113
+
114
+ return breadcrumbs unless same_breadcrumb_url?(breadcrumbs.first, root_crumb)
115
+
116
+ breadcrumbs[1..] || []
117
+ end
118
+
103
119
  def neighbor_map
104
120
  @neighbor_map ||= begin
105
121
  items = []
@@ -146,6 +162,12 @@ module Jekyll
146
162
  Marshal.load(Marshal.dump(value))
147
163
  end
148
164
 
165
+ def same_breadcrumb_url?(left, right)
166
+ return false unless left && right
167
+
168
+ Utils.normalize_url(left["url"]) == Utils.normalize_url(right["url"])
169
+ end
170
+
149
171
  def resolved_root_title
150
172
  title = @root_page&.data&.fetch("nav_title", nil) ||
151
173
  @root_page&.data&.fetch("title", nil) ||
@@ -63,8 +63,7 @@ module Jekyll
63
63
  end
64
64
  end
65
65
 
66
- def section_title_for_index(page, basename, current, resolved_title)
67
- return resolved_title unless basename.downcase == "readme"
66
+ def section_title_for_index(page, _basename, current, resolved_title)
68
67
  return resolved_title if page.data["nav_title"] || page.data["title"]
69
68
  return current.title unless current.title.to_s.empty?
70
69
 
@@ -90,8 +90,17 @@ module Jekyll
90
90
  normalize_dir(path)
91
91
  end
92
92
 
93
- def page_title(page, basename)
94
- page.data["nav_title"] || page.data["title"] || titleize(basename)
93
+ def page_title(page, basename = nil)
94
+ explicit_title = page.data["nav_title"] || page.data["title"]
95
+ return explicit_title if explicit_title
96
+
97
+ if index_page?(page)
98
+ directory_title = titleize(last_segment(source_dir_for(page)))
99
+ return directory_title unless directory_title.empty?
100
+ end
101
+
102
+ basename ||= File.basename(source_path_for(page), File.extname(source_path_for(page)))
103
+ titleize(basename)
95
104
  end
96
105
  end
97
106
  end
@@ -2,7 +2,7 @@
2
2
 
3
3
  module Jekyll
4
4
  module AwesomeNav
5
- VERSION = "0.1.2"
5
+ VERSION = "0.1.3"
6
6
 
7
7
  def self.warn_if_unstamped_version(output = $stderr)
8
8
  return unless VERSION == "0.0.0"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll-awesome-nav
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Allison Thackston
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2026-05-13 00:00:00.000000000 Z
11
+ date: 2026-05-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jekyll