Skip to content

Conversation

jarrodmillman
Copy link
Member

@jarrodmillman jarrodmillman commented Mar 15, 2024

@steppi @rgommers FYI, this updates the grid and figure shortcodes.

Copy link

netlify bot commented Mar 15, 2024

Deploy Preview for numpy-org ready!

Name Link
🔨 Latest commit 8226ea8
🔍 Latest deploy log https://app.netlify.com/sites/numpy-org/deploys/65fab37cb4717600083236d0
😎 Deploy Preview https://deploy-preview-735--numpy-org.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@jarrodmillman jarrodmillman marked this pull request as draft March 15, 2024 15:45
@jarrodmillman
Copy link
Member Author

jarrodmillman commented Mar 16, 2024

I used this script to convert between the format for Hugo's figure shortcode and the theme's figure shortcode:

import shlex
import sys


def replace_figure_shortcode(figure):
    figure = figure.replace('*', '')
    figure = figure.replace('align="middle"', 'align="center"')
    figure = figure.replace('caption=', 'title=')
    figure = figure.replace('attr=', 'attribution=')
    figure = figure.replace('attrlink=', 'attributionlink=')
    contents = figure[11:-4]
    parameters = shlex.split(contents)
    parameters = [s for s in parameters if not s.startswith("class=")]
    toml = [s.replace("=", " = '") + "'" for s in parameters]
    return "\n".join(["{{< figure >}}"] + toml + ["{{< /figure >}}\n"])


filename = sys.argv[1]
start = "{{< figure src="
end = ">}}\n"


with open(filename, "r") as f:
    lines = f.readlines()

with open(filename, "w") as f:
    for line in lines:
        if line.startswith(start) and line.endswith(end):
            line = replace_figure_shortcode(line)
        f.write(line)

@jarrodmillman jarrodmillman changed the title Update theme (v0.14) WIP: Update theme (v0.14) Mar 16, 2024
@jarrodmillman jarrodmillman changed the title WIP: Update theme (v0.14) Update theme (v0.15 and v0.14) Mar 20, 2024
@jarrodmillman jarrodmillman marked this pull request as ready for review March 20, 2024 10:11
@jarrodmillman jarrodmillman merged commit 377ff10 into numpy:main Mar 20, 2024
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

Successfully merging this pull request may close these issues.

1 participant