From 1d687e23f35342c0d83325d17c90d547a8d1a0d4 Mon Sep 17 00:00:00 2001 From: Arlo Breault Date: Wed, 22 Aug 2018 18:27:23 -0400 Subject: [PATCH] Use the dir parameter only from the full definition of a named ref tag Bug: T196827 Change-Id: Iaf84966e37cea730c9eca07c19a555971ffeadf3 --- includes/Cite.php | 2 ++ tests/parser/citeParserTests.txt | 38 ++++++++++++++++++++++++++++++++ 2 files changed, 40 insertions(+) diff --git a/includes/Cite.php b/includes/Cite.php index b3ec861b5..1cef1d769 100644 --- a/includes/Cite.php +++ b/includes/Cite.php @@ -545,6 +545,8 @@ class Cite { if ( $this->mRefs[$group][$key]['text'] === null && $str !== '' ) { // If no text found before, use this text $this->mRefs[$group][$key]['text'] = $str; + // Use the dir parameter only from the full definition of a named ref tag + $this->mRefs[$group][$key]['dir'] = $dir; $this->mRefCallStack[] = [ 'assign', $call, $str, $key, $group, $this->mRefs[$group][$key]['key'] ]; } else { diff --git a/tests/parser/citeParserTests.txt b/tests/parser/citeParserTests.txt index ac549c034..1b7b2d629 100644 --- a/tests/parser/citeParserTests.txt +++ b/tests/parser/citeParserTests.txt @@ -1578,3 +1578,41 @@ Ref with block content in formatting tag

hi[1]

  1. ho
!! end + +!! test +T196827: Use the dir parameter only from the full definition of a named ref tag +!! wikitext +abcdef + +ghijklmno + + +!! html/php +

abc[1]def +

ghi[1]mno +

+
    +
  1. 1.0 1.1 jkl +
  2. +
+ +!! end + +!! test +T196827: Ignore the dir parameter from the first use, which is not a full definition, and use the dir value from the full definition of a named ref tag +!! wikitext +abcdef + +ghijklmno + + +!! html/php +

abc[1]def +

ghi[1]mno +

+
    +
  1. 1.0 1.1 jkl +
  2. +
+ +!! end