Skip to content
145 changes: 145 additions & 0 deletions editors_doc/cite_note_ref.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,145 @@
# cpprefjpにおける注釈・出典の貼り方

HTML5でもCommonMarkでも標準的な方法が示されていないが、注釈・出典を貼りたいという需要は存在するため、cpprefjpでは記法を統一した。

HTMLタグのうち、`a`, `sup`, `cite`タグを利用して実現する。

## 基本的な注釈・出典記法

もっとも一般的に利用を検討するべき注釈・出典記法がこれだ。

本文中に参照を貼り、ページ最下部に「注釈」「出典」の項を作ってそこに注釈・出典を書く。

- `N`, `${N}`: 1から始まる連番

| | 参照元の見た目 | 参照先の見た目 | 参照元のid | 参照先のid |
|------|----------------|----------------|--------------|------------|
| 注釈 | <sup>[[注N]](./)</sup> | `N. ^` | `note_ref-${N}` | `note-${N}` |
| 出典 | <sup>[[N]](./)</sup> | `N. ^` | `cite_ref-${N}` | `cite-${N}` |

### 例

```md
ありきたりな世界、と私がよく書くが、この元ネタは、
おもに工業系と魔術系のMod<sup><a id="note_ref-1" href="#note-1">[注1]</a></sup>を導入したバージョン1.7.10のありきたりなMinecraftの実況をやっていきます<sup><a id="cite_ref-1" href="#cite-1">[1]</a></sup>、という動画内音声である。

## 注釈

1. **<a id="note-1" href="#note_ref-1">^</a>** MineCraftには、電気や金属・有機物加工などの概念を追加する工業系Mod、魔法の概念を追加する魔術系Modなどを代表に多種多様な改変を加えるModがある

## 出典

1. **<a id="cite-1" href="#cite_ref-1">^</a>** <cite>[【Minecraft】ありきたりな工業と魔術S2 Part01【ゆっくり実況】 - ニコニコ動画](http://www.nicovideo.jp/watch/sm25261912)</cite>、再生位置 0:07 (2017-12-28 2:08 JST 閲覧)
```

### 表示例

