Усечение после X числа разрывов строк - PullRequest
0 голосов
/ 03 мая 2019

Я делаю шаблон anki (который поддерживает html и css для шаблонов карточек), и я хотел бы интегрировать примеры предложений, проанализированных из словаря. Проблема в том, что чаще всего слишком много примеров для показа.

Содержимое типичного поля "{{examples}}" выглядит следующим образом.

►…のほうに in the direction of…; toward(s)…; to 《the east》<br>・左のほうに曲がる bend [turn] to the left (side)<br>・左のほうに富士山が見える. On the left (side) you can see Mt. Fuji.<br>・こちら[あちら]のほうに this [that] way<br>・君のほうに行く go your way; go toward you<br>・市役所より北のほうに 《located》 to the north of the city hall; 《go》 north from the city hall<br>・それはここから[駅の]東のほうにある. It's (to the) east ┏from here [of the station].<br>・あきる野市は東京都の西のほうに位置している. Akiruno City is situated in the western part of metropolitan Tokyo.<br>・彼は青山のほうに住んでいる. He lives somewhere Aoyama way.<br>

Как видите, каждое примерное предложение начинается с «►» или «・» и заканчивается «
».

Есть ли способ обрезать все поле, чтобы показать только первые три примера, и кнопку "показать больше", чтобы отобразить оставшиеся примеры?

Текущий шаблон:

ПЕРЕДНЯЯ

<div class=category>{{category}}</div>
<div class=kenkyusha>{{kenkyusha}}</div>

<hr>

<div class=kojien>{{kojien}}</div>

CSS

.night_mode{
}

.replaybutton {display: none;}

ul {
    padding: 0;
}

.card {
  font-family: myfont;
  font-size:13pt;
  background-color: #1e1e1e;
}

.entry {
  font-size:200%;
  color:#5566ee;
  text-align: center;
}

.reading {
  text-align: center;
}

.category {
  text-align: center;
}

.kenkyusha {
  text-align: left;
  color:#4ecab0;
}

.kojien {
  text-align: left;
  color:#4ecab0;
}

.examples {
  text-align: left;
}

НАЗАД

<div class=entry>{{entry}}</div>
<div class=reading>{{reading}}</div>

<hr>

<div class=category>{{category}}</div>
<div class=kenkyusha>{{kenkyusha}}</div>
<div class=examples>{{examples}}</div>

<hr>

<div class=kojien>{{kojien}}</div>
...