Remove unnecessary code
This commit is contained in:
parent
16de2d44e6
commit
478159c4f1
|
@ -47,20 +47,6 @@ module Referator
|
||||||
)
|
)
|
||||||
end
|
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
|
private
|
||||||
|
|
||||||
def config=(config)
|
def config=(config)
|
||||||
|
|
|
@ -44,18 +44,6 @@ module Referator
|
||||||
config.formats.render_footnotes format, notes
|
config.formats.render_footnotes format, notes
|
||||||
end
|
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
|
private
|
||||||
|
|
||||||
def config=(config)
|
def config=(config)
|
||||||
|
|
|
@ -129,11 +129,6 @@ module Referator
|
||||||
String @footnotes.render_footnotes command.data
|
String @footnotes.render_footnotes command.data
|
||||||
end
|
end
|
||||||
|
|
||||||
def do_render_cite_sup(command)
|
|
||||||
@config.freeze
|
|
||||||
String @footnotes.render_cite_sup(**command.data_kwargs!)
|
|
||||||
end
|
|
||||||
|
|
||||||
#########
|
#########
|
||||||
# Utils #
|
# Utils #
|
||||||
#########
|
#########
|
||||||
|
|
33
test.rb
33
test.rb
|
@ -299,39 +299,6 @@ cmd :RENDER_FOOTNOTES, :json do |result|
|
||||||
raise unless result == expected
|
raise unless result == expected
|
||||||
end
|
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 #
|
# EXIT #
|
||||||
########
|
########
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
<sup><a href="<%= note['fragment'] %>">[<%= note['index'] %>]</a></sup>
|
|
Loading…
Reference in New Issue