Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhanced implementation of layout.tex.erb #617

Merged
merged 46 commits into from
May 7, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
31f341a
layout.tex.erb (\documentclass): added dvipdfmx option as a global do…
munepi Apr 29, 2016
e168056
layout.tex.erb: replaced color -> xcolor (+ colortbl, array); This ch…
munepi Apr 29, 2016
d908284
layout.tex.erb: refactor around hyperref package; hyperref package de…
munepi Apr 29, 2016
ebf6078
layout.tex.erb: added \usepackage{textcomp}; enable TS1
munepi Apr 29, 2016
d691be3
layout.tex.erb: fixes to LaTeX2e
munepi Apr 29, 2016
f500688
EPUBMaker::Producer: fix timing of making @params["cover"]
takahashim Apr 29, 2016
c3ae37a
Merge pull request #618 from kmuto/epubmaker-htmlext
takahashim Apr 29, 2016
061e98c
update Changelog
takahashim Apr 29, 2016
8875738
layout.tex.erb (\documentclass): added dvipdfmx option as a global do…
munepi Apr 29, 2016
3355222
layout.tex.erb: replaced color -> xcolor (+ colortbl, array); This ch…
munepi Apr 29, 2016
7877107
layout.tex.erb: refactor around hyperref package; hyperref package de…
munepi Apr 29, 2016
c4dffb6
layout.tex.erb: added \usepackage{textcomp}; enable TS1
munepi Apr 29, 2016
e15c737
layout.tex.erb: fixes to LaTeX2e
munepi Apr 29, 2016
2d8da6e
Merge branch 'enhanced-layout-tex' of https://github.com/munepi/revie…
munepi Apr 29, 2016
ad1a4c0
set matrix of ruby-version in appveyor
takahashim May 2, 2016
6c14e0a
Merge pull request #620 from takahashim/appveyor
takahashim May 2, 2016
7a06566
add appveyors badge
takahashim May 2, 2016
791c392
Merge pull request #621 from kmuto/appveyor-badge
takahashim May 2, 2016
6d6473a
TravisCI: support ruby 2.3.1 and ruby-head (#622)
takahashim May 2, 2016
8cd3cc0
rubocop: add more rules (#623)
takahashim May 3, 2016
aaa518f
config.yml: add simplified sample
takahashim May 3, 2016
7b543e8
add inline_comment to TOPBuilder (#625)
vvakame May 3, 2016
ebd44a4
TOPBuilder: add a test for `@<comment>{}` in draft mode
takahashim May 3, 2016
4c70259
Merge pull request #626 from kmuto/config-simple
kdmsnr May 3, 2016
610732d
I18n.t: fix format_number_header
takahashim May 3, 2016
55673ab
Merge pull request #628 from kmuto/fix-i18n-t
kdmsnr May 3, 2016
421788c
Merge pull request #627 from kmuto/topbuilder_comment
takahashim May 3, 2016
cfb969c
Rakefile: add task preproc
takahashim May 4, 2016
0c65df6
add preproc(.ja).md
takahashim May 4, 2016
a879dc5
check caption by using present? instead of nil? on IDGXMLBuilder.
kmuto May 5, 2016
7e90ae8
Merge pull request #633 from kmuto/blank_emlistcaption
kmuto May 5, 2016
fc4a9d7
add instruction to column headline for toc on IDGXMLBuilder.
kmuto May 6, 2016
ac7adac
Merge pull request #634 from kmuto/column-instruction
kmuto May 6, 2016
4f8566e
fix missing default dc:identifier value.
kmuto May 6, 2016
e343003
Merge pull request #636 from kmuto/set_urnid
kmuto May 6, 2016
03213fd
Merge pull request #632 from kmuto/doc-preproc
takahashim May 6, 2016
1ced03f
Merge pull request #630 from kmuto/rake-preproc
takahashim May 6, 2016
daa3b5e
LATEXBuilder: fix to use keywords in locale.yml (#629)
takahashim May 6, 2016
53c6f27
add LocationTest
takahashim May 6, 2016
e5a0f2e
Merge pull request #638 from kmuto/test_location
takahashim May 6, 2016
ad0ff8e
layout.tex.erb (\documentclass): added dvipdfmx option as a global do…
munepi Apr 29, 2016
dfda187
layout.tex.erb: replaced color -> xcolor (+ colortbl, array); This ch…
munepi Apr 29, 2016
4e4f5ba
layout.tex.erb: refactor around hyperref package; hyperref package de…
munepi Apr 29, 2016
e7183a0
layout.tex.erb: added \usepackage{textcomp}; enable TS1
munepi Apr 29, 2016
ffa3b5a
layout.tex.erb: fixes to LaTeX2e
munepi Apr 29, 2016
fc9c653
Merge branch 'enhanced-layout-tex' of github.com:munepi/review into e…
munepi May 7, 2016
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 25 additions & 1 deletion .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ AllCops:
Exclude:
- lib/lineinput.rb
- lib/uuid.rb
DisplayCopNames: true

inherit_from: .rubocop_todo.yml

Expand Down Expand Up @@ -63,4 +64,27 @@ Style/ZeroLengthPredicate:
##################### Metrics ##################################

Metrics/ClassLength:
Max: 1500
Max: 1500

Metrics/LineLength:
Max: 256
Exclude:
- "test/**/*"

### should be < 50
Metrics/MethodLength:
Max: 100
Exclude:
- "bin/review-*"
- "test/**/*"

### should be < 20
Metrics/CyclomaticComplexity:
Max: 32

### should be < 60
Metrics/AbcSize:
Max: 120
Exclude:
- "bin/review-*"
- "test/**/*"
3 changes: 2 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ rvm:
- 2.0.0
- 2.1.*
- 2.2.*
- 2.3.0
- 2.3.1
- ruby-head

addons:
apt_packages:
Expand Down
4 changes: 4 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
Fri Apr 29 23:11:06 2016 Masayoshi Takahashi <[email protected]>

* Release 2.0.0

Mon Apr 4 14:42:51 2016 Kenshi Muto <[email protected]>

* config.yml:
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
# Re:VIEW

[![Build Status](https://secure.travis-ci.org/kmuto/review.png)](http://travis-ci.org/kmuto/review)
[![Gem Version](https://badge.fury.io/rb/review.png)](http://badge.fury.io/rb/review)
[![Build Status](https://secure.travis-ci.org/kmuto/review.png)](http://travis-ci.org/kmuto/review)
[![Build status](https://ci.appveyor.com/api/projects/status/github/kmuto/review?svg=true)](https://ci.appveyor.com/project/kmuto/review)

Re:VIEW is an easy-to-use digital publishing system for paper books and ebooks.

Expand Down
9 changes: 8 additions & 1 deletion appveyor.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,16 @@
---
install:
- SET PATH=C:\Ruby22-x64\bin;%PATH%
- SET PATH=C:\Ruby%ruby_version%\bin;%PATH%
- ruby --version
- gem --version
build_script:
- bundle install
- bundle exec rake test --trace --verbose
- bundle exec rubocop

environment:
matrix:
- ruby_version: "22"
- ruby_version: "22-x64"
- ruby_version: "23"
- ruby_version: "23-x64"
77 changes: 77 additions & 0 deletions doc/config.yml.sample-simple
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
# simple sample of config.yml
review_version: 2.0

debug: true

## inherited configuratons

# inherit: ["config-default.yml"]


## Book Metadata

bookname: book
language: ja
booktitle: The Re:VIEW Sample Book
aut: ["Masayoshi Takahashi"]
# cov: ["Masayoshi Takahashi"]
# ill: ["Masayoshi Takahashi"]
# trl: null
# edt: null
pbl: "Re:VIEW Publishing inc."
prt: "Re:VIEW Printing inc."
date: 2016-05-03
history: [["2012-01-30"],["2016-04-20","2016-05-03"]]
rights: (C) 2016 Re:VIEW Commiters, some rights reserved.
description: sample config.yml file for Re:VIEW book
urnid: urn:uid:http://reviewml.org/review-sample-book
# isbn: null

## Book Structure

toclevel: 3
secnolevel: 2
toc: true
direction: "ltr"

## Extra Pages

cover: null
coverimage: sample.jpg
# titlepage: null
# titlefile: null
# originaltitlefile: null
# creditfile: null
colophon: true
# backcover: null
# profile: null
# profiletitle: "About Authors"
# advfile: null

## Syntax Highlighting

highlight:
html: "pygments"
latex: "listings"

## for HTML

htmlext: html
stylesheet: ["style.css"]

## for EPUB

epubmaker:
htmlext: xhtml
cover_linear: true
externallink: true

## for LaTeX

texstyle: reviewmacro
texdocumentclass: ["jsbook", "uplatex,oneside"]

## for PDFMaker

pdfmaker:
colophon: true
153 changes: 153 additions & 0 deletions doc/preproc.ja.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,153 @@
# review-preproc ユーザガイド

Re:VIEWではソースコードなどを本文中に埋め込むことができます。

## `#@mapfile`

以下は`scripts/hello.rb`のソースを本文内に埋め込んでいます。

```review
//list[hello.rb][hello.rb]{
#@mapfile(scripts/hello.rb)
#!/usr/bin/env ruby

class Hello
def hello(name)
print "hello, #{name}!\n"
end
end

if __FILE__ == $0
Hello.new.hello("world")
end
#@end
//}
```
「`#@mapfile(ファイル名)`」から「`#@end`」は、指定したファイル名のファイル全体を本文中に埋め込むための記法です。埋め込む際には、`review-preproc`コマンドを実行します。

まず、以下のように、引用したい部分に「`#@mapfile()`」と「`#@end`」だけを書きます。ここでは`//list`ブロック内にこの2行だけを記述しています。

```review
//list[hello.rb.1][hello.re]{
#@mapfile(scripts/hello.rb)
#@end
//}
```
このソースに対して、`review-preproc`コマンドを実行します。すると、変換結果の*.reファイルを標準出力に出力します。

```shell-session
$ review-preproc hello.re
```
`--replace`オプションをつければ、ファイルそのものを置き換えるようになります。

```shell-session
$ review-preproc --replace hello.re
```

なお、rakeを使ってビルドしている場合、Rakefileに以下のような記述を追加すると、このコマンドを実行するtaskが定義されます。

```rake
desc 'preproc all'
task :preproc do
Dir.glob("*.re").each do |file|
sh "review-preproc --replace #{file}"
end
end
```

以下のように実行すれば、コマンドが実行されます。

```shell-session
$ rake preproc
```

## `#@maprange`

対象ファイルの一部だけ抜粋することもできます。こちらは「`#@maprange`」という記法を使います。

対象ファイルの抜粋したい部分の前後に、「`#@range_begin(ID)`」と「`#@range_end`」という記法を埋め込んでおきます。`#@range_begin`の引数には、その断片を抽出する際に使用するIDを指定します。以下の例では「sample」というIDにしています。

```ruby
#!/usr/bin/env ruby

class Hello
#@range_begin(sample)
def hello(name)
print "hello, #{name}!\n"
end
#@range_end(sample)
end

if __FILE__ == $0
Hello.new.hello("world")
end
```
*.reファイルの方には、「`#@mapfile(ファイル名)`」ではなく「`#@maprange(ファイル名,ID)`」を記述します。

```review
//list[range.rb][range.rb(抜粋)]{
#@maprange(scripts/range.rb,sample)
#@end
//}
```

あとは、先ほど同様、`review-preproc`コマンドか`rake preproc`コマンドを実行します。そうすると、`scripts/range.rb`の一部が抽出されて埋め込まれます。

```review
//list[range.rb][range.rb(抜粋)]{
#@maprange(scripts/range.rb,sample)
def hello(name)
print "hello, #{name}!\n"
end
#@end
//}
```

## `#@@maprange`

もっとも、Ruby以外では「`#@range_begin`」などがコメントと解釈されないこともあります。そのような場合、その言語のコメントの中に「`#@@range_begin`」と「`#@@range_end`」とを記述します。

Cのソースを例にします。対象となるrange.cは以下です。

```c
#include <stdio.h>

/* #@@range_begin(sample) */
void
put_hello(char *name)
{
printf("hello, %s!\n", name);
}
/* #@@range_end(sample) */

int main()
{
put_hello("world");
}
```

put_hello関数の定義の前後で「`#@@range_begin`」と「`#@@range_end`」が使われています。

これに対し、*.reファイルでは`#@maprange(scripts/range.c,sample)`と`#@end`を記述します。

```
//list[range.c][range.c(抜粋)]{
#@maprange(scripts/range.c,sample)
#@end
//}
```

変換した結果、以下のようになります。

```
//list[range.c][range.c(抜粋)]{
#@maprange(scripts/range.c,sample)
void
put_hello(char *name)
{
printf("hello, %s!\n", name);
}
#@end
//}
```
このようにすると、Cなどの言語のファイルに対しても、ソースの一部を抽出して埋め込むことができます。
Loading