This works around a strang bug in the safe_yaml gem.
joined_on: <%= joined_on %>
membership_fee_paid_on: <%= membership_fee_paid_on %>
---
joined_on: <%= joined_on %>
membership_fee_paid_on: <%= membership_fee_paid_on %>
---
+[[!ftemplate id="membre"]]
<%= notes %>
END_OF_TEMPLATE
<%= notes %>
END_OF_TEMPLATE
unless page_content.start_with?("---\n")
raise ArgumentError.new('content is not a proper YAML document')
end
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
MEMBER_FIELDS.each do |field|
self[field] = data[field.to_s]
end