Skip to content

Commit

Permalink
Merge pull request #56 from WSOFT-Project/develop
Browse files Browse the repository at this point in the history
Lantana 2.9.8
  • Loading branch information
taiseiue authored May 6, 2024
2 parents dce366a + 116f501 commit 5fb0a68
Show file tree
Hide file tree
Showing 22 changed files with 442 additions and 58 deletions.
2 changes: 1 addition & 1 deletion __init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
__copyright__ = 'Copyright (C) 2022 WSOFT.'
__version__ = '2.9.6'
__version__ = '2.9.8.1'
__license__ = 'MIT'
__author__ = 'WSOFT'
__author_email__ = 'info@wsoft.ws'
Expand Down
2 changes: 2 additions & 0 deletions docs/cheatsheet/markdown.md
Original file line number Diff line number Diff line change
Expand Up @@ -474,13 +474,15 @@ graph TD;
```markdown title="例"
= "cheatsheet" =\
```

### スニペットの埋め込み
`--8<--`で囲い、その中にファイル名を書き込むと、そのファイルを埋め込みます。
```markdown title="例"
;--8<--
snippet.md
;--8<--
```

### HTMLの埋め込み
HTMLコードは、そのまま記述することで埋め込むことができます。
```html title="例"
Expand Down
9 changes: 8 additions & 1 deletion docs/extensions/alerts.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ Alerts拡張機能は、Lantanaにアラートを追加する拡張機能です
!!! note "メモ"
`note`で使用できる装飾です。[リンク](#)は自動的に適切な色になります。
```
結果

