Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

html front page may use wrong links when component names are too similar #39

Open
jypeter opened this issue Jan 8, 2020 · 0 comments
Open

Comments

@jypeter
Copy link

jypeter commented Jan 8, 2020

I'm using the following 2 components that start with the same string (on purpose)

                 'Atmosphere_Surface',
                 'Atmosphere_Surface_shift',

which produces the following template front page

<li><a href="target_Atmosphere_Surface" target="_blank">Atmosphere Surface</a></li>
<li><a href="target_Atmosphere_Surface_shift" target="_blank">Atmosphere Surface (Shifted)</a></li>

Unfortunately when the templates are resolved and target_Atmosphere_Surface is replaced by the actual link, it is replaced in both lines above and the second link becomes garbage!!

<li><a href="https://vesg.ipsl.upmc.fr/thredds/fileServer/IPSLFS/jypmce/C-ESM-EP/PMIP4_6kf3_ref_jypmce/Atmosphere_Surface/atlas_Atmosphere_Surface_PMIP4_6kf3_ref.html" target="_blank">Atmosphere Surface</a></li>
<li><a href="https://vesg.ipsl.upmc.fr/thredds/fileServer/IPSLFS/jypmce/C-ESM-EP/PMIP4_6kf3_ref_jypmce/Atmosphere_Surface/atlas_Atmosphere_Surface_PMIP4_6kf3_ref.html_shift" target="_blank">Atmosphere Surface (Shifted)</a></li>

This can be easily fixed in run_C-ESM-EP.py by adding some delimiters in the template strings

Replace
newline = '<li><a href="target_' + cesmep_module[0] + '" target="_blank">' + cesmep_module[1] + '</a></li>'
with
newline = '<li><a href="%%target_' + cesmep_module[0] + '%%" target="_blank">' + cesmep_module[1] + '</a></li>'
This will produce the following template

<li><a href="%%target_Atmosphere_Surface%%" target="_blank">Atmosphere Surface</a></li>
<li><a href="%%target_Atmosphere_Surface_shift%%" target="_blank">Atmosphere Surface (Shifted)</a></li>

And the also replace
pysed(frontpage_html, 'target_' + component, url)
with
pysed(frontpage_html, '%%target_' + component + '%%', url)

WARNING! DO NOT use as delimiters characters that have a special meaning for sed. I started with '[' and ']' instead of '%%' and ran out of quota

Other strings are replaced in the template html file and could possibly use the same delimiter trick (to be safe)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant