Skip to content

Commit 4fc8f3f

Browse files
author
Andy Buchholz
committed
allow all chars in character name
1 parent ab7f539 commit 4fc8f3f

File tree

2 files changed

+20
-20
lines changed

2 files changed

+20
-20
lines changed

fountain.js

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,13 @@
1212
scene_number: /( *#(.+)# *)/,
1313

1414
transition: /^((?:FADE (?:TO BLACK|OUT)|CUT TO BLACK)\.|.+ TO\:)|^(?:> *)(.+)/,
15-
16-
dialogue: /^([A-Z*_]+[0-9A-Z (._\-')]*)(\^?)?(?:\n(?!\n+))([\s\S]+)/,
15+
16+
dialogue: /^([A-Z\u00C0-\u017F*_]+[0-9A-Z (._\-')]*)(\^?)?(?:\n(?!\n+))([\s\S]+)/,
1717
parenthetical: /^(\(.+\))$/,
1818

1919
action: /^(.+)/g,
2020
centered: /^(?:> *)(.+)(?: *<)(\n.+)*/g,
21-
21+
2222
section: /^(#+)(?: *)(.*)/,
2323
synopsis: /^(?:\=(?!\=+) *)(.*)/,
2424

@@ -50,15 +50,15 @@
5050
.replace(regex.cleaner, '')
5151
.replace(regex.whitespacer, '');
5252
};
53-
53+
5454
var tokenize = function (script) {
5555
var src = lexer(script).split(regex.splitter)
5656
, i = src.length, line, match, parts, text, meta, x, xlen, dual
5757
, tokens = [];
5858

5959
while (i--) {
6060
line = src[i];
61-
61+
6262
// title page
6363
if (regex.title_page.test(line)) {
6464
match = line.replace(regex.title_page, '\n$1').split(regex.splitter).reverse();
@@ -94,7 +94,7 @@
9494
tokens.push({ type: 'transition', text: match[1] || match[2] });
9595
continue;
9696
}
97-
97+
9898
// dialogue blocks - characters, parentheticals and dialogue
9999
if (match = line.match(regex.dialogue)) {
100100
if (match[1].indexOf(' ') !== match[1].length - 2) {
@@ -107,7 +107,7 @@
107107

108108
parts = match[3].split(/(\(.+\))(?:\n+)/).reverse();
109109

110-
for (x = 0, xlen = parts.length; x < xlen; x++) {
110+
for (x = 0, xlen = parts.length; x < xlen; x++) {
111111
text = parts[x];
112112

113113
if (text.length > 0) {
@@ -126,13 +126,13 @@
126126
continue;
127127
}
128128
}
129-
129+
130130
// section
131131
if (match = line.match(regex.section)) {
132132
tokens.push({ type: 'section', text: match[2], depth: match[1].length });
133133
continue;
134134
}
135-
135+
136136
// synopsis
137137
if (match = line.match(regex.synopsis)) {
138138
tokens.push({ type: 'synopsis', text: match[1] });
@@ -143,20 +143,20 @@
143143
if (match = line.match(regex.note)) {
144144
tokens.push({ type: 'note', text: match[1]});
145145
continue;
146-
}
146+
}
147147

148148
// boneyard
149149
if (match = line.match(regex.boneyard)) {
150150
tokens.push({ type: match[0][0] === '/' ? 'boneyard_begin' : 'boneyard_end' });
151151
continue;
152-
}
152+
}
153153

154154
// page breaks
155155
if (regex.page_break.test(line)) {
156156
tokens.push({ type: 'page_break' });
157157
continue;
158158
}
159-
159+
160160
// line breaks
161161
if (regex.line_break.test(line)) {
162162
tokens.push({ type: 'line_break' });
@@ -186,7 +186,7 @@
186186
inline.lexer = function (s) {
187187
if (!s) {
188188
return;
189-
}
189+
}
190190

191191
var styles = [ 'underline', 'italic', 'bold', 'bold_italic', 'italic_underline', 'bold_underline', 'bold_italic_underline' ]
192192
, i = styles.length, style, match;
@@ -197,7 +197,7 @@
197197
while (i--) {
198198
style = styles[i];
199199
match = regex[style];
200-
200+
201201
if (match.test(s)) {
202202
s = s.replace(match, inline[style]);
203203
}
@@ -212,7 +212,7 @@
212212
callback = toks;
213213
toks = undefined;
214214
}
215-
215+
216216
var tokens = tokenize(script)
217217
, i = tokens.length, token
218218
, title, title_page = [], html = [], output;
@@ -253,7 +253,7 @@
253253

254254
case 'action': html.push('<p>' + token.text + '</p>'); break;
255255
case 'centered': html.push('<p class=\"centered\">' + token.text + '</p>'); break;
256-
256+
257257
case 'page_break': html.push('<hr />'); break;
258258
case 'line_break': html.push('<br />'); break;
259259
}
@@ -271,7 +271,7 @@
271271
var fountain = function (script, callback) {
272272
return fountain.parse(script, callback);
273273
};
274-
274+
275275
fountain.parse = function (script, tokens, callback) {
276276
return parse(script, tokens, callback);
277277
};
@@ -280,5 +280,5 @@
280280
module.exports = fountain;
281281
} else {
282282
this.fountain = fountain;
283-
}
283+
}
284284
}).call(this);

fountain.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)