Commit 3986067a authored by pierre.tremouilhac's avatar pierre.tremouilhac
Browse files

Merge branch '242-report-formatting-1' into 'development'

fix report format -1

Closes #242

See merge request !438
parents 08ab1f32 275c6c2c
......@@ -190,10 +190,7 @@ const rmTailSpace = (content) => {
};
const opsTailWithSymbol = (els, symbol) => {
return [...els.slice(0, -1),
{ insert: els.slice(-1)[0].insert },
{ insert: symbol }
];
return [...els, { insert: symbol }];
};
const endingSymbol = (content, symbol) => {
......
......@@ -34,14 +34,12 @@ module Reporter
ops = rm_head_tail_space(ops)
return sum if ops.blank?
ops = ops_tail_with_symbol(ops, symbol)
sum + ops
sum + ops_tail_with_symbol(ops, symbol)
end
end
def ops_tail_with_symbol(ops, symbol)
ops[0..-2] +
[{ 'insert' => ops.last['insert'] }, { 'insert' => symbol }]
ops + [{ 'insert' => symbol }]
end
def rm_head_tail_space(ops = [])
......
......@@ -377,9 +377,8 @@ module Reporter
delta = merge_items_symbols(delta, sorted_analyses, '; ')
end
return [] if delta.length.zero?
result = remove_redundant_space_break(delta)[0..-2] +
remove_redundant_space_break(delta)[0..-2] +
[{ 'insert' => '.' }, { 'insert' => "\n" }]
sanitize_attributes(result)
end
def materials_table_delta
......@@ -463,13 +462,6 @@ module Reporter
counter = counter >= 1 && counter <=26 ? counter - 1 : 25
alphabets[counter]
end
def sanitize_attributes(content)
content.map do |c|
c['attributes'].delete('color') if c['attributes']
c
end
end
end
end
end
......@@ -202,7 +202,7 @@ describe 'Reporter::Docx::DetailReaction instance' do
{"attributes"=>{"italic"=>true}, "insert"=>"R"},
{"attributes"=>{"italic"=>true, "script"=>"sub"}, "insert"=>"f"},
{"insert"=>" = #{rf} (#{t_sol})."}, {"insert"=>"\n"},
{"attributes"=>{"script"=>"super"}, "insert"=>"-1"},
{"attributes"=>{"color"=>"black", "script"=>"super"}, "insert"=>"-1"},
{"insert"=>correct_content},
{"insert"=>"."},
{"insert"=>"\n"},
......
Supports Markdown
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