andromeda_cms 0.4.1-x86_64-linux → 0.5.0-x86_64-linux

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: f3e819f41cde88cb7ccf5d457720e14bc768c3940a3ef42ae382c7521570985f
4
- data.tar.gz: 62d143fed6361250ce20c0d2c2496f5bf5feadfdffd8ab75f023a951796c5c5a
3
+ metadata.gz: 03ab78f438713d8cd183ac96f3793c2c2edbbb333d34946194019f3995703209
4
+ data.tar.gz: 772700733a8ff9222a5d84383015894eaab3f77311d292fbf827825dbac688f4
5
5
  SHA512:
6
- metadata.gz: 3b975eebe2484d7c78661b745d2307dd064f07904e1d5159bb9d62226f9c56dd1a50769db2296ea3b5d7cb91c4c63e147311abf693596dbdb61119abce15840b
7
- data.tar.gz: 779101175479231d7e210bcd83d83de27aff6010232e310df1efa0822e8774da9f57d748133e425cc4b16e313bc5a5b9f9a524cc734feeb11a16d368373bf593
6
+ metadata.gz: d4b27eda0bf028f490e1672aa98cc3b15aa1ef3dc7d484212b1182595dc3900125786932f27e5cdc5f0f819e356f50905c7a991857e59d08457e00064165d499
7
+ data.tar.gz: b4706963e72a3f7366607eca5e5697f4363d6250963080b9a66f3ed1060e8461efb53c14c31f5a71e361f7d2447ea145db4018894ea5dd363fce4c4c20a91d2b
data/CHANGELOG.md CHANGED
@@ -5,6 +5,28 @@ All notable changes to this project are documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [0.5.0] - 2026-10-07
9
+
10
+ ### Changed
11
+
12
+ - `andromeda_content` now wraps the entry body in an `<andromeda-content>`
13
+ element, so the body can be targeted from CSS. Browsers treat an unknown
14
+ element as inline, so add `andromeda-content { display: block; }` to your
15
+ stylesheet. Markup that selected the body's direct children from the
16
+ parent element needs updating. Inside a component rendered during
17
+ `andromeda:build` the wrapper is left out, so an embedded entry is not
18
+ wrapped twice.
19
+
20
+ ## [0.4.2] - 2026-09-30
21
+
22
+ ### Fixed
23
+
24
+ - In development, a file added or edited under `app/content/` now shows up
25
+ without restarting the server. `Entry` used to keep the list it loaded
26
+ first, so a new file returned 404 and an edited one kept its old content.
27
+ The list is now reloaded when the paths, mtimes or sizes of the collection's
28
+ source files change; production is unchanged.
29
+
8
30
  ## [0.4.1] - 2026-09-29
9
31
 
10
32
  ### Fixed
@@ -131,6 +153,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
131
153
  - Generators: `andromeda:install`, `andromeda:collection`,
132
154
  `andromeda:component` and `andromeda:import_astro`.
133
155
 
156
+ [0.5.0]: https://github.com/AndromedaCMS/andromeda_cms/releases/tag/v0.5.0
157
+ [0.4.2]: https://github.com/AndromedaCMS/andromeda_cms/releases/tag/v0.4.2
134
158
  [0.4.1]: https://github.com/AndromedaCMS/andromeda_cms/releases/tag/v0.4.1
135
159
  [0.4.0]: https://github.com/AndromedaCMS/andromeda_cms/releases/tag/v0.4.0
136
160
  [0.3.0]: https://github.com/AndromedaCMS/andromeda_cms/releases/tag/v0.3.0
data/README.md CHANGED
@@ -107,6 +107,10 @@ end
107
107
  </article>
