Skip to content

Commit 5b82071

Browse files
committed
more image changes
1 parent e1ab4f5 commit 5b82071

File tree

5 files changed

+59
-23
lines changed

5 files changed

+59
-23
lines changed

changelog/image_changes.log

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,9 @@
11
src/content/docs/aws/integrations/index.md:16: {{< figure src="integrations-overview.png" width="70%" alt="Sample of supported tools" >}} -> ![Sample of supported tools](/images/aws/integrations-overview.png)
2+
src/content/docs/aws/integrations/continuous-integration/index.mdx:21: {{< figure src="localstack-in-ci.svg" alt="An example CI/CD workflow using LocalStack" width="90%">}} -> ![An example CI/CD workflow using LocalStack](/images/aws/localstack-in-ci.svg)
3+
src/content/docs/aws/integrations/infrastructure-as-code/former2.mdx:104: {/* <img src="former2-credentials.png" alt="Enter test credentials on Former2 Dashboard" title="Enter test credentials on Former2 Dashboard" width="900" /> */} {/* mdx-disabled */} -> ![Enter test credentials on Former2 Dashboard](/images/aws/former2-credentials.png)
4+
src/content/docs/aws/integrations/infrastructure-as-code/former2.mdx:112: {/* <img src="former2-localstack-endpoint.png" alt="LocalStack endpoint toggle on Former2 Dashboard" title="LocalStack endpoint toggle on Former2 Dashboard" width="900" /> */} {/* mdx-disabled */} -> ![LocalStack endpoint toggle on Former2 Dashboard](/images/aws/former2-localstack-endpoint.png)
5+
src/content/docs/aws/integrations/infrastructure-as-code/former2.mdx:122: {/* <img src="former2-s3.png" alt="S3 Console on Former2 Dashboard" title="S3 Console on Former2 Dashboard" width="900" /> */} {/* mdx-disabled */} -> ![S3 Console on Former2 Dashboard](/images/aws/former2-s3.png)
6+
src/content/docs/aws/integrations/infrastructure-as-code/former2.mdx:128: {/* <img src="former2-cloudformation-output.png" alt="CloudFormation Output on Former2 Dashboard" title="CloudFormation Output on Former2 Dashboard" width="900" /> */} {/* mdx-disabled */} -> ![CloudFormation Output on Former2 Dashboard](/images/aws/former2-cloudformation-output.png)
7+
src/content/docs/aws/integrations/containers/openshift.mdx:44: {/* <img src="openshift-developer-view.png" alt="OpenShift Developer perspective" title="OpenShift Developer perspective" width="900" /> */} {/* mdx-disabled */} -> ![OpenShift Developer perspective](/images/aws/openshift-developer-view.png)
8+
src/content/docs/aws/integrations/containers/openshift.mdx:61: {/* <img src="openshift-topology-view.png" alt="OpenShift Topology view" title="OpenShift Topology view" width="900" /> */} {/* mdx-disabled */} -> ![OpenShift Topology view](/images/aws/openshift-topology-view.png)
9+
src/content/docs/aws/integrations/containers/openshift.mdx:73: {/* <img src="localstack-dev-spaces.png" alt="LocalStack Dev Spaces Deployment" title="LocalStack Dev Spaces Deployment" width="900" /> */} {/* mdx-disabled */} -> ![LocalStack Dev Spaces Deployment](/images/aws/localstack-dev-spaces.png)

replace_images.py

Lines changed: 43 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -9,30 +9,59 @@
99
def ensure_log_directory():
1010
os.makedirs(LOG_DIR, exist_ok=True)
1111

12+
def extract_attributes(tag: str):
13+
"""Extracts src and alt attributes from a tag string."""
14+
src_match = re.search(r'src\s*=\s*["\']([^"\']+)["\']', tag)
15+
alt_match = re.search(r'alt\s*=\s*["\']([^"\']+)["\']', tag)
16+
if src_match and alt_match:
17+
return src_match.group(1), alt_match.group(1)
18+
return None, None
19+
1220
def process_file(filepath, log_entries):
1321
with open(filepath, 'r', encoding='utf-8') as file:
1422
lines = file.readlines()
1523

16-
pattern = re.compile(
17-
r'\{\{<\s*figure\s+src="([^"]+)"\s+width="[^"]*"\s+alt="([^"]+)"\s*>\}\}'
18-
)
19-
2024
changed = False
2125

