From e52ee556380e7ecb6a7a674743ebe6c0cfd561aa Mon Sep 17 00:00:00 2001 From: Lunar Date: Mon, 3 Jun 2013 12:01:55 +0200 Subject: [PATCH] Manually select YAML content in member pages This works around a strang bug in the safe_yaml gem. --- features/support/fixtures.rb | 1 + lib/nos_oignons/member.rb | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/features/support/fixtures.rb b/features/support/fixtures.rb index fb06a0c..8280d79 100644 --- a/features/support/fixtures.rb +++ b/features/support/fixtures.rb @@ -62,6 +62,7 @@ email: <%= email %> joined_on: <%= joined_on %> membership_fee_paid_on: <%= membership_fee_paid_on %> --- +[[!ftemplate id="membre"]] <%= notes %> END_OF_TEMPLATE diff --git a/lib/nos_oignons/member.rb b/lib/nos_oignons/member.rb index 8b0bd97..a67581c 100644 --- a/lib/nos_oignons/member.rb +++ b/lib/nos_oignons/member.rb @@ -59,7 +59,8 @@ module NosOignons unless page_content.start_with?("---\n") raise ArgumentError.new('content is not a proper YAML document') end - data = YAML.load(page_content) + yaml_content = /\A---\n(.*)\n---\n/m.match(page_content)[1] + data = YAML.load(yaml_content) MEMBER_FIELDS.each do |field| self[field] = data[field.to_s] end -- 2.39.5