Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
|
@@ -144,68 +144,68 @@ def generate_html_from_text(text, temperature=1.0, layout_type="standard"):
|
|
| 144 |
- スマートスペーシング:内容量に応じて自動的に間隔を調整
|
| 145 |
- 以下のCSSを必ず追加して、テキストの重なりを防止する:
|
| 146 |
```css
|
| 147 |
-
.card, .section, .info-box {
|
| 148 |
overflow: hidden;
|
| 149 |
display: flex;
|
| 150 |
flex-direction: column;
|
| 151 |
margin-bottom: 1.5rem;
|
| 152 |
min-height: fit-content;
|
| 153 |
-
}
|
| 154 |
-
.card-content {
|
| 155 |
flex: 1;
|
| 156 |
display: flex;
|
| 157 |
flex-direction: column;
|
| 158 |
-
}
|
| 159 |
-
.card-title {
|
| 160 |
font-weight: bold;
|
| 161 |
margin-bottom: 0.75rem;
|
| 162 |
line-height: 1.4;
|
| 163 |
-
}
|
| 164 |
-
.card-text {
|
| 165 |
line-height: 1.6;
|
| 166 |
margin-bottom: 0.5rem;
|
| 167 |
-
}
|
| 168 |
-
.info-item {
|
| 169 |
margin-bottom: 0.75rem;
|
| 170 |
line-height: 1.5;
|
| 171 |
-
}
|
| 172 |
-
li {
|
| 173 |
margin-bottom: 0.5rem;
|
| 174 |
line-height: 1.5;
|
| 175 |
-
}
|
| 176 |
-
p {
|
| 177 |
margin-bottom: 0.75rem;
|
| 178 |
line-height: 1.5;
|
| 179 |
-
}
|
| 180 |
```
|
| 181 |
|
| 182 |
## 自動テキスト調整機能
|
| 183 |
以下のJavaScriptを必ず追加して、テキスト量に応じたフォントサイズの自動調整を行う:
|
| 184 |
```html
|
| 185 |
<script>
|
| 186 |
-
document.addEventListener('DOMContentLoaded', function() {
|
| 187 |
// カード内のテキスト量に基づいてフォントサイズを調整
|
| 188 |
const cards = document.querySelectorAll('.card, .section, .info-box');
|
| 189 |
-
cards.forEach(card => {
|
| 190 |
const cardContent = card.querySelector('.card-content') || card;
|
| 191 |
const textLength = cardContent.textContent.length;
|
| 192 |
|
| 193 |
// テキスト量に応じてフォントサイズを調整
|
| 194 |
-
if (textLength > 200) {
|
| 195 |
card.style.fontSize = '0.9em';
|
| 196 |
-
}
|
| 197 |
-
if (textLength > 300) {
|
| 198 |
card.style.fontSize = '0.85em';
|
| 199 |
-
}
|
| 200 |
|
| 201 |
// カード内の要素間の余白を確保
|
| 202 |
const elements = card.querySelectorAll('p, h3, h4, ul, ol, .info-item');
|
| 203 |
-
elements.forEach(el => {
|
| 204 |
el.style.marginBottom = '0.75rem';
|
| 205 |
el.style.lineHeight = '1.5';
|
| 206 |
-
});
|
| 207 |
-
});
|
| 208 |
-
});
|
| 209 |
</script>
|
| 210 |
```
|
| 211 |
|
|
|
|
| 144 |
- スマートスペーシング:内容量に応じて自動的に間隔を調整
|
| 145 |
- 以下のCSSを必ず追加して、テキストの重なりを防止する:
|
| 146 |
```css
|
| 147 |
+
.card, .section, .info-box {{
|
| 148 |
overflow: hidden;
|
| 149 |
display: flex;
|
| 150 |
flex-direction: column;
|
| 151 |
margin-bottom: 1.5rem;
|
| 152 |
min-height: fit-content;
|
| 153 |
+
}}
|
| 154 |
+
.card-content {{
|
| 155 |
flex: 1;
|
| 156 |
display: flex;
|
| 157 |
flex-direction: column;
|
| 158 |
+
}}
|
| 159 |
+
.card-title {{
|
| 160 |
font-weight: bold;
|
| 161 |
margin-bottom: 0.75rem;
|
| 162 |
line-height: 1.4;
|
| 163 |
+
}}
|
| 164 |
+
.card-text {{
|
| 165 |
line-height: 1.6;
|
| 166 |
margin-bottom: 0.5rem;
|
| 167 |
+
}}
|
| 168 |
+
.info-item {{
|
| 169 |
margin-bottom: 0.75rem;
|
| 170 |
line-height: 1.5;
|
| 171 |
+
}}
|
| 172 |
+
li {{
|
| 173 |
margin-bottom: 0.5rem;
|
| 174 |
line-height: 1.5;
|
| 175 |
+
}}
|
| 176 |
+
p {{
|
| 177 |
margin-bottom: 0.75rem;
|
| 178 |
line-height: 1.5;
|
| 179 |
+
}}
|
| 180 |
```
|
| 181 |
|
| 182 |
## 自動テキスト調整機能
|
| 183 |
以下のJavaScriptを必ず追加して、テキスト量に応じたフォントサイズの自動調整を行う:
|
| 184 |
```html
|
| 185 |
<script>
|
| 186 |
+
document.addEventListener('DOMContentLoaded', function() {{
|
| 187 |
// カード内のテキスト量に基づいてフォントサイズを調整
|
| 188 |
const cards = document.querySelectorAll('.card, .section, .info-box');
|
| 189 |
+
cards.forEach(card => {{
|
| 190 |
const cardContent = card.querySelector('.card-content') || card;
|
| 191 |
const textLength = cardContent.textContent.length;
|
| 192 |
|
| 193 |
// テキスト量に応じてフォントサイズを調整
|
| 194 |
+
if (textLength > 200) {{
|
| 195 |
card.style.fontSize = '0.9em';
|
| 196 |
+
}}
|
| 197 |
+
if (textLength > 300) {{
|
| 198 |
card.style.fontSize = '0.85em';
|
| 199 |
+
}}
|
| 200 |
|
| 201 |
// カード内の要素間の余白を確保
|
| 202 |
const elements = card.querySelectorAll('p, h3, h4, ul, ol, .info-item');
|
| 203 |
+
elements.forEach(el => {{
|
| 204 |
el.style.marginBottom = '0.75rem';
|
| 205 |
el.style.lineHeight = '1.5';
|
| 206 |
+
}});
|
| 207 |
+
}});
|
| 208 |
+
}});
|
| 209 |
</script>
|
| 210 |
```
|
| 211 |
|