2226
for line_number, line in enumerate(lines, start=1):
23-
matches = list(pattern.finditer(line))
24-
if not matches:
25-
continue
26-
2727
new_line = line
28-
for match in matches:
28+
29+
# Match MDX-wrapped <img ...> tags
30+
mdx_pattern = re.finditer(
31+
r"""\{\s*/\*\s*<img\s+([^>]+?)\s*/?>\s*\*/\}\s*\{\s*/\*\s*mdx-disabled\s*\*/\s*\}""", new_line)
32+
for match in mdx_pattern:
33+
old = match.group(0)
34+
attrs = match.group(1)
35+
src, alt = extract_attributes(attrs)
36+
if src and alt:
37+
new = f'![{alt}](/images/aws/{src})'
38+
new_line = new_line.replace(old, new)
39+
log_entries.append(f"{filepath}:{line_number}: {old} -> {new}")
40+
changed = True
41+
42+
# Match raw <img ...> tags
43+
img_pattern = re.finditer(
44+
r"""<img\s+([^>]*?)\s*/?>""", new_line)
45+
for match in img_pattern:
46+
old = match.group(0)
47+
attrs = match.group(1)
48+
src, alt = extract_attributes(attrs)
49+
if src and alt:
50+
new = f'![{alt}](/images/aws/{src})'
51+
new_line = new_line.replace(old, new)
52+
log_entries.append(f"{filepath}:{line_number}: {old} -> {new}")
53+
changed = True
54+
55+
# Match Hugo-style figure tags
56+
hugo_pattern = re.finditer(
57+
r"""\{\{<\s*figure\s+[^>]*src="([^"]+)"[^>]*alt="([^"]+)"[^>]*>\}\}""", new_line)
58+
for match in hugo_pattern:
59+
old = match.group(0)
2960
src = match.group(1)
3061
alt = match.group(2)
31-
old_text = match.group(0)
32-
new_text = f'![{alt}](/images/aws/{src})'
33-
new_line = new_line.replace(old_text, new_text, 1)
34-
log_entry = f"{filepath}:{line_number}: {old_text} -> {new_text}"
35-
log_entries.append(log_entry)
62+
new = f'![{alt}](/images/aws/{src})'
63+
new_line = new_line.replace(old, new)
64+
log_entries.append(f"{filepath}:{line_number}: {old} -> {new}")
3665
changed = True
3766

3867
lines[line_number - 1] = new_line
@@ -51,7 +80,6 @@ def crawl_directory(directory):
5180
filepath = os.path.join(root, filename)
5281
process_file(filepath, log_entries)
5382

54-
# Write log file
5583
with open(LOG_PATH, 'w', encoding='utf-8') as log_file:
5684
for entry in log_entries:
5785
log_file.write(entry + '\n')

src/content/docs/aws/integrations/containers/openshift.mdx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ Instead of running LocalStack locally, you will deploy it on OpenShift and use t
4141
You can deploy LocalStack via the **Developer** perspective in the OpenShift Web Console.
4242
Navigate to the **+Add** view to deploy LocalStack using a Devfile.
4343

44-
{/* <img src="openshift-developer-view.png" alt="OpenShift Developer perspective" title="OpenShift Developer perspective" width="900" /> */} {/* mdx-disabled */}
44+
![OpenShift Developer perspective](/images/aws/openshift-developer-view.png)
4545
<br></br>
4646

4747
To deploy LocalStack on OpenShift, click on **Import from Git** in the **Git Repository** tile.
@@ -58,7 +58,7 @@ Click on **Create** to deploy LocalStack on OpenShift.
5858

5959
You can see the build status of the LocalStack deployment in the **Topology** view.
6060

61-
{/* <img src="openshift-topology-view.png" alt="OpenShift Topology view" title="OpenShift Topology view" width="900" /> */} {/* mdx-disabled */}
61+
![OpenShift Topology view](/images/aws/openshift-topology-view.png)
6262
<br></br>
6363

6464
After successful deployment, you can see the **localstack-dev-spaces** pod in the **Topology** view.
@@ -70,7 +70,7 @@ You will be able to see the following details:
7070
- Exposed services along with the service port and the pod port.
7171
- Exposed routes for your deployed pods on the cluster.
7272

