Skip to content

Commit

Permalink
Revert "Squashed commit of the following:"
Browse files Browse the repository at this point in the history
This reverts commit b0ca7b0.
  • Loading branch information
dkratzert committed Mar 1, 2024
1 parent b0ca7b0 commit 2285005
Show file tree
Hide file tree
Showing 8 changed files with 347 additions and 991 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -217,4 +217,3 @@ olex2
x64
test-data/1000007-multi-multitable.docx
test-data/report_1000007-multi-finalcif.docx
test.html
14 changes: 4 additions & 10 deletions finalcif/appwindow.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@
from finalcif.gui.plaintextedit import MyQPlainTextEdit
from finalcif.gui.text_value_editor import MyTextTemplateEdit, TextEditItem
from finalcif.gui.vrf_classes import MyVRFContainer, VREF
from finalcif.report.templated_report import TextFormat
from finalcif.template.templates import ReportTemplates
from finalcif.tools.download import MyDownloader
from finalcif.tools.dsrmath import my_isnumeric
Expand Down Expand Up @@ -1126,15 +1125,10 @@ def make_report_tables(self) -> None:
make_multi_tables(cif=self.cif, output_filename=str(multi_table_document))
else:
print('Report with templates')
t = TemplatedReport(format=TextFormat.RICHTEXT, options=self.options, cif=self.cif)
ok = t.make_templated_docx_report(options=self.options,
output_filename=str(report_filename),
picfile=picfile,
template_path=Path(self.get_checked_templates_list_text()))
t = TemplatedReport(format=TextFormat.HTML, options=self.options, cif=self.cif)
t.make_templated_html_report(
options=self.options,
picfile=picfile)
t = TemplatedReport()
ok = t.make_templated_report(options=self.options, cif=self.cif,
output_filename=str(report_filename), picfile=picfile,
template_path=Path(self.get_checked_templates_list_text()))
if not ok:
return None
except FileNotFoundError as e:
Expand Down
26 changes: 0 additions & 26 deletions finalcif/report/references.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,32 +191,6 @@ def richtext(self) -> RichText:
return r

@property
def html(self) -> str:
txt = ''
if self.authors:
txt += f'{self.authors}, '
if self.journal:
txt += f'<i>{self.journal}</i>'
if not self.journal.endswith('.'):
txt += ', '
else:
txt += ' '
if self.year:
txt += f'<b>{self.year}</b>'
txt += ', '
if self.volume:
txt += f'<i>{self.volume}</i>'
txt += ', '
if self.pages:
txt += f'{self.pages}'
if self.doi:
txt += ', '
if self.doi:
txt += f'{self.doi}'
if any([self.journal, self.pages, self.year, self.volume, self.doi]):
txt += '.'
return txt
@property
def short_ref(self) -> RichText:
"""
Adds a reference with (name year) instead of a number.
Expand Down
14 changes: 1 addition & 13 deletions finalcif/report/report_text.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
SHELXLReference, SHELXTReference, SHELXSReference, FinalCifReference, ShelXleReference, Olex2Reference, \
SHELXDReference, SadabsTwinabsReference, CrysalisProReference, Nosphera2Reference, XDSReference, DSRReference2015, \
DSRReference2018, XRedReference
from finalcif.tools.misc import protected_space, angstrom, zero_width_space, remove_line_endings, flatten, minus_sign
from finalcif.tools.misc import protected_space, angstrom, zero_width_space, remove_line_endings, flatten


def math_to_word(eq: str) -> BaseOxmlElement:
Expand Down Expand Up @@ -524,18 +524,6 @@ def get_inf_article(next_word: str) -> str:
return 'an' if next_word[0].lower() in voc else 'a'


def align_by_dot(number: str) -> str:
"""
The intention of this filter is to align the number
on the dot, but this doesn't work as expected.
https://codepen.io/dominiccomtois/pen/YZdred
"""
if '.' in number:
num, dec = number.split('.')
return (f'<span class="number">{num}'
f'<span class="decimal">.{dec}</span></span>')


def format_radiation(radiation_type: str) -> list:
radtype = list(radiation_type.partition("K"))
if len(radtype) > 2:
Expand Down
Loading

0 comments on commit 2285005

Please sign in to comment.