Commit ba142d76 authored by pierre.tremouilhac's avatar pierre.tremouilhac
Browse files

Merge branch '267-report-format-molecule-label-should-bold' into 'development'

Report format - text bold for molecule label

Closes #267

See merge request ComPlat/chemotion_ELN!466
parents e35c743c f9cff1e1
...@@ -35,7 +35,7 @@ const userSerial = (molecule, molSerials = []) => { ...@@ -35,7 +35,7 @@ const userSerial = (molecule, molSerials = []) => {
const deltaUserSerial = (molecule, molSerials) => { const deltaUserSerial = (molecule, molSerials) => {
const insert = userSerial(molecule, molSerials); const insert = userSerial(molecule, molSerials);
return { insert }; return { insert, attributes: { bold: 'true' } };
}; };
const Title = ({ el, counter, molSerials }) => { const Title = ({ el, counter, molSerials }) => {
...@@ -46,7 +46,7 @@ const Title = ({ el, counter, molSerials }) => { ...@@ -46,7 +46,7 @@ const Title = ({ el, counter, molSerials }) => {
const comma = <span key={`${i}-comma`}>, </span>; const comma = <span key={`${i}-comma`}>, </span>;
const smn = sampleMoleculeName(p); const smn = sampleMoleculeName(p);
title = smn title = smn
? [...title, <span key={key}>{smn} ({us})</span>, comma] ? [...title, <span key={key}>{smn} (<b>{us}</b>)</span>, comma]
: [...title, <span key={key}>"<b>NAME</b>"</span>, comma]; : [...title, <span key={key}>"<b>NAME</b>"</span>, comma];
}); });
title = _.flatten(title).slice(0, -1); title = _.flatten(title).slice(0, -1);
......
...@@ -83,9 +83,11 @@ module Reporter ...@@ -83,9 +83,11 @@ module Reporter
def remove_redundant_space_break(ops) # ensure one line def remove_redundant_space_break(ops) # ensure one line
ops.map.with_index do |op, i| ops.map.with_index do |op, i|
op["insert"] = op["insert"].gsub(/[\u00A0\s]{2,}/, " ") if op["insert"]
op["insert"] = op["insert"].lstrip if i == 0 op["insert"] = op["insert"].gsub(/[\u00A0\s]{2,}/, " ")
op["insert"] = op["insert"].gsub(/\n/, " ") op["insert"] = op["insert"].lstrip if i == 0
op["insert"] = op["insert"].gsub(/\n/, " ")
end
op op
end end
end end
......
...@@ -481,7 +481,7 @@ module Reporter ...@@ -481,7 +481,7 @@ module Reporter
def mol_serial_delta(mol_id) def mol_serial_delta(mol_id)
serial = mol_serial(mol_id) serial = mol_serial(mol_id)
[{ 'insert' => serial }] [{ 'insert' => serial, 'attributes' => { 'bold' => 'true' } }]
end end
end end
end end
......
...@@ -149,12 +149,12 @@ describe 'Reporter::Docx::DetailReaction instance' do ...@@ -149,12 +149,12 @@ describe 'Reporter::Docx::DetailReaction instance' do
{"insert"=>"[4.#{prev_index + 1}] "}, {"insert"=>"[4.#{prev_index + 1}] "},
{"insert"=>"#{s2.molecule_name_hash[:label]}"}, {"insert"=>"#{s2.molecule_name_hash[:label]}"},
{"insert"=>" ("}, {"insert"=>" ("},
{"insert"=>serial}, {"insert"=>serial, "attributes"=>{"bold"=>"true"}},
{"insert"=>")"}, {"insert"=>")"},
{"insert"=>", "}, {"insert"=>", "},
{"insert"=>"#{s3.molecule_name_hash[:label]}"}, {"insert"=>"#{s3.molecule_name_hash[:label]}"},
{"insert"=>" ("}, {"insert"=>" ("},
{"insert"=>serial}, {"insert"=>serial, "attributes"=>{"bold"=>"true"}},
{"insert"=>")"}, {"insert"=>")"},
] ]
) )
...@@ -199,7 +199,7 @@ describe 'Reporter::Docx::DetailReaction instance' do ...@@ -199,7 +199,7 @@ describe 'Reporter::Docx::DetailReaction instance' do
[ [
{"insert"=>"#{tit}: "}, {"insert"=>"#{tit}: "},
{"insert"=>"{A|"}, {"insert"=>"{A|"},
{"insert"=>serial}, {"insert"=>serial, "attributes"=>{"bold"=>"true"}},
{"insert"=>"} "}, {"insert"=>"} "},
{"insert"=>"#{s2.molecule_name_hash[:label]}"}, {"insert"=>"#{s2.molecule_name_hash[:label]}"},
{"insert"=>" (1.000 g, 55.508 mmol, 0.88 equiv.); "}, {"insert"=>" (1.000 g, 55.508 mmol, 0.88 equiv.); "},
...@@ -209,11 +209,11 @@ describe 'Reporter::Docx::DetailReaction instance' do ...@@ -209,11 +209,11 @@ describe 'Reporter::Docx::DetailReaction instance' do
{"insert"=>" (0.00 mL); "}, {"insert"=>" (0.00 mL); "},
{"insert"=>"Yield "}, {"insert"=>"Yield "},
{"insert"=>"{C|"}, {"insert"=>"{C|"},
{"insert"=>serial}, {"insert"=>serial, "attributes"=>{"bold"=>"true"}},
{"insert"=>"} = #{(equiv * 100).to_i}% (0.000 g, 0.000 mmol)"}, {"insert"=>"} = #{(equiv * 100).to_i}% (0.000 g, 0.000 mmol)"},
{"insert"=>"; "}, {"insert"=>"; "},
{"insert"=>"{D|"}, {"insert"=>"{D|"},
{"insert"=>serial}, {"insert"=>serial, "attributes"=>{"bold"=>"true"}},
{"insert"=>"} = #{(equiv * 100).to_i}% (0.000 g, 0.000 mmol)"}, {"insert"=>"} = #{(equiv * 100).to_i}% (0.000 g, 0.000 mmol)"},
{"insert"=>"."}, {"insert"=>"."},
{"insert"=>"\n"}, {"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