W3C home > Mailing lists > Public > public-i18n-cjk@w3.org > January to March 2014

[HTML5 Ruby] Variable "Current Annotaions Range" ... May be reduced?

From: kawabata taichi <kawabata.taichi@gmail.com>
Date: Wed, 19 Mar 2014 16:53:23 +0900
Message-ID: <CA+PRW99pMBtt_spP-EKHsNoN3qUzDAmhn+k=Fp8t7gkoFWD1dA@mail.gmail.com>
To: CJK discussion <public-i18n-cjk@w3.org>
Dear HTML5 Editors,

I think that "Current Annotations Range" (CAR) variable, defined in
Step 8 of [1], may be omitted by slight modification of the algorithm
without any side effect.

First of all, "Current Annotations Range" (CAR) is initialized in Step
8, but is only used in "Commit Current Annotations" subroutine [2].

CAR is initialized to null at Step 8 of [1]. It is re-initialized to
null when it exits the subroutine of [2] (Step 4). As of it, CAR is
always null in main algorithm.

Because CAR is null when it enters to subroutine of [2], the IF check
of Step 1 of [2] "If ... current annotation is null ..." is always
true.  As of it, this part of value check may be unnecessary.

In short, CAR is local to to subroutine [2]. Furthermore, if we say
CAR to be "a DOM range whose start is the boundary point (root,
current annotations range start) and whose end is the boundary point
(root, index)", then the Step2 of [2] can be re-written to:

"If current annotations is not empty, create a new ruby annotation
container. It is described by an annotations list set to current
annotations and a range set to a DOM range whose start is the boundary
point (root, current annotations range start) and whose end is the
boundary point (root, index). Append this new ruby annotation
container at the end of current annotation containers."

In that way, variable CAR may be omitted. (If it is too verbose,
we can still leave CAR.)

Regards,

[1] ...
http://www.w3.org/html/wg/drafts/html/CR/text-level-semantics.html#segmentation-and-categorisation-of-ruby
[2] ...
http://www.w3.org/html/wg/drafts/html/CR/text-level-semantics.html#commit-current-annotations


-- 
---------------------------------------------------------------------
KAWABATA, Taichi E-mail: kawabata.taichi@gmail.com
Received on Wednesday, 19 March 2014 07:53:50 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 20:10:24 UTC