Page MenuHomePhabricator

Highlight recited sentence
Closed, ResolvedPublic3 Estimated Story Points


The sentence currently being recited should be highlighted.

Proposed solution: Wrap the current sentence in a span with a particular CSS-class. Preferably, there should only be one span for this (see: T122158#2651737)

Event Timeline

Lokal_Profil edited projects, added Wikispeech; removed Wikispeech (Sprint 2016-11-16).
Lokal_Profil subscribed.

Based on need in T151786

Adding <span> is tricky when they span multiple nodes. E.g. adding a <span> over "monkey penguin" in:

  penguin giraffe

doesn't work, since it would be broken HTML:

    penguin</span> giraffe

While there are some methods for [[ | Range]] that looked promising (like surroundContents() and insertNode()) experimenting with them has shown that they add/split elements, making it hard to remove the <span>.

I'm currently working on a solution that will instead find all the text nodes that should get highlighted and adding a <span> for each of them. Removing these later shouldn't be too hard and should leave the HTML intact. A (at the time of writing ugly) draft for getting all text nodes between to nodes can be seen here.

I have a reasonably working version of this locally. It still needs a bit more testing and, cleaning and merging.

Sebastian_Berlin-WMSE raised the priority of this task from Medium to High.Feb 1 2017, 12:36 PM
Sebastian_Berlin-WMSE lowered the priority of this task from High to Medium.Feb 1 2017, 12:47 PM

The current under development solution uses index paths ([1, 0 ,4]) to find the correct nodes. Could Xpath be used instead? See

Jopparn changed the point value for this task from 4 to 2.Feb 6 2017, 10:51 AM
Jopparn subscribed.

According to old system, will be updated to 1 Story Point = 1 hour tomorrow

Lokal_Profil changed the point value for this task from 2 to 5.Feb 7 2017, 1:35 PM

Worked on in Wikispeech (Sprint 2017-01-25):

  • Solution using DOM-based paths to find the correct text nodes from utterances
  • Removed position of token+utterance which has proved to no longer be needed

To do in Wikispeech (Sprint 2017-02-08):

  • Documentation for new functions, de-linting, rebase
  • Commit
  • Review-cycle [André]
  • Create follow-up tasks for investigating use of XPath

Changed story points to new system

Change 336816 had a related patch set uploaded (by Sebastian Berlin (WMSE)):
Highlight recited sentence

Lokal_Profil changed the point value for this task from 5 to 3.Feb 21 2017, 1:56 PM

Worked on in Wikispeech (Sprint 2017-02-08):

  • Committed and ready for review

To do in Wikispeech (Sprint 2017-02-22):

  • Review-cycle [André]
  • Create follow-up tasks for investigating use of XPath

Change 336816 merged by jenkins-bot:
[mediawiki/extensions/Wikispeech] Highlight recited sentence

Mentioned in SAL (#wikimedia-labs) [2017-03-03T15:06:10Z] <Sebastian_> Deploy latest from Git master: e2fbe6a (T148622)