Remove fragments

This commit is contained in:
Alex Kotov 2024-09-11 08:28:30 +04:00
parent 478159c4f1
commit fa0c87ce13
Signed by: kotovalexarian
GPG key ID: 553C0EBBEB5D5F08
3 changed files with 1 additions and 15 deletions

View file

@ -12,17 +12,13 @@ module Referator
end
def to_h
@to_h ||= data.merge(category:, id:, slug:, anchor:, fragment:).freeze
@to_h ||= data.merge(category:, id:, slug:, anchor:).freeze
end
def anchor
@anchor ||= "#{category}-#{slug}".freeze
end
def fragment
@fragment ||= "##{anchor}".freeze
end
private
def category=(category)

View file

@ -43,21 +43,17 @@ REFS = {
self: {
foo: RAW_REFS[:self][:foo].merge(
'anchor' => 'self-blog-foo',
'fragment' => '#self-blog-foo',
).freeze,
bar: RAW_REFS[:self][:bar].merge(
'anchor' => 'self-blog-bar',
'fragment' => '#self-blog-bar',
).freeze,
}.freeze,
link: {
example_com: RAW_REFS[:link][:example_com].merge(
'anchor' => 'link-example-com',
'fragment' => '#link-example-com',
).freeze,
causa_arcana_com: RAW_REFS[:link][:causa_arcana_com].merge(
'anchor' => 'link-causa-arcana-com',
'fragment' => '#link-causa-arcana-com',
).freeze,
}.freeze,
}.freeze
@ -256,7 +252,6 @@ cmd :RENDER_FOOTNOTES, :json do |result|
"id": "/blog/foo",
"slug": "blog-foo",
"anchor": "self-blog-foo",
"fragment": "#self-blog-foo",
"url": "/blog/foo.html",
"text": "Foo"
},
@ -266,7 +261,6 @@ cmd :RENDER_FOOTNOTES, :json do |result|
"id": "/blog/bar",
"slug": "blog-bar",
"anchor": "self-blog-bar",
"fragment": "#self-blog-bar",
"url": "/blog/bar.html",
"text": "Bar"
}
@ -278,7 +272,6 @@ cmd :RENDER_FOOTNOTES, :json do |result|
"id": "example_com",
"slug": "example-com",
"anchor": "link-example-com",
"fragment": "#link-example-com",
"url": "https://example.com",
"text": "Example Domain"
},
@ -288,7 +281,6 @@ cmd :RENDER_FOOTNOTES, :json do |result|
"id": "causa_arcana_com",
"slug": "causa-arcana-com",
"anchor": "link-causa-arcana-com",
"fragment": "#link-causa-arcana-com",
"url": "https://causa-arcana.com",
"text": "Causa Arcana"
}

View file

@ -7,7 +7,6 @@
"id": <%= String(note['id']).to_json %>,
"slug": <%= String(note['slug']).to_json %>,
"anchor": <%= String(note['anchor']).to_json %>,
"fragment": <%= String(note['fragment']).to_json %>,
"url": <%= "#{note['id']}.html".to_json %>,
"text": <%= String(note['text']).to_json %>
}<%= ',' unless index == notes['self'].count - 1 %>
@ -21,7 +20,6 @@
"id": <%= String(note['id']).to_json %>,
"slug": <%= String(note['slug']).to_json %>,
"anchor": <%= String(note['anchor']).to_json %>,
"fragment": <%= String(note['fragment']).to_json %>,
"url": <%= String(note['url']).to_json %>,
"text": <%= String(note['text']).to_json %>
}<%= ',' unless index == notes['link'].count - 1 %>