Spaces:
Running
Running
Claude commited on
記事詳細のコメント件数表示・AI装飾後のHTMLモード強制・X埋め込み装飾禁止
Browse files- blog_detail.html: 記事ヘッダー(著者・日付の横)にコメント件数(💬 N件)を追加
- admin_editor.html: 単一ブロックAI装飾後に setEditorMode('html') を呼び出しHTMLモードへ強制切り替え
- admin_editor.html: 全体装飾(ai-decorate-all)成功後、各テキストブロックの editorMode を 'html' に設定
- main.py: /api/ai-decorate および /api/ai-decorate-all のGeminiプロンプトに blockquote.twitter-tweet への装飾・スタイル追加を全面禁止するルールを追加
https://claude.ai/code/session_018sq37X4VGvDxwtnyyvQmFv
- main.py +6 -4
- templates/admin_editor.html +2 -1
- templates/blog_detail.html +1 -1
main.py
CHANGED
|
@@ -555,8 +555,9 @@ async def api_ai_decorate(request: Request):
|
|
| 555 |
f"・テキストの文字色は black/white などの固定色を使わず color: inherit を使う\n"
|
| 556 |
f"・グレー系の背景は rgba(128,128,128,0.1) などの半透過色を使う\n"
|
| 557 |
f"・ダークモード切替は @media (prefers-color-scheme: dark) 内で .article-body の変数を上書きする\n\n"
|
| 558 |
-
f"【Twitter埋め込み】\n"
|
| 559 |
-
f"・<blockquote class=\"twitter-tweet\"> の
|
|
|
|
| 560 |
f"・widget.jsの読み込みは不要(ページ側で処理する)\n\n"
|
| 561 |
f"【出力形式】\n"
|
| 562 |
f"・HTMLコードのみを返すこと(説明文・コードブロック記号は不要)\n"
|
|
@@ -606,8 +607,9 @@ async def api_ai_decorate_all(request: Request):
|
|
| 606 |
f"・テキストの文字色は black/white などの固定色を使わず color: inherit を使う\n"
|
| 607 |
f"・グレー系の背景は rgba(128,128,128,0.1) などの半透過色を使う\n"
|
| 608 |
f"・ダークモード切替は @media (prefers-color-scheme: dark) 内で .article-body の変数を上書きする\n\n"
|
| 609 |
-
f"【Twitter埋め込み】\n"
|
| 610 |
-
f"・<blockquote class=\"twitter-tweet\"> の
|
|
|
|
| 611 |
f"・widget.jsの読み込みは不要(ページ側で処理する)\n\n"
|
| 612 |
f"【出力形式】\n"
|
| 613 |
f"・同じJSON形式(idとhtmlのペアの配列)のみを返すこと。余分なテキストや説明は不要。\n"
|
|
|
|
| 555 |
f"・テキストの文字色は black/white などの固定色を使わず color: inherit を使う\n"
|
| 556 |
f"・グレー系の背景は rgba(128,128,128,0.1) などの半透過色を使う\n"
|
| 557 |
f"・ダークモード切替は @media (prefers-color-scheme: dark) 内で .article-body の変数を上書きする\n\n"
|
| 558 |
+
f"【Twitter埋め込み(厳守)】\n"
|
| 559 |
+
f"・<blockquote class=\"twitter-tweet\"> タグおよびその内部は一切変更・装飾・スタイル追加しないこと\n"
|
| 560 |
+
f"・blockquote 要素や twitter-tweet クラスへの CSS 指定は全て禁止\n"
|
| 561 |
f"・widget.jsの読み込みは不要(ページ側で処理する)\n\n"
|
| 562 |
f"【出力形式】\n"
|
| 563 |
f"・HTMLコードのみを返すこと(説明文・コードブロック記号は不要)\n"
|
|
|
|
| 607 |
f"・テキストの文字色は black/white などの固定色を使わず color: inherit を使う\n"
|
| 608 |
f"・グレー系の背景は rgba(128,128,128,0.1) などの半透過色を使う\n"
|
| 609 |
f"・ダークモード切替は @media (prefers-color-scheme: dark) 内で .article-body の変数を上書きする\n\n"
|
| 610 |
+
f"【Twitter埋め込み(厳守)】\n"
|
| 611 |
+
f"・<blockquote class=\"twitter-tweet\"> タグおよびその内部は一切変更・装飾・スタイル追加しないこと\n"
|
| 612 |
+
f"・blockquote 要素や twitter-tweet クラスへの CSS 指定は全て禁止\n"
|
| 613 |
f"・widget.jsの読み込みは不要(ページ側で処理する)\n\n"
|
| 614 |
f"【出力形式】\n"
|
| 615 |
f"・同じJSON形式(idとhtmlのペアの配列)のみを返すこと。余分なテキストや説明は不要。\n"
|
templates/admin_editor.html
CHANGED
|
@@ -601,7 +601,7 @@ async function runAI() {
|
|
| 601 |
body: JSON.stringify({html: currentHtml, instruction: ins})
|
| 602 |
});
|
| 603 |
const data = await res.json();
|
| 604 |
-
if (data.success) { setEditorContent(data.html);
|
| 605 |
else { alert('AIエラー: ' + data.error); }
|
| 606 |
} catch(err) { alert('通信エラー: ' + err.message); }
|
| 607 |
finally { btn.disabled = false; btn.textContent = '実行'; }
|
|
@@ -834,6 +834,7 @@ async function runGlobalAI() {
|
|
| 834 |
blocks.forEach(b => {
|
| 835 |
if (b.type === 'text' && data.decorated[b.id] !== undefined) {
|
| 836 |
b.html = data.decorated[b.id];
|
|
|
|
| 837 |
}
|
| 838 |
});
|
| 839 |
renderBlocks();
|
|
|
|
| 601 |
body: JSON.stringify({html: currentHtml, instruction: ins})
|
| 602 |
});
|
| 603 |
const data = await res.json();
|
| 604 |
+
if (data.success) { setEditorContent(data.html); setEditorMode('html'); }
|
| 605 |
else { alert('AIエラー: ' + data.error); }
|
| 606 |
} catch(err) { alert('通信エラー: ' + err.message); }
|
| 607 |
finally { btn.disabled = false; btn.textContent = '実行'; }
|
|
|
|
| 834 |
blocks.forEach(b => {
|
| 835 |
if (b.type === 'text' && data.decorated[b.id] !== undefined) {
|
| 836 |
b.html = data.decorated[b.id];
|
| 837 |
+
b.editorMode = 'html';
|
| 838 |
}
|
| 839 |
});
|
| 840 |
renderBlocks();
|
templates/blog_detail.html
CHANGED
|
@@ -34,7 +34,7 @@
|
|
| 34 |
{% endif %}
|
| 35 |
|
| 36 |
<h1 class="text-2xl font-bold text-gray-800 dark:text-gray-100 mb-2">{{ article.get("title","無題") }}</h1>
|
| 37 |
-
<p class="text-sm text-gray-400 dark:text-gray-500 mb-3">👤 {{ article.get("author","") }} | 📅 {{ article.get("publishedAt","")[:10] }}</p>
|
| 38 |
<div class="mb-4">
|
| 39 |
{% for t in tags %}<span class="tag-badge">#{{ t }}</span>{% endfor %}
|
| 40 |
</div>
|
|
|
|
| 34 |
{% endif %}
|
| 35 |
|
| 36 |
<h1 class="text-2xl font-bold text-gray-800 dark:text-gray-100 mb-2">{{ article.get("title","無題") }}</h1>
|
| 37 |
+
<p class="text-sm text-gray-400 dark:text-gray-500 mb-3">👤 {{ article.get("author","") }} | 📅 {{ article.get("publishedAt","")[:10] }} | 💬 {{ comments | length }}件</p>
|
| 38 |
<div class="mb-4">
|
| 39 |
{% for t in tags %}<span class="tag-badge">#{{ t }}</span>{% endfor %}
|
| 40 |
</div>
|