73-
{/* <img src="localstack-dev-spaces.png" alt="LocalStack Dev Spaces Deployment" title="LocalStack Dev Spaces Deployment" width="900" /> */} {/* mdx-disabled */}
73+
![LocalStack Dev Spaces Deployment](/images/aws/localstack-dev-spaces.png)
7474
<br></br>
7575

7676
### Creating AWS resources on OpenShift

src/content/docs/aws/integrations/continuous-integration/index.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ This enables you to incorporate LocalStack's local AWS cloud emulation in your C
1818
Let's assume that your team has an automated CI workflow into which you want to integrate end-to-end cloud testing with LocalStack.
1919
As an example, consider the following pipeline, which represents part of a simple CI workflow:
2020

21-
{/* {{< figure src="localstack-in-ci.svg" alt="An example CI/CD workflow using LocalStack" width="90%">}} */} {/* mdx-disabled */}
21+
{/* ![An example CI/CD workflow using LocalStack](/images/aws/localstack-in-ci.svg) */} {/* mdx-disabled */}
2222

2323
The CI build is triggered by pushing code to a version control repository, like GitHub.
2424
The CI runner starts LocalStack and executes the test suite.

src/content/docs/aws/integrations/infrastructure-as-code/former2.mdx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -101,15 +101,15 @@ Navigate to the Former2 setup dashboard.
101101
Open the [**Credentials**](https://former2.com/#section-setup-credentials) tab and enter your IAM credentials.
102102
For LocalStack, you can just configure the `AWS_ACCESS_KEY_ID` and `AWS_SECRET_ACCESS_KEY` environment variables as `test` and `test`, respectively.
103103

104-
{/* <img src="former2-credentials.png" alt="Enter test credentials on Former2 Dashboard" title="Enter test credentials on Former2 Dashboard" width="900" /> */} {/* mdx-disabled */}
104+
![Enter test credentials on Former2 Dashboard](/images/aws/former2-credentials.png)
105105
<br></br>
106106

107107
Click on [**Continue to Parameters**](https://former2.com/#section-setup-parameters) and include your own CloudFormation stack parameters by adding them below.
108108
Click on [**Continue to Settings**](https://former2.com/#section-setup-settings) and navigate to **Custom Endpoints**.
109109
Toggle the **Use LocalStack Endpoint** switch to enable the LocalStack endpoint URL (`http://localhost:4566`).
110110
Click on [**Go to Dashboard**](https://former2.com/#section-dashboard) to complete the setup.
111111

112-
{/* <img src="former2-localstack-endpoint.png" alt="LocalStack endpoint toggle on Former2 Dashboard" title="LocalStack endpoint toggle on Former2 Dashboard" width="900" /> */} {/* mdx-disabled */}
112+
![LocalStack endpoint toggle on Former2 Dashboard](/images/aws/former2-localstack-endpoint.png)
113113
<br></br>
114114

115115
You can now click on **Scan Account** button on the top-right corner of the dashboard to scan your LocalStack instance for resources.
@@ -119,13 +119,13 @@ Once the scan is complete, you can select the resources you want to generate IaC
119119

120120
Navigate to [S3](https://former2.com/#section-storage-s3), [DynamoDB](https://former2.com/#section-database-dynamodb), and [SQS](https://former2.com/#section-applicationintegration-sqs) to verify that the resources you created earlier are listed.
121121

122-
{/* <img src="former2-s3.png" alt="S3 Console on Former2 Dashboard" title="S3 Console on Former2 Dashboard" width="900" /> */} {/* mdx-disabled */}
122+
![S3 Console on Former2 Dashboard](/images/aws/former2-s3.png)
123123
<br></br>
124124

125125
You can select the resources you want to generate IaC outputs for and click on **Add Selected**.
126126
Finally, you can click on **Generate** on the top-left corner of the dashboard to generate the IaC outputs.
127127

128-
{/* <img src="former2-cloudformation-output.png" alt="CloudFormation Output on Former2 Dashboard" title="CloudFormation Output on Former2 Dashboard" width="900" /> */} {/* mdx-disabled */}
128+
![CloudFormation Output on Former2 Dashboard](/images/aws/former2-cloudformation-output.png)
129129
<br></br>
130130

131131
You can also choose to generate the IaC outputs in a different format by clicking on the various options available on the left-hand side of the dashboard.

0 commit comments

Comments
 (0)