Skip to content

Problems with preprocessing on Python #17

@MilitaoLucas

Description

@MilitaoLucas

Hi, I was trying to load the results of preprocessing a normal htm file using

olex_gui.PreprocessHtml(html)

html is my variable that stores a string. It seemed to work pretty well, but when loading the preprocessed file to the GUI, it becomes totally broken.

After investigating, I noticed that it includes help buttons, but it doesn't delete #include comments.

<td valign='top' width="16" align='center' bgcolor="#dedede">
<font size='3'>
<input
  name="IMG_BTN-INFO@#IMAGE#SCOPE"
  type="button"
  image="up=btn-infooff.png,down=btn-infooff.png,hover=btn-infohover.png"
  hint="info@#image#scope-target"
  onclick="spy.make_help_box -name='#image' -popout='False' -helpTxt='#helpTxt'"
  bgcolor="None"
>
</font>

</td>

<!-- #include tool-help-column gui\blocks\tool-help-first-column.htm;help_ext=#image;1; -->

If I am not mistaken, both of those are redundant:
Steps to reproduce:

  1. Run @py -i on Olex2
  2. Paste:
import olex_gui
import os
with open(f"{os.getenv('OLEX2_DIR')}/util/pyUtil/NoSpherA2/h3-refine_NoSpherA2-extras.htm", "r") as f:
    html = f.read()
out = olex_gui.PreprocessHtml(html)
with open(f"{os.getenv('OLEX2_DIR')}/test_preproc.htm", "w") as f:
    f.write(out)
  1. The output file seems to have this problem when loaded in place of the input. I was able to fix it by manually removing the #include comments, but I guess this is a bug, right?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions