From 478159c4f1baae50d0a4609966d6247716c44b80 Mon Sep 17 00:00:00 2001 From: Alex Kotov Date: Wed, 21 Feb 2024 10:24:53 +0400 Subject: [PATCH] Remove unnecessary code --- lib/referator/config/formats.rb | 14 -------------- lib/referator/footnotes.rb | 12 ------------ lib/referator/machine.rb | 5 ----- test.rb | 33 --------------------------------- test/cite_sup.html.erb | 1 - 5 files changed, 65 deletions(-) delete mode 100644 test/cite_sup.html.erb diff --git a/lib/referator/config/formats.rb b/lib/referator/config/formats.rb index cb295f6..d82de04 100644 --- a/lib/referator/config/formats.rb +++ b/lib/referator/config/formats.rb @@ -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) diff --git a/lib/referator/footnotes.rb b/lib/referator/footnotes.rb index a39a3ff..563bebe 100644 --- a/lib/referator/footnotes.rb +++ b/lib/referator/footnotes.rb @@ -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) diff --git a/lib/referator/machine.rb b/lib/referator/machine.rb index 75aaf11..885b920 100644 --- a/lib/referator/machine.rb +++ b/lib/referator/machine.rb @@ -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 # ######### diff --git a/test.rb b/test.rb index 1e3c61b..8623222 100755 --- a/test.rb +++ b/test.rb @@ -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 == "[1]\n" -end - -cmd( - :RENDER_CITE_SUP, - { format: :html, category: :self, id: '/blog/bar' }, -) do |result| - raise unless result == "[2]\n" -end - -cmd( - :RENDER_CITE_SUP, - { format: :html, category: :link, id: :example_com }, -) do |result| - raise unless result == "[3]\n" -end - -cmd( - :RENDER_CITE_SUP, - { format: :html, category: :link, id: :causa_arcana_com }, -) do |result| - raise unless result == - "[4]\n" -end - ######## # EXIT # ######## diff --git a/test/cite_sup.html.erb b/test/cite_sup.html.erb deleted file mode 100644 index e996a69..0000000 --- a/test/cite_sup.html.erb +++ /dev/null @@ -1 +0,0 @@ -[<%= note['index'] %>]