changed yaml output

This commit is contained in:
Tobias Brunner 2025-05-30 16:07:38 +02:00
parent bfb64efdec
commit 4f9a39fd36
No known key found for this signature in database
3 changed files with 13 additions and 20 deletions

View file

@ -1,5 +1,5 @@
import re
import pyaml
import yaml
from django.shortcuts import render, get_object_or_404
from django.db.models import Q
@ -113,18 +113,18 @@ def generate_exoscale_marketplace_yaml(offering):
if offering.service.description:
product_overview = markdownify(
offering.service.description, heading_style="ATX"
)
).strip()
# Generate highlights content from offering description and offer_description (convert HTML to Markdown)
highlights = ""
if offering.description:
highlights += markdownify(offering.description, heading_style="ATX")
highlights += markdownify(offering.description, heading_style="ATX").strip()
if offering.offer_description:
if highlights:
highlights += "\n\n"
highlights += markdownify(
offering.offer_description.get_full_text(), heading_style="ATX"
)
).strip()
# Build YAML structure
yaml_structure = {
@ -179,7 +179,15 @@ def generate_exoscale_marketplace_yaml(offering):
}
# Generate YAML response for browser display
yaml_content = pyaml.dump(yaml_structure, sort_dicts=False)
yaml_content = yaml.dump(
yaml_structure,
default_flow_style=False,
allow_unicode=True,
indent=2,
width=120,
sort_keys=False,
default_style=None,
)
# Return as plain text for browser display
response = HttpResponse(yaml_content, content_type="text/plain")