108
108
  ```
109
109
 
110
+ `andromeda_content` wraps the body in an `<andromeda-content>` element. Browsers
111
+ treat it as inline by default, so add `andromeda-content { display: block; }`
112
+ to your stylesheet.
113
+
110
114
  From there it is your code. A typical next step is to make fields mandatory,
111
115
  add a draft flag, and add a table of contents:
112
116
 
@@ -1,5 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require "digest"
3
4
  require "pathname"
4
5
 
5
6
  module Andromeda
@@ -45,6 +46,7 @@ module Andromeda
45
46
  @base_dir = resolve_base(base)
46
47
  @pattern = pattern
47
48
  @entries = nil
49
+ @entries_signature = nil
48
50
  Andromeda::Registry.register(@collection_name, self)
49
51
  self
50
52
  end
@@ -174,10 +176,12 @@ module Andromeda
174
176
  end
175
177
 
176
178
  # Drops the in-memory cache, forcing the next query to re-run the
177
- # Loader. Used by tests that change fixtures mid-example, and is the
178
- # hook the dev-mode "reconvert on stale mtime" check will call.
179
+ # Loader. Used by tests that change fixtures mid-example and by
180
+ # Andromeda::Check; development queries notice source changes on their
181
+ # own (see `entries`).
179
182
  def reload!
180
183
  @entries = nil
184
+ @entries_signature = nil
181
185
  end
182
186
 
183
187
  private
@@ -190,10 +194,33 @@ module Andromeda
190
194
  # the index is only rewritten once a collection finishes converting,
191
195
  # so a component querying entries mid-build reads source instead
192
196
  # (see Andromeda::BuildContext).
197
+ #
198
+ # The development cache is dropped whenever the source files change
199
+ # (see `source_signature`), so a file added or edited while the server
200
+ # runs shows up on the next query without a restart.
193
201
  def entries
194
202
  return source_entries if Andromeda::BuildContext.building?
203
+ return @entries ||= entries_from_index if production?
204
+
205
+ signature = source_signature
206
+ if @entries.nil? || signature != @entries_signature
207
+ @entries = load_entries_from_source
208
+ @entries_signature = signature
209
+ end
210
+ @entries
211
+ end
212
+
213
+ # Paths, mtimes and sizes of the collection's source files: an added or
214
+ # removed file changes the path list, an edit changes mtime/size. Same
215
+ # scheme as Andromeda::Pipeline#render_key uses for component partials.
216
+ def source_signature
217
+ files = Dir.glob(pattern, base: base_dir).sort.filter_map do |relative|
218
+ file = File.join(base_dir, relative)
219
+ next unless File.file?(file)
195
220
 
196
- @entries ||= production? ? entries_from_index : load_entries_from_source
221
+ [relative, File.mtime(file).to_r, File.size(file)].join(":")
222
+ end
223
+ Digest::SHA256.hexdigest(files.join("\n"))
197
224
  end
198
225
 
199
226
  def production?
@@ -5,7 +5,11 @@ module Andromeda
5
5
  # thin presentation layer over data the build already produced: no parsing
6
6
  # or rendering happens while serving a request.
7
7
  module Helpers
8
- # Outputs an entry's converted body. Marked html_safe because the build
8
+ # Outputs an entry's converted body, wrapped in `<andromeda-content>` so
9
+ # it can be targeted from CSS. Inside a component rendered at conversion
10
+ # time the wrapper is left out: the component's output is stored in the
11
+ # entry's html and wrapped once, when the page is served. Marked
12
+ # html_safe because the build
9
13
  # produced this markup from content the application's own authors wrote,
10
14
  # the same trust model Astro applies to `.md`/`.mdx` (see 13_security).
11
15
  # Inside a component rendered at conversion time the asset markers are
@@ -14,8 +18,9 @@ module Andromeda
14
18
  # @param entry [Andromeda::Entry]
15
19
  # @return [ActiveSupport::SafeBuffer]
16
20
  def andromeda_content(entry)
17
- html = Andromeda::BuildContext.converting? ? entry.html : Andromeda::Assets.resolve(entry.html)
18
- html.html_safe # rubocop:disable Rails/OutputSafety
21
+ return entry.html.html_safe if Andromeda::BuildContext.converting? # rubocop:disable Rails/OutputSafety
22
+
23
+ tag.send("andromeda-content", Andromeda::Assets.resolve(entry.html).html_safe) # rubocop:disable Rails/OutputSafety
19
24
  end
20
25
 
21
26
  # Inside a component partial rendered at conversion time, this returns
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Andromeda
4
- VERSION = "0.4.1"
4
+ VERSION = "0.5.0"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: andromeda_cms
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.1
4
+ version: 0.5.0
5
5
  platform: x86_64-linux
6
6
  authors:
7
7
  - LIMHAUS Inc.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2026-09-29 00:00:00.000000000 Z
11
+ date: 2026-10-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: railties