mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-29 08:44:59 +00:00
feat: include script tags in testimonials JS output
This commit is contained in:
parent
6d30094a93
commit
761a297903
2 changed files with 5 additions and 6 deletions
|
@ -237,7 +237,6 @@ aider --model o3-mini --api-key openai=<key></code></pre>
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<script>
|
|
||||||
<!--[[[cog
|
<!--[[[cog
|
||||||
from scripts.badges import get_testimonials_js
|
from scripts.badges import get_testimonials_js
|
||||||
text = get_testimonials_js()
|
text = get_testimonials_js()
|
||||||
|
|
|
@ -449,11 +449,11 @@ def get_testimonials_js():
|
||||||
{"text": quote_match, "author": author_match, "link": link_match}
|
{"text": quote_match, "author": author_match, "link": link_match}
|
||||||
)
|
)
|
||||||
|
|
||||||
# Format as JavaScript array
|
# Format as JavaScript array with script tags
|
||||||
if not testimonials:
|
if not testimonials:
|
||||||
return "const testimonials = [];"
|
return "<script>\nconst testimonials = [];\n</script>"
|
||||||
|
|
||||||
js_array = "const testimonials = [\n"
|
js_array = "<script>\nconst testimonials = [\n"
|
||||||
for i, t in enumerate(testimonials):
|
for i, t in enumerate(testimonials):
|
||||||
js_array += " {\n"
|
js_array += " {\n"
|
||||||
js_array += f" text: \"{t['text']}\",\n"
|
js_array += f" text: \"{t['text']}\",\n"
|
||||||
|
@ -463,14 +463,14 @@ def get_testimonials_js():
|
||||||
if i < len(testimonials) - 1:
|
if i < len(testimonials) - 1:
|
||||||
js_array += ","
|
js_array += ","
|
||||||
js_array += "\n"
|
js_array += "\n"
|
||||||
js_array += "];"
|
js_array += "];\n</script>"
|
||||||
|
|
||||||
return js_array
|
return js_array
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(f"Error reading testimonials from README: {e}", file=sys.stderr)
|
print(f"Error reading testimonials from README: {e}", file=sys.stderr)
|
||||||
# Return empty array as fallback
|
# Return empty array as fallback
|
||||||
return "const testimonials = [];"
|
return "<script>\nconst testimonials = [];\n</script>"
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue