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