ソースコードの管理場所
Revisão | 125ec15e1370a398edd071678330f47d1679535d (tree) |
---|---|
Hora | 2016-03-08 13:12:51 |
Autor | Kazuki Maeda <kmaeda@kmae...> |
Commiter | Kazuki Maeda |
ltj-inputbuf.lua: comment_string
@@ -6,6 +6,8 @@ luatexja.load_module('base'); local ltjb = luatexja.base | ||
6 | 6 | luatexja.load_module('charrange'); local ltjc = luatexja.charrange |
7 | 7 | |
8 | 8 | require("unicode") |
9 | +luatexja.inputbuf = luatexja.inputbuf or {} | |
10 | +local ltji = luatexja.inputbuf | |
9 | 11 | local utflen = unicode.utf8.len |
10 | 12 | local utfbyte = unicode.utf8.byte |
11 | 13 | local utfchar = unicode.utf8.char |
@@ -33,12 +35,18 @@ local function add_comment(buffer) | ||
33 | 35 | if c>=0x80 then |
34 | 36 | local ct = getcatcode(c) |
35 | 37 | local te = tex.endlinechar |
36 | - local ctl = (te ~= -1) and (getcatcode(te)==5) and (getcatcode(getcount('ltjlineendcomment'))==14) | |
37 | - -- Is the catcode of endline character is 5 (end-of-line)? | |
38 | + local ctl = (te ~= -1) and (getcatcode(te)==5) | |
39 | + -- Is the catcode of endline character is 5 (end-of-line)? | |
40 | + local cc = (getcount('ltjlineendcomment') >= 0) and (getcatcode(getcount('ltjlineendcomment'))==14) | |
38 | 41 | -- Is the catcode of \ltjlineendcomment (new comment char) is 14 (comment)? |
39 | - if ((ct==11) or (ct==12)) and ctl then | |
42 | + local cs = (getcount('ltjlineendcomment') == -2 and luatexja.inputbuf.comment_string) | |
43 | + if ((ct==11) or (ct==12)) and ctl and (cc or cs) then | |
40 | 44 | if ltjc_is_japanese_char_curlist(c) then |
41 | - buffer = buffer .. utfchar(getcount('ltjlineendcomment')) | |
45 | + if cs then | |
46 | + buffer = buffer .. luatexja.inputbuf.comment_string | |
47 | + else | |
48 | + buffer = buffer .. utfchar(getcount('ltjlineendcomment')) | |
49 | + end | |
42 | 50 | end |
43 | 51 | end |
44 | 52 | end |