Commit 82f5dcff authored by charlie-ablett's avatar charlie-ablett
Browse files

Add module to step classes

parent e9d29a26
require 'coko_conversion/ink_step/xsweet_pipeline/download_and_execute_xsl_via_saxon'
module InkStep
module XsweetPipeline
class CollapseParagraphs < XsweetPipeline::DownloadAndExecuteXslViaSaxon
def perform_step(options: {})
new_hash = options.merge(remote_xsl_uri: remote_xsl_location)
super(options: new_hash)
end
def remote_xsl_location
"https://gitlab.coko.foundation/wendell/XSweet/raw/ink-api-publish/applications/docx-extract/collapse-paragraphs.xsl"
end
def description
"Identifies headers by font size"
end
end
end
end
\ No newline at end of file
require 'coko_conversion/ink_step/xsweet_pipeline/download_and_execute_xsl_via_saxon'
module InkStep
module XsweetPipeline
module DocxExtract
class CollapseParagraphsStep < XsweetPipeline::DownloadAndExecuteXslViaSaxon
def perform_step(options: {})
new_hash = options.merge(remote_xsl_uri: remote_xsl_location)
super(options: new_hash)
end
def remote_xsl_location
"https://gitlab.coko.foundation/wendell/XSweet/raw/ink-api-publish/applications/docx-extract/collapse-paragraphs.xsl"
end
def description
"Identifies headers by font size"
end
end
end
end
end
\ No newline at end of file
......@@ -2,21 +2,22 @@ require 'coko_conversion/ink_step/xsweet_pipeline/download_and_execute_xsl_via_s
module InkStep
module XsweetPipeline
class DocxToHtmlExtractStep < DownloadAndExecuteXslViaSaxonOnDocx
module DocxExtract
class DocxToHtmlExtractStep < DownloadAndExecuteXslViaSaxonOnDocx
def perform_step(options: {})
new_hash = options.merge(remote_xsl_uri: remote_xsl_location)
super(options: new_hash)
end
def perform_step(options: {})
new_hash = options.merge(remote_xsl_uri: remote_xsl_location)
super(options: new_hash)
end
def remote_xsl_location
"https://gitlab.coko.foundation/wendell/XSweet/raw/ink-api-publish/applications/docx-extract/docx-html-extract.xsl"
end
def remote_xsl_location
"https://gitlab.coko.foundation/wendell/XSweet/raw/ink-api-publish/applications/docx-extract/docx-html-extract.xsl"
end
def description
"Extracts content from a .docx file to a HTML Typescript-conforming .html file"
def description
"Extracts content from a .docx file to a HTML Typescript-conforming .html file"
end
end
end
end
end
\ No newline at end of file
......@@ -2,19 +2,21 @@ require 'coko_conversion/ink_step/xsweet_pipeline/download_and_execute_xsl_via_s
module InkStep
module XsweetPipeline
class HandleNotesStep < XsweetPipeline::DownloadAndExecuteXslViaSaxon
module DocxExtract
class HandleNotesStep < XsweetPipeline::DownloadAndExecuteXslViaSaxon
def perform_step(options: {})
new_hash = options.merge(remote_xsl_uri: remote_xsl_location)
super(options: new_hash)
end
def perform_step(options: {})
new_hash = options.merge(remote_xsl_uri: remote_xsl_location)
super(options: new_hash)
end
def remote_xsl_location
"https://gitlab.coko.foundation/wendell/XSweet/raw/ink-api-publish/applications/docx-extract/handle-notes.xsl"
end
def remote_xsl_location
"https://gitlab.coko.foundation/wendell/XSweet/raw/ink-api-publish/applications/docx-extract/handle-notes.xsl"
end
def description
"Handles the notes"
def description
"Handles the notes"
end
end
end
end
......
......@@ -2,19 +2,21 @@ require 'coko_conversion/ink_step/xsweet_pipeline/download_and_execute_xsl_via_s
module InkStep
module XsweetPipeline
class JoinElementsStep < XsweetPipeline::DownloadAndExecuteXslViaSaxon
module DocxExtract
class JoinElementsStep < XsweetPipeline::DownloadAndExecuteXslViaSaxon
def perform_step(options: {})
new_hash = options.merge(remote_xsl_uri: remote_xsl_location)
super(options: new_hash)
end
def perform_step(options: {})
new_hash = options.merge(remote_xsl_uri: remote_xsl_location)
super(options: new_hash)
end
def remote_xsl_location
"https://gitlab.coko.foundation/wendell/XSweet/raw/ink-api-publish/applications/docx-extract/join-elements.xsl"
end
def remote_xsl_location
"https://gitlab.coko.foundation/wendell/XSweet/raw/ink-api-publish/applications/docx-extract/join-elements.xsl"
end
def description
"Joins identical elements (e.g. <span>the </span><span>fish</span> => <span>the fish</span>)"
def description
"Joins identical elements (e.g. <span>the </span><span>fish</span> => <span>the fish</span>)"
end
end
end
end
......
......@@ -2,19 +2,21 @@ require 'coko_conversion/ink_step/xsweet_pipeline/download_and_execute_xsl_via_s
module InkStep
module XsweetPipeline
class ScrubStep < XsweetPipeline::DownloadAndExecuteXslViaSaxon
module DocxExtract
class ScrubStep < XsweetPipeline::DownloadAndExecuteXslViaSaxon
def perform_step(options: {})
new_hash = options.merge(remote_xsl_uri: remote_xsl_location)
super(options: new_hash)
end
def perform_step(options: {})
new_hash = options.merge(remote_xsl_uri: remote_xsl_location)
super(options: new_hash)
end
def remote_xsl_location
"https://gitlab.coko.foundation/wendell/XSweet/raw/ink-api-publish/applications/docx-extract/scrub.xsl"
end
def remote_xsl_location
"https://gitlab.coko.foundation/wendell/XSweet/raw/ink-api-publish/applications/docx-extract/scrub.xsl"
end
def description
"Removes superfluous elements (e.g. <i/>)"
def description
"Removes superfluous elements (e.g. <i/>)"
end
end
end
end
......
module CokoConversion
VERSION = '0.1.8'
VERSION = '0.1.9'
end
\ No newline at end of file
......@@ -5,7 +5,7 @@ require 'coko_conversion/ink_step/xsweet_pipeline/docx_extract/docx_to_html_extr
require 'coko_conversion/ink_step/xsweet_pipeline/docx_extract/handle_notes_step'
require 'coko_conversion/ink_step/xsweet_pipeline/docx_extract/scrub_step'
require 'coko_conversion/ink_step/xsweet_pipeline/docx_extract/join_elements_step'
require 'coko_conversion/ink_step/xsweet_pipeline/docx_extract/collapse_paragraphs'
require 'coko_conversion/ink_step/xsweet_pipeline/docx_extract/collapse_paragraphs_step'
describe InkStep::XsweetPipeline::DownloadAndExecuteXslViaSaxon do
......@@ -41,7 +41,7 @@ describe InkStep::XsweetPipeline::DownloadAndExecuteXslViaSaxon do
describe 'Xsweet pipeline step 1' do
let(:target_file_name) { "basic_doc.docx" }
subject { InkStep::XsweetPipeline::DocxToHtmlExtractStep.new(chain_file_location: temp_directory, position: 1) }
subject { InkStep::XsweetPipeline::DocxExtract::DocxToHtmlExtractStep.new(chain_file_location: temp_directory, position: 1) }
let!(:xsl_file) { File.read('spec/fixtures/files/xsweet_pipeline/docx-html-extract.xsl') }
specify do
......@@ -52,7 +52,7 @@ describe InkStep::XsweetPipeline::DownloadAndExecuteXslViaSaxon do
describe 'Xsweet pipeline step 2' do
let(:target_file_name) { "xsweet_2_handle_notes_input.html" }
subject { InkStep::XsweetPipeline::HandleNotesStep.new(chain_file_location: temp_directory, position: 1) }
subject { InkStep::XsweetPipeline::DocxExtract::HandleNotesStep.new(chain_file_location: temp_directory, position: 1) }
let!(:html_file) { 'spec/fixtures/files/xsweet_pipeline/xsweet_2_handle_notes_input.html' }
let!(:xsl_file) { File.read('spec/fixtures/files/xsweet_pipeline/handle-notes.xsl') }
......@@ -67,7 +67,7 @@ describe InkStep::XsweetPipeline::DownloadAndExecuteXslViaSaxon do
describe 'Xsweet pipeline step 3' do
let(:target_file_name) { "xsweet_3_scrub_input.html" }
subject { InkStep::XsweetPipeline::ScrubStep.new(chain_file_location: temp_directory, position: 1) }
subject { InkStep::XsweetPipeline::DocxExtract::ScrubStep.new(chain_file_location: temp_directory, position: 1) }
let!(:html_file) { 'spec/fixtures/files/xsweet_pipeline/xsweet_3_scrub_input.html' }
let(:xsl_file) { File.read('spec/fixtures/files/xsweet_pipeline/scrub.xsl') }
......@@ -78,7 +78,7 @@ describe InkStep::XsweetPipeline::DownloadAndExecuteXslViaSaxon do
describe 'Xsweet pipeline step 4' do
let(:target_file_name) { "xsweet_4_join_elements_input.html" }
subject { InkStep::XsweetPipeline::JoinElementsStep.new(chain_file_location: temp_directory, position: 1) }
subject { InkStep::XsweetPipeline::DocxExtract::JoinElementsStep.new(chain_file_location: temp_directory, position: 1) }
let!(:html_file) { 'spec/fixtures/files/xsweet_pipeline/xsweet_4_join_elements_input.html' }
let(:xsl_file) { File.read('spec/fixtures/files/xsweet_pipeline/join-elements.xsl') }
......@@ -88,13 +88,13 @@ describe InkStep::XsweetPipeline::DownloadAndExecuteXslViaSaxon do
end
describe 'Xsweet pipeline step 5' do
let(:target_file_name) { "xsweet_5_zorba_map_input.html" }
subject { InkStep::XsweetPipeline::CollapseParagraphs.new(chain_file_location: temp_directory, position: 1) }
let(:html_file) { 'spec/fixtures/files/xsweet_pipeline/xsweet_5_zorba_map_input.html' }
let(:target_file_name) { "xsweet_5_collapse_paragraphs_input.html" }
subject { InkStep::XsweetPipeline::DocxExtract::CollapseParagraphsStep.new(chain_file_location: temp_directory, position: 1) }
let(:html_file) { 'spec/fixtures/files/xsweet_pipeline/xsweet_5_collapse_paragraphs_input.html' }
let(:xsl_file) { File.read('spec/fixtures/files/xsweet_pipeline/zorba-map.xsl') }
specify do
test_result(expected_result_path: 'spec/fixtures/files/xsweet_pipeline/xsweet_5_zorba_map_result.html')
test_result(expected_result_path: 'spec/fixtures/files/xsweet_pipeline/xsweet_5_collapse_paragraphs_result.html')
end
end
end
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment