Remove unnecessary code

This commit is contained in:
Alex Kotov 2024-02-21 10:24:53 +04:00
parent 16de2d44e6
commit 478159c4f1
Signed by: kotovalexarian
GPG Key ID: 553C0EBBEB5D5F08
5 changed files with 0 additions and 65 deletions

View File

@ -47,20 +47,6 @@ module Referator
)
end
def render_cite_sup(name, note)
name = String(name).to_sym
exists! name
config.scripts.run(
@scripts[name],
**script_vars(
template: :cite_sup,
format: name,
note: note.to_json,
),
)
end
private
def config=(config)

View File

@ -44,18 +44,6 @@ module Referator
config.formats.render_footnotes format, notes
end
def render_cite_sup(format:, category:, id:)
format = format.to_sym if format.instance_of? String
category = category.to_sym if category.instance_of? String
note = notes.flat_map(&:last).find do |curr_note|
curr_note[:category] == String(category).to_sym &&
curr_note[:id] == String(id)
end
raise 'Unknown note' if note.nil?
config.formats.render_cite_sup format, note
end
private
def config=(config)

View File

@ -129,11 +129,6 @@ module Referator
String @footnotes.render_footnotes command.data
end
def do_render_cite_sup(command)
@config.freeze
String @footnotes.render_cite_sup(**command.data_kwargs!)
end
#########
# Utils #
#########

33
test.rb
View File

@ -299,39 +299,6 @@ cmd :RENDER_FOOTNOTES, :json do |result|
raise unless result == expected
end
###################
# RENDER_CITE_SUP #
###################
cmd(
:RENDER_CITE_SUP,
{ format: :html, category: :self, id: '/blog/foo' },
) do |result|
raise unless result == "<sup><a href=\"#self-blog-foo\">[1]</a></sup>\n"
end
cmd(
:RENDER_CITE_SUP,
{ format: :html, category: :self, id: '/blog/bar' },
) do |result|
raise unless result == "<sup><a href=\"#self-blog-bar\">[2]</a></sup>\n"
end
cmd(
:RENDER_CITE_SUP,
{ format: :html, category: :link, id: :example_com },
) do |result|
raise unless result == "<sup><a href=\"#link-example-com\">[3]</a></sup>\n"
end
cmd(
:RENDER_CITE_SUP,
{ format: :html, category: :link, id: :causa_arcana_com },
) do |result|
raise unless result ==
"<sup><a href=\"#link-causa-arcana-com\">[4]</a></sup>\n"
end
########
# EXIT #
########

View File

@ -1 +0,0 @@
<sup><a href="<%= note['fragment'] %>">[<%= note['index'] %>]</a></sup>