**結果**
!!! note "メモ"
`note`で使用できる装飾です。[リンク](#)は自動的に適切な色になります。

Expand All @@ -33,6 +34,12 @@ Alerts拡張機能は、Lantanaにアラートを追加する拡張機能です
!!! tip
`tip`で使用できる装飾です。[リンク](#)は自動的に適切な色になります。

!!! important
`important`で使用できる装飾です。[リンク](#)は自動的に適切な色になります。

!!! caution
`caution`で使用できる装飾です。[リンク](#)は自動的に適切な色になります。

!!! success
`success`で使用できる装飾です。[リンク](#)は自動的に適切な色になります。

Expand Down
169 changes: 169 additions & 0 deletions docs/extensions/alerts2.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,169 @@
---
title : Alerts2
long_title : Alerts2拡張機能
summary : この記事では、Alerts2拡張機能の使用方法について説明します
date : 2024-05-06
---

<span class="badge bg-primary">対応バージョン:>=2.9.8.1</span>

Alerts2拡張機能は、Lantanaに引用を使用したアラートを追加する拡張機能です。

この拡張機能を有効化することで、以下のコンポーネントが使用できるようになります。

- アラート

この拡張機能は、[lantana拡張機能](./lantana.md)に依存しています。
この拡張機能を使用するには、lantana拡張機能の使用が必要です。

### 使用方法
適用したい引用符の任意の行に`[!種類] タイトル`を追加します。

```markdown title="Markdown"
> [!NOTE] メモ
> 流し読みしているユーザーにも読んでもらいたい情報を記述します。
```

**結果**

> [!NOTE] メモ
> 流し読みしているユーザーにも読んでもらいたい情報を記述します。
#### アラートのバリエーション
用途に応じて、アラートには様々な色やアイコンを使用できます。
次に例を示します。

NOTE
> [!NOTE]
> `NOTE`で使用できる装飾です。[リンク](#)は自動的に適切な色になります。
>
> このアラートはGitHubのアラート記法と互換性があります。
TIP
> [!TIP]
> `TIP`で使用できる装飾です。[リンク](#)は自動的に適切な色になります。
>
> このアラートはGitHubのアラート記法と互換性があります。
IMPORTANT
> [!IMPORTANT]
> `TIP`で使用できる装飾です。[リンク](#)は自動的に適切な色になります。
>
> このアラートはGitHubのアラート記法と互換性があります。
CAUTION
> [!CAUTION]
> `CAUTION`で使用できる装飾です。[リンク](#)は自動的に適切な色になります。
>
> このアラートはGitHubのアラート記法と互換性があります。
WARNING
> [!WARNING]
> `WARNING`で使用できる装飾です。[リンク](#)は自動的に適切な色になります。
>
> このアラートはGitHubのアラート記法と互換性があります。
ABSTRACT
> [!ABSTRACT]
> `ABSTRACT`で使用できる装飾です。[リンク](#)は自動的に適切な色になります。
INFO
> [!INFO]
> `INFO`で使用できる装飾です。[リンク](#)は自動的に適切な色になります。
SUCCESS
> [!SUCCESS]
> `SUCCESS`で使用できる装飾です。[リンク](#)は自動的に適切な色になります。
QUESTION
> [!QUESTION]
> `QUESTION`で使用できる装飾です。[リンク](#)は自動的に適切な色になります。
FAILURE
> [!FAILURE]
> `FAILURE`で使用できる装飾です。[リンク](#)は自動的に適切な色になります。
DANGER
> [!DANGER]
> `DANGER`で使用できる装飾です。[リンク](#)は自動的に適切な色になります。
BUG
> [!BUG]
> `BUG`で使用できる装飾です。[リンク](#)は自動的に適切な色になります。
EXAMPLE
> [!EXAMPLE]
> `EXAMPLE`で使用できる装飾です。[リンク](#)は自動的に適切な色になります。
QUOTE
> [!QUOTE]
> `QUOTE`で使用できる装飾です。[リンク](#)は自動的に適切な色になります。
#### 注意事項

この拡張機能は、Alerts拡張機能と異なり、引用を使ってアラートを作成します。
MkDocsのMarkdownは、連続したふたつ以上の引用をひとつの引用として認識します。
このため、この拡張機能で生成されるアラートは、連続して配置できないことにご注意ください。
次の例をご覧ください。

```md title="Markdown"
> [!NOTE]
> `NOTE`で使用できる装飾です。[リンク](#)は自動的に適切な色になります。

> [!TIP]
> `TIP`で使用できる装飾です。[リンク](#)は自動的に適切な色になります。
```

**結果**

> [!NOTE]
> `NOTE`で使用できる装飾です。[リンク](#)は自動的に適切な色になります。
> [!TIP]
> `TIP`で使用できる装飾です。[リンク](#)は自動的に適切な色になります。
このような結果を避けるには、アラートの間に任意の要素を追加してください。

```md title="Markdown"
> [!NOTE]
> `NOTE`で使用できる装飾です。[リンク](#)は自動的に適切な色になります。

*TIP*

> [!TIP]
> `TIP`で使用できる装飾です。[リンク](#)は自動的に適切な色になります。
```

> [!NOTE]
> `NOTE`で使用できる装飾です。[リンク](#)は自動的に適切な色になります。
*TIP*

> [!TIP]
> `TIP`で使用できる装飾です。[リンク](#)は自動的に適切な色になります。
#### アラートのネスト
アラート内にアラートを含めることもできます。

```md title="Markdown"
> [!NOTE]
> `note`で使用できる装飾です。[リンク](#)は自動的に適切な色になります。
> > ![TIP]
> > これはネストされたアラートです。
```

**結果**

> [!NOTE]
> `note`で使用できる装飾です。[リンク](#)は自動的に適切な色になります。
> > [!TIP]
> > これはネストされたアラートです。
### 導入方法
設定ファイル(`mkdocs.yml`)に以下の行を追加します。

```yml title="mkdocs.yml"
markdown_extensions:
(中略)
- lantana.alerts2
```
41 changes: 41 additions & 0 deletions docs/extensions/selector.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
---
title : Selector
long_title : Selector拡張機能
summary : この記事では、Selector拡張機能の使用方法について説明します
date : 2024-05-06
---

<span class="badge bg-primary">対応バージョン:>=2.9.8.1</span>

Selector拡張機能は、Lantanaに選択可能なサイトへのリンクを追加する拡張機能です。

この拡張機能を有効化することで、以下のコンポーネントが使用できるようになります。

- リンクセレクター

この拡張機能は、[lantana拡張機能](./lantana.md)に依存しています。
この拡張機能を使用するには、lantana拡張機能の使用が必要です。

### 使用方法
引用の先頭に`[!SELECTOR] タイトル`をつけ、引用中にリンクを列挙します。

```markdown title="Markdown"
> [!SELECTOR] サイトを選択
> [WebSailing](https://docs.wsoft.ws/products/websailing)
> [AliceScript](https://docs.wsoft.ws/products/alice)
```

**結果**

> [!SELECTOR] サイトを選択
> [WebSailing](https://docs.wsoft.ws/products/websailing)
> [AliceScript](https://docs.wsoft.ws/products/alice)
### 導入方法
設定ファイル(`mkdocs.yml`)に以下の行を追加します。

```yml title="mkdocs.yml"
markdown_extensions:
(中略)
- lantana.selector
```
2 changes: 0 additions & 2 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,3 @@ Lantanaはシンプルながらも、多言語に対応しており、フリー
* マークダウン拡張の[Embedly Extension for Python-Markdown](https://github.com/yymm/mdx_embedly)を使用し、一部改変しています
* 検索エンジンに[lunr.js](https://lunrjs.com/)を使用しています
* Lantanaのアイコンは、[icooon-mono](https://icooon-mono.com/)にお借りしました

="tutrial"|[include-subdir,style-lite]=
8 changes: 4 additions & 4 deletions lantana/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
{% if page and page.meta.summary %}
<meta property="og:site_name" content="{{ config.site_name }}" />
<meta property="og:type" content="website" />
<meta property="og:title" content="{% if page.title %}{{ page.title }} | {% endif %}{{ config.site_name }}" />
<meta property="og:title" content="{% if page.title %}{{ page.title }} | {% endif %}{% if config.site_short_name %}{{ config.site_short_name }}{% else %}{{ config.site_name }}{% endif %}" />
<meta name="twitter:card" content="Summary Card" />
{% if page and page.meta.summary %}
<meta name="description" content="{{ page.meta.summary }}">
Expand All @@ -35,10 +35,10 @@
{% endif %}
{% endif %}

{% if config.site_short_name %}
<title>{% if page.title %}{{ page.title }} | {% endif %}{{ config.site_short_name }}</title>
{% if page and page.meta and page.meta.long_title %}
<title>{% if page.meta.long_title %}{{ page.title }} | {% endif %}{% if config.site_short_name %}{{ config.site_short_name }}{% else %}{{ config.site_name }}{% endif %}</title>
{% else %}
<title>{% if page.title %}{{ page.title }} | {% endif %}{{ config.site_name }}</title>
<title>{% if page.title %}{{ page.title }} | {% endif %}{% if config.site_short_name %}{{ config.site_short_name }}{% else %}{{ config.site_name }}{% endif %}</title>
{% endif %}

{% if config.favicon %}
Expand Down
6 changes: 3 additions & 3 deletions lantana/css/bootstrap-icons.min.css

Large diffs are not rendered by default.

Binary file removed lantana/css/bootstrap-icons.woff.css
Binary file not shown.
Binary file removed lantana/css/bootstrap-icons.woff2.css
Binary file not shown.
Binary file added lantana/css/fonts/bootstrap-icons.woff.css
Binary file not shown.
Binary file added lantana/css/fonts/bootstrap-icons.woff2.css
Binary file not shown.
40 changes: 0 additions & 40 deletions lantana/css/theme.css
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,6 @@ svg{
width: 100%;
}

.alert-heading:before{
font-family:bootstrap-icons;
padding-right: 0.25em;
font-size: 15px;
}

/*
.accordion-button:before{
font-family:bootstrap-icons;
Expand Down Expand Up @@ -136,40 +130,6 @@ mark{
--bs-accordion-btn-focus-box-shadow : 0 0 0 0;
}

.note .alert-heading:before{
content:'\F26A';
}
.abstract .alert-heading:before{
content:'\F3B8';
}
.info .alert-heading:before{
content:'\F430';
}
.tip .alert-heading:before{
content:'\F468';
}
.success .alert-heading:before{
content:'\F272';
}
.question .alert-heading:before{
content:'\F504';
}
.warning .alert-heading:before{
content:'\F33A';
}
.failure .alert-heading:before{
content:'\F622';
}
.danger .alert-heading:before{
content:'\F67B';
}
.bug .alert-heading:before{
content:'\F1DB';
}
.example .alert-heading:before{
content:'\F41F';
}

@media print{
.print-visible{
display: none;
Expand Down
27 changes: 27 additions & 0 deletions lantana/extensions/alerts.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,33 @@ def editRawHtml(html):
# MaterialのAdmonitionタイトルをAlertタイトルに置換
replaceClass(soup,'.admonition .admonition-title','admonition-title',['alert-heading'])

# Alertにアイコンを適用
addIcon(soup,'.admonition.note > .alert-heading','bi-check2')
addIcon(soup,'.admonition.abstract > .alert-heading','bi-journal-text')
addIcon(soup,'.admonition.info > .alert-heading','bi-info-circle')
addIcon(soup,'.admonition.important > .alert-heading','bi-exclamation-circle')
addIcon(soup,'.admonition.tip > .alert-heading','bi-lightbulb')
addIcon(soup,'.admonition.success > .alert-heading','bi-check-all')
addIcon(soup,'.admonition.question > .alert-heading','bi-question-circle')
addIcon(soup,'.admonition.warning > .alert-heading','bi-exclamation-triangle')
addIcon(soup,'.admonition.failure > .alert-heading','bi-window-x')
addIcon(soup,'.admonition.danger > .alert-heading','bi-radioactive')
addIcon(soup,'.admonition.caution > .alert-heading','bi-exclamation-octagon')
addIcon(soup,'.admonition.bug > .alert-heading','bi-bug')
addIcon(soup,'.admonition.example > .alert-heading','bi-window-sidebar')
addIcon(soup,'.admonition.quote > .alert-heading','bi-chat-right-quote')

# MaterialのAdmonition色をAlert色に置換
replaceClass(soup,'.admonition.note','admonition',['alert','alert-primary'])
replaceClass(soup,'.admonition.abstract','admonition',['alert','alert-secondary'])
replaceClass(soup,'.admonition.info','admonition',['alert','alert-info'])
replaceClass(soup,'.admonition.important','admonition',['alert','alert-info'])
replaceClass(soup,'.admonition.tip','admonition',['alert','alert-warning'])
replaceClass(soup,'.admonition.success','admonition',['alert','alert-success'])
replaceClass(soup,'.admonition.question','admonition',['alert','alert-secondary'])
replaceClass(soup,'.admonition.warning','admonition',['alert','alert-warning'])
replaceClass(soup,'.admonition.failure','admonition',['alert','alert-danger'])
replaceClass(soup,'.admonition.caution','admonition',['alert','alert-danger'])
replaceClass(soup,'.admonition.danger','admonition',['alert','alert-danger'])
replaceClass(soup,'.admonition.bug','admonition',['alert','alert-warning'])
replaceClass(soup,'.admonition.example','admonition',['alert','alert-dark'])
Expand All @@ -39,6 +57,15 @@ def editRawHtml(html):
addClass(soup,'.alert a',['alert-link'])
return str(soup)

def addIcon(soup,selector,iconPoint):
for tag in soup.select(selector):
alert_heading_icon_tag = soup.new_tag('i')
alert_heading_icon_tag.attrs["class"] = ["bi",iconPoint]
if tag.string:
tag.string = ' ' + tag.string
tag.insert(0,alert_heading_icon_tag)


def addClass(soup,selector,ar):
for tag in soup.select(selector):
tag.attrs.setdefault('class', list())
Expand Down
Loading

0 comments on commit 5fb0a68

Please sign in to comment.