Skip to content

Commit caa5510

Browse files
committed
Create tw5p empty for previous tw5 version
Just in case 5.4.0 has problems, let's support creating a site with the latest-1 TW version. I decided not to add an equivalent for the external tw5x version.
1 parent 941dace commit caa5510

6 files changed

Lines changed: 3205 additions & 1 deletion

File tree

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
class AddTw5pEmpty < ActiveRecord::Migration[7.2]
2+
def up
3+
Empty.find_or_create_by(name: 'tw5p') do |e|
4+
e.title = 'TiddlyWiki (previous version)'
5+
e.description = 'The previous stable version of TiddlyWiki, with internal core javascript.'.squish
6+
e.enabled = true
7+
e.info_link = 'https://tiddlywiki.com/'
8+
e.display_order = 39
9+
e.primary = false
10+
e.tooltip = "It's recommended to use the latest version, but this older
11+
version is available if needed, e.g. for plugin compatibility reasons.".squish
12+
end.update(enabled: true) # Make sure it's enabled in case you did a rollback
13+
end
14+
15+
def down
16+
# Disable it but don't delete it since there might be sites using it
17+
Empty.find_by_name('tw5p').update(enabled: false)
18+
end
19+
end

rails/db/schema.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
#
1111
# It's strongly recommended that you check this file into your version control system.
1212

13-
ActiveRecord::Schema[8.0].define(version: 2026_04_21_202925) do
13+
ActiveRecord::Schema[8.0].define(version: 2026_04_23_152602) do
1414
# These are extensions that must be enabled in order to support this database
1515
enable_extension "pg_catalog.plpgsql"
1616

rails/db/seeds/empties.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,3 +88,13 @@
8888
info_link: https://alamantus.codeberg.page/siteleteer/
8989
tooltip: To see how it works, view the clean and very readable page source. Requires
9090
a custom build of siteleteer.
91+
- id: 22
92+
name: tw5p
93+
title: TiddlyWiki (previous version)
94+
description: The previous stable version of TiddlyWiki, with internal core javascript.
95+
enabled: true
96+
display_order: 11
97+
primary: false
98+
info_link: https://tiddlywiki.com/
99+
tooltip: It's recommended to use the latest version, but this older version is available
100+
if you need it, e.g. for plugin compatibility reasons.

rails/test/fixtures/empties.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,3 +73,14 @@ sitelet:
7373
info_link: https://alamantus.codeberg.page/siteleteer/
7474
tooltip: To see how it works, view the clean and very readable page source. Requires
7575
a custom build of siteleteer.
76+
tw5p:
77+
id: 22
78+
name: tw5p
79+
title: TiddlyWiki (previous version)
80+
description: The previous stable version of TiddlyWiki, with internal core javascript.
81+
enabled: true
82+
display_order: 39
83+
primary: false
84+
info_link: https://tiddlywiki.com/
85+
tooltip: It's recommended to use the latest version, but this older version is available
86+
if needed, e.g. for plugin compatibility reasons.

rails/test/models/tw_file_test.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,10 @@ class TwFileTest < ActiveSupport::TestCase
153153

154154
empty = Empty.find_by_name(tw_kind)
155155
assert empty, "No empty found for kind #{tw_kind}!"
156+
157+
# tw5p is the same kind as tw5, just a different version
158+
next if tw_kind == "tw5p"
159+
156160
assert_equal(tw_kind, empty.kind, "Derived kind was #{empty.kind}, expecting #{tw_kind}!")
157161
end
158162
end

rails/tw_content/empties/tw5p.html

Lines changed: 3160 additions & 0 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)