Skip to content

Commit

Permalink
「ノカケヵヶ」を漢字扱いしないように修正
Browse files Browse the repository at this point in the history
割り注の改行位置調整
Web小説対応 cookie送信とhttps
  • Loading branch information
hmdev committed Jun 16, 2016
1 parent 96f0673 commit 520ce7c
Show file tree
Hide file tree
Showing 9 changed files with 23 additions and 12 deletions.
5 changes: 5 additions & 0 deletions README_Changes.txt
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,11 @@ Changes
   外字用1文字フォントの利用

----
1.1.0b46 (2016/06/17)
 - 「ノカケヵヶ」を漢字扱いしないように修正
 - nav.xmlのtitlepageを修正
 - Web小説取得時にCOOKIEを送信
 - Web小説のhttpsのURLに対応
1.1.0b45 (2015/04/20)
 - 割り注内に注記やルビがある場合の改行位置の調整
 - 割り注内に半角文字がある場合の改行位置の調整
Expand Down
2 changes: 1 addition & 1 deletion src/AozoraEpub3.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
/** コマンドライン実行用mainとePub3変換関数 */
public class AozoraEpub3
{
public static final String VERSION = "1.1.0b45";
public static final String VERSION = "1.1.0b46";

/** コマンドライン実行用 */
public static void main(String args[])
Expand Down
6 changes: 3 additions & 3 deletions src/AozoraEpub3Applet.java
Original file line number Diff line number Diff line change
Expand Up @@ -3046,7 +3046,7 @@ boolean handleTextAreaTransfer(Transferable transfer)
if (dstPath == null && !isCacheFile(file)) dstPath = file.getParentFile();
if (file.getName().toLowerCase().endsWith(".url")) {
String urlLine = readInternetShortCut(file);
if (urlLine != null && urlLine.startsWith("http://")) {
if (urlLine != null && (urlLine.startsWith("http://") || urlLine.startsWith("https://"))) {
vecUrlString.add(urlLine);
vecUrlSrcFile.add(file);
}
Expand All @@ -3064,7 +3064,7 @@ else if (urlString != null) {
String[] urlLines = urlString.split("\n| ");
for (String urlLine : urlLines) {
if (urlLine != null) {
if (urlLine.startsWith("http://")) {
if (urlLine.startsWith("http://") || urlLine.startsWith("https://")) {
//Webから取得で処置
vecUrlString.add(urlLine);
vecUrlSrcFile.add(null);
Expand All @@ -3090,7 +3090,7 @@ else if (transfer.isDataFlavorSupported(DataFlavor.javaFileListFlavor)) {
if (dstPath == null && !isCacheFile(file)) dstPath = file.getParentFile();
if (file.getName().toLowerCase().endsWith(".url")) {
String urlLine = readInternetShortCut(file);
if (urlLine != null && urlLine.startsWith("http://")) {
if (urlLine != null && (urlLine.startsWith("http://") || urlLine.startsWith("https://"))) {
vecUrlString.add(urlLine);
vecUrlSrcFile.add(file);
}
Expand Down
6 changes: 3 additions & 3 deletions src/com/github/hmdev/converter/AozoraEpub3Converter.java
Original file line number Diff line number Diff line change
Expand Up @@ -1735,7 +1735,7 @@ void convertTextLineToEpub3(BufferedWriter out, String line, int lineNum, boolea
//行頭インデント 先頭が「『―(以外 半角空白は除去
if (this.forceIndent && ch.length > charStart+1) {
switch (ch[charStart]) {
case ' ': case '「': case '『': case '(': case '“': case '〝': case '〈': case '【': case '〔': case '[': case '※':
case ' ': case '「': case '『': case '(': case '': case '〈': case '【': case '〔': case '[': case '※':
break;
case ' ': case ' ':
char c1 = ch[charStart+1];
Expand Down Expand Up @@ -2022,8 +2022,8 @@ else if (chukiName.endsWith("割り注")) {
}
}
//改行位置を取得 、。は禁則処理する
//wrcBrPos = start + (int)Math.ceil((end-start)/2.0);
if (ch[wrcBrPos] == '、' || ch[wrcBrPos] == '。') wrcBrPos++;
if (wrcBrPos > 0 && wrcBrPos < ch.length &&
ch[wrcBrPos] == '、' || ch[wrcBrPos] == '。') wrcBrPos++;
}
}
}
Expand Down
3 changes: 2 additions & 1 deletion src/com/github/hmdev/util/CharUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -130,10 +130,11 @@ static public boolean isKanji(char[] ch, int i)
case '゛': case '゜':
//二の字点は濁点付きも漢字
return (i>0 && ch[i-1]=='〻');
case 'ノ': case 'カ': case 'ケ': case 'ヵ': case 'ヶ':
/*case 'ノ': case 'カ': case 'ケ': case 'ヵ': case 'ヶ':
//漢字の間にある場合だけ漢字扱い
if (i==0 || i+1==ch.length) return false;
return _isKanji(ch, i-1) && _isKanji(ch, i+1);
*/
}
return _isKanji(ch, i);
}
Expand Down
2 changes: 1 addition & 1 deletion src/com/github/hmdev/web/ExtractInfo.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
public class ExtractInfo
{
enum ExtractId {
PAGE_REGEX,
COOKIE, PAGE_REGEX,
SERIES, TITLE, AUTHOR, DESCRIPTION, COVER_IMG, COVER_HREF,
PAGE_NUM, PAGE_URL,
CHILD_NODE, HREF, HREF_REGEX, UPDATE, SUB_UPDATE, CONTENT_UPDATE_LIST, SUBTITLE_LIST,
Expand Down
4 changes: 3 additions & 1 deletion src/com/github/hmdev/web/WebAozoraConverter.java
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public class WebAozoraConverter

/** 追加更新分のみ出力する */
boolean convertModifiedOnly = false;
/** 再神話から連続した追加更新分のみ出力 */
/** 最新話から連続した追加更新分のみ出力 */
boolean convertModifiedTail = false;
/** 更新分に追加で変換する話数 */
int beforeChapter = 0;
Expand Down Expand Up @@ -1146,6 +1146,8 @@ private boolean cacheFile(String urlString, File cacheFile, String referer) thro
cacheFile.getParentFile().mkdirs();
//ダウンロード
URLConnection conn = new URL(urlString).openConnection();
ExtractInfo[] cookie = this.queryMap.get(ExtractId.COOKIE);
if (cookie != null && cookie.length > 0) conn.setRequestProperty("Cookie", cookie[0].query);
if (referer != null) conn.setRequestProperty("Referer", referer);
conn.setConnectTimeout(10000);//10秒
BufferedInputStream bis = new BufferedInputStream(conn.getInputStream(), 8192);
Expand Down
4 changes: 2 additions & 2 deletions web/novel.syosetu.org/extract.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,13 @@ SUBTITLE_LIST #maind .ss td a
## 各話 Chapter 先頭の章のみ大見出しで出力
#CONTENT_CHAPTER
## 各話 タイトル 中見出しで出力
CONTENT_SUBTITLE #maind .ss font:1
CONTENT_SUBTITLE #maind .ss font-size:1

## 各話 本文
CONTENT_ARTICLE #maind .ss:0

## 本文抽出開始 このタグの次から
CONTENT_ARTICLE_START #maind .ss font:1
CONTENT_ARTICLE_START #maind .ss font-size:1

## 本文抽出終了 このタグの前まで
CONTENT_ARTICLE_END #maind .ss div:-2
Expand Down
3 changes: 3 additions & 0 deletions web/novel18.syosetu.com/extract.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
## 変換対象URLパターン
##PAGE_REGEX .*/n\d+[^\/]*/$

##送信するクッキー 複数はセミコロン区切り key1=value1; key2=value2
COOKIE over18=yes

################################
##一覧ページの抽出設定
## シリーズタイトル
Expand Down

0 comments on commit 520ce7c

Please sign in to comment.