Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
INK
inkstep_coko_conversion
Commits
82f5dcff
Commit
82f5dcff
authored
Jan 23, 2017
by
charlie-ablett
Browse files
Add module to step classes
parent
e9d29a26
Changes
10
Hide whitespace changes
Inline
Side-by-side
lib/coko_conversion/ink_step/xsweet_pipeline/docx_extract/collapse_paragraphs.rb
deleted
100644 → 0
View file @
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
lib/coko_conversion/ink_step/xsweet_pipeline/docx_extract/collapse_paragraphs_step.rb
0 → 100644
View file @
82f5dcff
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
lib/coko_conversion/ink_step/xsweet_pipeline/docx_extract/docx_to_html_extract_step.rb
View file @
82f5dcff
...
...
@@ -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
lib/coko_conversion/ink_step/xsweet_pipeline/docx_extract/handle_notes_step.rb
View file @
82f5dcff
...
...
@@ -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
...
...
lib/coko_conversion/ink_step/xsweet_pipeline/docx_extract/join_elements_step.rb
View file @
82f5dcff
...
...
@@ -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
...
...
lib/coko_conversion/ink_step/xsweet_pipeline/docx_extract/scrub_step.rb
View file @
82f5dcff
...
...
@@ -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
...
...
lib/coko_conversion/version.rb
View file @
82f5dcff
module
CokoConversion
VERSION
=
'0.1.
8
'
VERSION
=
'0.1.
9
'
end
\ No newline at end of file
spec/fixtures/files/xsweet_pipeline/xsweet_5_
zorba_map
_input.html
→
spec/fixtures/files/xsweet_pipeline/xsweet_5_
collapse_paragraphs
_input.html
View file @
82f5dcff
File moved
spec/fixtures/files/xsweet_pipeline/xsweet_5_
zorba_map
_result.html
→
spec/fixtures/files/xsweet_pipeline/xsweet_5_
collapse_paragraphs
_result.html
View file @
82f5dcff
File moved
spec/ink_step/xsweet_pipeline/xsweet_pipeline_spec.rb
View file @
82f5dcff
...
...
@@ -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
::
CollapseParagraphs
Step
.
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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment