Skip to content

Commit 7dde03a

Browse files
committed
Hyperlink with several text units
1 parent 7162753 commit 7dde03a

File tree

2 files changed

+53
-3
lines changed

2 files changed

+53
-3
lines changed

corpus/hyperlink.txt

Lines changed: 50 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,4 +214,53 @@ Text with hpyerlink - No extra style and HTTP://GOGOLE.COM
214214
(textUnitContent))
215215
(endHyperlink)
216216
(textUnit
217-
(textUnitContent)))
217+
(textUnitContent)))
218+
219+
220+
=============================
221+
Text with hpyerlink composed by 2 text units
222+
=============================
223+
{\rtf1\ansi\ansicpg1252\cocoartf2639
224+
\cocoatextscaling0\cocoaplatform0{\fonttbl\f0\fswiss\fcharset0 Helvetica;\f1\fswiss\fcharset0 Helvetica-Bold;}
225+
{\colortbl;\red255\green255\blue255;\red0\green0\blue0;}
226+
{\*\expandedcolortbl;;\cssrgb\c0\c0\c0;}
227+
\paperw11900\paperh16840\margl1440\margr1440\vieww11520\viewh8400\viewkind0
228+
\pard\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\pardirnatural\partightenfactor0
229+
230+
\f0\fs24 \cf2 This is a {\field{\*\fldinst{HYPERLINK "http://www.google.com"}}{\fldrslt strange
231+
\f1\b\fs36 hyperlink}}}
232+
----------------------------
233+
(document
234+
(fonttbl
235+
(fontinfo
236+
(fontFamily)
237+
(charset)
238+
(fontname))
239+
(fontinfo
240+
(fontFamily)
241+
(charset)
242+
(fontname)))
243+
(colortbl
244+
(colorvalue
245+
(staticNumberLiteral)
246+
(staticNumberLiteral)
247+
(staticNumberLiteral))
248+
(colorvalue
249+
(staticNumberLiteral)
250+
(staticNumberLiteral)
251+
(staticNumberLiteral)))
252+
(parTbl)
253+
(textUnit
254+
(fontIndex)
255+
(fontSize)
256+
(colorFontIndex)
257+
(textUnitContent))
258+
(hyperlink)
259+
(textUnit
260+
(textUnitContent))
261+
(textUnit
262+
(fontIndex)
263+
(boldEnabled)
264+
(fontSize)
265+
(textUnitContent))
266+
(endHyperlink))

grammar.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,8 @@ module.exports = grammar({
295295

296296
_fieldinst: ($) => seq("{\\*", "\\fldinst", $._hyperlinkUnit, "}"),
297297

298-
_fieldslt: ($) => seq("{\\fldrslt", " ", $.textUnit, $.endHyperlink),
298+
_fieldslt: ($) =>
299+
seq("{\\fldrslt", " ", repeat1($.textUnit), $.endHyperlink),
299300

300301
endHyperlink: () => "}",
301302

@@ -314,7 +315,7 @@ module.exports = grammar({
314315
seq($._textUnitVisibleInformation, optional("\n")),
315316

316317
hyperlink: ($) => $._static_URL_literal,
317-
318+
318319
textUnit: ($) =>
319320
seq(optional($._textUnitParameters), $._textUnitInformation),
320321

0 commit comments

Comments
 (0)