Skip to content

Commit

Permalink
Merge e0c198d into 10a28d4
Browse files Browse the repository at this point in the history
  • Loading branch information
inao committed Feb 27, 2020
2 parents 10a28d4 + e0c198d commit 40c986d
Show file tree
Hide file tree
Showing 11 changed files with 123 additions and 116 deletions.
31 changes: 19 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -337,27 +337,27 @@ GitHub Flavored Markdown のFenced code blocks記法にも対応しています

<img src="images/hoge.png" width="320" alt="キャプション" />

### 注釈、リンク
### 脚注、リンク

次の2つの記法が使えます。紙面ではいずれも注釈になり、両者の違いはありません。
次の2つの記法が使えます。紙面ではいずれも脚注になり、両者の違いはありません。

[リンクの対象](URL)

注釈の対象(注:注釈文。)
脚注の対象(注:脚注文。)

たとえば次のように書きます。

[RubyMotion](http://rubymotion.com/)は、RubyでiOSアプリを作るれるツールです(注:日本円で20,000円程度です。)。

#### 注意事項
注釈文も「です・ます」調で統一してください。
また、注釈文の末尾にも「。」は必要です。
脚注文も「です・ます」調で統一してください。
また、脚注文の末尾にも「。」は必要です。

文末からの注釈の場合、以下のように末尾は「。)。」となります。
文末からの脚注の場合、以下のように末尾は「。)。」となります。

* ☓:〜です(注:注釈文です)。
* ☓:〜です。(注:注釈文です。)
* ○:〜です(注:注釈文です。)。
* ☓:〜です(注:脚注文です)。
* ☓:〜です。(注:脚注文です。)
* ○:〜です(注:脚注文です。)。

###

Expand Down Expand Up @@ -401,9 +401,9 @@ GitHub Flavored Markdownとは異なり、複数行に分けて書いても1行
<div class='column'>
#### コラムタイトル
本文
##### コラム小見出し
##### コラム内見出し
本文
##### コラム小見出し
##### コラム内見出し
本文
</div>