>ありきたりな世界、と私がよく書くが、この元ネタは、
>おもに工業系と魔術系のMod<sup><a id="note_ref-1" href="#note-1">[注1]</a></sup>を導入したバージョン1.7.10のありきたりなMinecraftの実況をやっていきます<sup><a id="cite_ref-1" href="#cite-1">[1]</a></sup>、という動画内音声である。
>
>## 注釈
>
>1. **<a id="note-1" href="#note_ref-1">^</a>** MineCraftには、電気や金属・有機物加工などの概念を追加する工業系Mod、魔法の概念を追加する魔術系Modなどを代表に多種多様な改変を加えるModがある
>
>## 出典
>
>1. **<a id="cite-1" href="#cite_ref-1">^</a>** <cite>[【Minecraft】ありきたりな工業と魔術S2 Part01【ゆっくり実況】 - ニコニコ動画](http://www.nicovideo.jp/watch/sm25261912)</cite>、再生位置 0:07 (2017-12-28 2:08 JST 閲覧)

## 節ごとの注釈・出典記法

ページが極めて長く、また多くの節がある時に利用を検討するべき注釈・出典記法がこれだ。

本文中に参照を貼り、節最下部に、節のタイトルレベルより一つ小さい「注釈」「出典」の項を作って、そこに注釈・出典を書く。

- `N`, `${N}`: 1から始まる連番
- `${short_name}`: 適当にでっち上げたページ内で衝突しない節の名前

| | 参照元の見た目 | 参照先の見た目 | 参照元のid | 参照先のid |
|------|----------------|----------------|--------------|------------|
| 注釈 | <sup>[[§注N]](./)</sup> | `N. ^` | `note_ref-${short_name}-${N}` | `note-${short_name}-${N}` |
| 出典 | <sup>[[§N]](./)</sup> | `N. ^` | `cite_ref-${short_name}-${N}` | `cite-${short_name}-${N}` |

### 例

```md
## <a id="define-graph" href="#define-graph">グラフ型を定義する</a>

(前略)

以下は、無向グラフ<sup><a id="note_ref-define-graph-1-a" href="#note-define-graph-1">[§注1]</a></sup>を定義する例:

(中略)

有向グラフ<sup><a id="note_ref-define-graph-1-b" href="#note-define-graph-1">[§注1]</a></sup>で、辺に重みを付ける例:

(中略)

### 注釈

1. <a id="note-define-graph-1">^</a> <sup>[**a**](#note_ref-define-graph-1-a)</sup> <sup>[**b**](#note_ref-define-graph-1-b)</sup>
```

### 表示例

>## <a id="define-graph" href="#define-graph">グラフ型を定義する</a>
>
>(前略)
>
>以下は、無向グラフ<sup><a id="note_ref-define-graph-1-a" href="#note-define-graph-1">[§注1]</a></sup>を定義する例:
>
>(中略)
>
>有向グラフ<sup><a id="note_ref-define-graph-1-b" href="#note-define-graph-1">[§注1]</a></sup>で、辺に重みを付ける例:
>
>(中略)
>
>### 注釈
>
>1. <a id="note-define-graph-1">^</a> <sup>[**a**](#note_ref-define-graph-1-a)</sup> <sup>[**b**](#note_ref-define-graph-1-b)</sup> 有向グラフ、無向グラフについては、[基本的なグラフ理論の復習](../archive/boost_docs/libs/graph/graph_theory_review.md)を参照

## 表に対する注釈記法

表の読み方に関わる注釈をつけるときに検討するべき注釈記法がこれだ。

表中に参照を貼り、表の直後に注釈・出典を書く。

- `N`, `${N}`: 1から始まる連番
- `M`, `${M}`: 1からはじまる表番号の連番

| | 参照元の見た目 | 参照先の見た目 | 参照元のid | 参照先のid |
|------|----------------|----------------|--------------|------------|
| 注釈 | <sup>[†N](./)</sup> | `N. ^` | `note_ref-t${M}-${N}` | `note-t${M}-${N}` |

### 例

```md
| コンテナ | ○○操作の計算量 | ××操作の計算量 |
|--|--|--|
| std::vector | O(1) | O(1) |
| foo | (O(n)<sup><a id="note_ref-t1-1" href="#note-t1-1">†1</a></sup>) | O(1) |
| bar | O(1) | O(1) |
| baz | O(1) | O(1) |
| hoge | (O(n)†) | (O(n)†) |

1. **<a id="note-t1-1" href="#note_ref-t1-1">^</a>** 直接はサポートされないが、`std::distance`, etc を用いて実現可能
```
### 表示例

>| コンテナ | ○○操作の計算量 | |
>|--|--|--|
>| std::vector | O(1) | O(1) |
>| std::list | (O(n)<sup><a id="note_ref-t1-1" href="#note-t1-1">†1</a></sup>) | O(1) |
>| bar | O(1) | O(1) |
>| baz | O(1) | O(1) |
>
>1. **<a id="note-t1-1" href="#note_ref-t1-1">^</a>** 直接はサポートされないが、`std::distance`, etc を用いて実現可能

## その他

同じ参照先に対する参照元が複数あるときは、参照元のid末尾に小文字のアルファベット`a`から連続で文字を割り当て、参照先の見た目は

>N. ^ <sup>[**a**](./)</sup> <sup>[**b**](./)</sup> 本文

のようにする。

出典のページタイトル・書籍タイトルなどは`cite`タグで囲う。
2 changes: 1 addition & 1 deletion editors_doc/specialized.md
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ int main() {

## リンクの存在チェック

CommonMark形式のリンクや独自拡張のプログラムの修飾`link`などで生成されるhtmlにリンクが埋め込まれるとき、リンク先がサイト内へのリンクだった場合、リンク先の存在チェックも行います。
CommonMark形式のリンクや独自拡張のプログラムの修飾`link`などで生成されるHTMLにリンクが埋め込まれるとき、リンク先がサイト内へのリンクだった場合、リンク先の存在チェックも行います。

リンク先が存在しなかった場合、変換時に以下の様なメッセージが **標準エラーに** 出力されます。

Expand Down
11 changes: 7 additions & 4 deletions editors_doc/start_editing.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ cpprefjpサイトのGitHubリポジトリは、以下になります:


## GitHubからcpprefjpサイトへの自動反映
GitHub上で記述したMarkdown(.md)形式のリファレンスは、自動的にhtmlに変換されて、cpprefjpサイトに反映されます。
GitHub上で記述したMarkdown(.md)形式のリファレンスは、自動的にHTMLに変換されて、cpprefjpサイトに反映されます。


### 反映間隔
Expand Down Expand Up @@ -67,12 +67,15 @@ Markdownの記述方法をわかりやすく解説してくれているWebサイ

* [cpprefjp特有の拡張構文](/editors_doc/specialized.md)

Markdown形式では、HTMLのタグも併用できますが、cpprefjpサイトでは積極的にはHTMLタグを使用しない方針です。できるだけ、Markdown形式でできる範囲内で解決するようにしてください。

Markdown形式では、htmlのタグも併用できますが、cpprefjpサイトでは積極的にはhtmlタグを使用しない方針です。できるだけ、Markdown形式でできる範囲内で解決するようにしてください
ただし、注釈・出典を貼るためにHTMLタグを利用します

本サイト内で使用しているhtmlタグは以下です:
* [cpprefjpにおける注釈・出典の貼り方](./cite_note_ref.md)

* アンカーを貼るために、`<a id="アンカー名">対象文字列</a>`のようなhtml5に基づく記法を利用している
それ以外に本サイト内で使用しているHTMLタグは以下です:

* アンカーを貼るために、`<a id="アンカー名">対象文字列</a>`のようなHTML5に基づく記法を利用している
* 表内での改行のために、`<br/>`タグを利用している
* 値の大きさを表現するために、上付き文字を表す`<sup>`タグを利用している
* 添字を表現するために、下付き文字を表す`<sub>`タグを利用している
Expand Down
12 changes: 6 additions & 6 deletions implementation.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@
| Visual Studio 2017 | 15.4.5 | 14.1 | 1911 | 191125547 |
| Visual Studio 2017 | 15.4.4 | 14.1 | 1911 | 191125542 |
| Visual Studio 2017 | 15.3.3 | 14.1 | 1911 | 191125507 |
| Visual Studio 2017 <a href="#cite-2">[^2]</a> | 15.0 | 14.1 | 1910 | 191025017 |
| Visual Studio 2017 <sup><a id="note_ref-visual_cpp_ver-1" href="#note-visual_cpp_ver-1">[§注1]</a></sup> | 15.0 | 14.1 | 1910 | 191025017 |
| Visual Studio 2017 RC | | 14.1 | 1910 | 191024930 |
| Visual Studio 2015 Update3 | 14.0 | 14.0 | 1900 | 190024210 |
| Visual Studio 2015 Update2 | 14.0 | 14.0 | 1900 | 190023918 |
Expand All @@ -122,7 +122,7 @@
| Visual Studio 2013 Update3 | 12.0 | 12.0 | 1800 | 180030723 |
| Visual Studio 2013 Update2 | 12.0 | 12.0 | 1800 | 180030501 |
| Visual Studio 2013 Update2 RC | 12.0 | 12.0 | 1800 | 180030324 |
| Visual Studio 2013 Update1 <a href="#cite-1">[^1]</a> | 12.0 | 12.0 | 1800 | 180021005 |
| Visual Studio 2013 Update1 <sup><a id="note_ref-visual_cpp_ver-2" href="#note-visual_cpp_ver-2">[§注2]</a></sup> | 12.0 | 12.0 | 1800 | 180021005 |
| Visual Studio 2013 RTM | 12.0 | 12.0 | 1800 | 180021005 |
| Visual Studio 2013 RC | 12.0 | 12.0 | 1800 | 180020827 |
| Visual Studio 2013 Preview | 12.0 | 12.0 | 1800 | 180020617 |
Expand Down Expand Up @@ -168,12 +168,12 @@
| C/C++ Compiler 7.0 | | | 700 | |
| C Compiler 6.0 | | | 600 | |

#### 注釈

- <a id="cite-1"></a>\[^1]: Visual Studio 2013 Update1では`_MSC_FULL_VER`は変更されなかった。
<https://blogs.msdn.microsoft.com/bharry/2014/01/20/vs-2013-1-update-1-is-available/#div-comment-125661>
- <a id="cite-2"></a>\[^2]: Visual Studio 2017では製品バージョンとVisual C++のバージョンが一致しない。
1. **<a id="note-visual_cpp_ver-1" href="#note_ref-visual_cpp_ver-1">^</a>** Visual Studio 2017では製品バージョンとVisual C++のバージョンが一致しない。
<https://qiita.com/Chironian/items/1432eb8b59eb2eefcd2d>

2. **<a id="note-visual_cpp_ver-2" href="#note_ref-visual_cpp_ver-2">^</a>** Visual Studio 2013 Update1では`_MSC_FULL_VER`は変更されなかった。
<https://blogs.msdn.microsoft.com/bharry/2014/01/20/vs-2013-1-update-1-is-available/#div-comment-125661>

### C++14の機能を有効にする

Expand Down