Expand Down Expand Up @@ -526,7 +526,7 @@ md2inao デベロッパー向け情報
"◆>=◆" : "<2267>",
"◆=>◆" : "<2266>",
"◆WDB◆" : "<cstyle:ストッパ>#<cstyle:>"
"◆WDB◆" : "<cstyle:ストッパ>WDB<cstyle:>"
}
}
```
Expand All @@ -548,6 +548,13 @@ md2inao デベロッパー向け情報
- InDesign になったテキストを置換したい時はこちら
- md 中の `<span class="symbol">…</span>` は after_filter 前に` ◆…◆` になります

過去のInDesignのスタイル名で出力したい場合
-------------------------

WEB+DB PRESS Vol.116(2020年4月発売)から、InDesignのバージョンアップに伴い、InDesignのスタイル名を[変更しました](https://github.com/naoya/md2inao/pull/126)

古い書籍の改訂時など、過去のスタイル名のまま変換したい場合は、タグ[「old\-style\-name](https://github.com/naoya/md2inao/releases/tag/old-style-name)段階のものを使用してください。

Authors
----------

Expand Down
4 changes: 2 additions & 2 deletions config/id_filter.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"before_filter": {
"<sup>" : "<CharStyle:上付き>",
"<sup>" : "<CharStyle:脚注上付き>",
"</sup>" : "<CharStyle:>",
"<sup2>" : "<cp:Superscript>",
"</sup2>" : "<cp:>"
Expand All @@ -20,7 +20,7 @@
"◆>=◆" : "<2267>",
"◆=>◆" : "<2266>",

"◆WDB◆" : "<cstyle:ストッパ>#<cstyle:>",
"◆WDB◆" : "<cstyle:ストッパ>WDB<cstyle:>",

"㈱" : "<3231>",
"(株)" : "<3231>",
Expand Down
10 changes: 5 additions & 5 deletions lib/Text/Md2Inao.pm
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,14 @@ use Text::Md2Inao::Logger;
# alpha: アルファベット
has default_list => ( is => 'rw', isa => 'Str' );

# リストの文字数上限
# コードの文字数上限
# WEB+DB PRESSの場合、リストは、1行63桁(文字)まで
# 書籍の場合、リストは1行69桁(文字)まで
has max_list_length => ( is => 'rw', isa => 'Num' );

# 本文埋め込みリストの文字数上限
# WEB+DB PRESSの場合、本文リストは1行55桁(文字)まで
# 書籍の場合、本文リストは1行73桁(文字)まで
# 本文埋め込みコードの文字数上限
# WEB+DB PRESSの場合、本文コードは1行55桁(文字)まで
# 書籍の場合、本文コードは1行73桁(文字)まで
has max_inline_list_length => ( is => 'rw', isa => 'Num' );

# 空行のスタイル
Expand Down Expand Up @@ -76,7 +76,7 @@ sub replace_markdown_extra_footnote {
my %footnotes_used;
my @lines = split /\n/, $text;

## 脚注の注釈を収集
## 脚注の脚注文を収集
for (@lines) {
if (m/^\[\^(\w+)\]:(.+)$/) {
my ($k, $v) = ($1, $2);
Expand Down
20 changes: 10 additions & 10 deletions lib/Text/Md2Inao/Builder/InDesign.pm
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ case text => sub {

if ($text =~ m!\(注:! or $c->in_footnote) {
$text = replace_note_parenthesis($c, $text, '');
$text =~ s!◆注/◆!<cstyle:上付き><fnStart:><pstyle:注釈>!g;
$text =~ s!◆注/◆!<cstyle:脚注上付き><fnStart:><pstyle:脚注>!g;
$text =~ s!◆/注◆!<fnEnd:><cstyle:>!g;
}

Expand Down Expand Up @@ -185,7 +185,7 @@ case "h4" => sub {

case "h5" => sub {
my ($c, $h) = @_;
return sprintf "<ParaStyle:コラム小見出し>%s\n", $c->parse_element($h);
return sprintf "<ParaStyle:コラム内見出し>%s\n", $c->parse_element($h);
};

case strong => sub {
Expand All @@ -211,7 +211,7 @@ case em => sub {

case code => sub {
my ($c, $h) = @_;
return sprintf "<CharStyle:コマンド>%s<CharStyle:>", $c->parse_element($h);
return sprintf "<CharStyle:コード(文字単位)>%s<CharStyle:>", $c->parse_element($h);
};

case p => sub {
Expand Down Expand Up @@ -355,14 +355,14 @@ case pre => sub {

$text = escape_html($text);

my $list_label = 'リスト';
my $comment_label = 'リストコメント';
my $list_label = 'コード';
my $comment_label = 'コードコメント';

# 「!!! cmd」で始まるコードブロックはコマンドライン(黒背景)
if ($text =~ /!!!(\s+)?cmd/) {
$text =~ s/.+?\n//;
$list_label .= '白文字';
$comment_label .= '白地黒文字';
$list_label .= '黒地白文字';
$comment_label .= '黒地白文字用';
}

## リストスタイル
Expand All @@ -377,7 +377,7 @@ case pre => sub {
}
else {
if ($max > $c->max_inline_list_length) {
log warn => "本文埋め込みリストは" . $c->max_inline_list_length . "文字まで!(現在${max}使用):\n$text\n\n";
log warn => "本文埋め込みコードは" . $c->max_inline_list_length . "文字まで!(現在${max}使用):\n$text\n\n";
}
}

Expand All @@ -389,7 +389,7 @@ case pre => sub {
}

# コード内強調
$text =~ s!\*\*(.+?)\*\*!<CharStyle:コマンド太字>$1<CharStyle:>!g;
$text =~ s!\*\*(.+?)\*\*!<CharStyle:コード強調(文字単位)>$1<CharStyle:>!g;

# コード内イタリック
$text =~ s!\___(.+?)\___!<CharStyle:イタリック(変形斜体)>$1<CharStyle:>!g;
Expand Down Expand Up @@ -428,7 +428,7 @@ case a => sub {
my $url = $h->attr('href');
my $title = $c->parse_element($h);
if ($url and $title) {
return sprintf "%s<cstyle:上付き><fnStart:><pstyle:注釈>%s<fnEnd:><cstyle:>", $title, $url;
return sprintf "%s<cstyle:脚注上付き><fnStart:><pstyle:脚注>%s<fnEnd:><cstyle:>", $title, $url;
} else {
return fallback_to_escaped_html($h);
}
Expand Down
2 changes: 1 addition & 1 deletion lib/Text/Md2Inao/Builder/Inao.pm
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ case pre => sub {
}
else {
if ($max > $c->max_inline_list_length) {
log warn => "本文埋め込みリストは" . $c->max_inline_list_length . "文字まで!(現在${max}使用):\n$text\n\n";
log warn => "本文埋め込みコードは" . $c->max_inline_list_length . "文字まで!(現在${max}使用):\n$text\n\n";
}
}

Expand Down
Loading

0 comments on commit 40c986d

Please sign in to comment.