Extension:Display Title

This page is a translated version of the page Extension:Display Title and the translation is 48% complete.
Outdated translations are marked like this.
미디어위키 확장 기능 설명서
Display Title
출시 상태: 안정
구현 사용자 인터페이스, 파서 함수
설명 Displaytitle 확장기능을 사용하고 있는 문서는 원본 문서의 제목을 부제목으로, 자신이 원하는 제목을 문서 제목으로 표시할 수 있습니다. 링크가 걸린 텍스트나 토론 문서 제목에 "표시 제목 문서" 속성을 사용하고, 선택적으로 원래 문서 제목을 부제로 표시할 수 있도록 Displaytitle을 쿼리하는 파서 함수 기능을 제공합니다.
만든 이
최신 버전 4.0.2 (2023-07-26)
호환성 정책 스냅샷은 미디어위키와 함께 릴리스됩니다. Master is not backward compatible.
MediaWiki 1.39+
PHP 7.4+
Composer mediawiki/display-title
라이선스 MIT 허가서
다운로드
  • $wgDisplayTitleFollowRedirects
  • $wgDisplayTitleExcludes
  • $wgDisplayTitleHideSubtitle
Quarterly downloads 63 (Ranked 89th)
Display Title 확장 기능 번역
이슈 미해결 작업 · 버그 보고

DisplayTitle 확장기능은 문서 내에 Displaytitle 기능이 쓰인 경우, 문서의 표시되는 문자와 링크되는 문자를 계속 쓰지 않고 일반 링크를 달 때 처럼 링크를 달아도 링크된 문서 내에 있는 새 제목을 표시하도록 허용합니다. 둘 모두 다른 문서로 향하는 링크 뿐 아니라 문서 자체 편집도 가능합니다. DisplayTitle 확장기능은 해당 문서와 그 토론 문서 내에서 다른 제목을 보이게 하는 데에도 사용합니다. 사용자 입맛대로 원래 문서 이름을 문서의 부제목으로 표시할 수 있습니다. 또한 문서 제목 표기를 돕는 파서 함수 기능을 제공합니다.

이 확장 기능은 DISPLAYTITLE 매직 워드를 지원하는 MediaWiki core 기능 기반으로 작동합니다. {{DISPLAYTITLE:원하는 문서 제목}}함수를 displaytitle 문서 안에 집어넣으면 (여기서는 원하는 문서 제목이 쓰였습니다) 해당 문서는 가능한 경우 제목 표시줄의 원본 제목으로 표시합니다. 문서 설정은 MediaWiki 데이터베이스의 page_props 테이블에 저장됩니다. DisplayTitle 확장기능은 page_props 데이터베이스 테이블의 "displaytitle" 값을 쿼리하여 확장기능을 제공합니다.

설치

  • 파일을 다운로드하고 DisplayTitle 폴더를 extensions/ 디렉토리에 넣어 주세요.
    개발자와 코딩 기여자는 Git을 이용해 확장기능을 다운받는 것이 좋습니다.cd extensions/
    git clone https://gerrit.wikimedia.org/r/mediawiki/extensions/DisplayTitle
  • 아래의 코드를 LocalSettings.php 코드의 마지막에 추가합니다.
    wfLoadExtension( 'DisplayTitle' );
    
  • 필요에 따라 구성
  •   완료 – 위키의 ‘Special:Version’에 이동해서, 확장기능이 올바르게 설치된 것을 확인합니다.

구성 설정

설정하기 기본값 설명
$wgDisplayTitleHideSubtitle false 변수가 false일 경우 문서의 원래 이름이 문서 제목 표시줄 밑에 표시됩니다.
$wgDisplayTitleExcludes [ ] 문서의 이름이 바뀐 이름으로 표시되면 안되는 문서들의 목록으로, 블랙리스트, 화이트리스트 개념입니다.
$wgDisplayTitleFollowRedirects true Defines whether redirects should be followed for displaying of the title.

Display Title의 기능을 사용하는 데에는 꼭 필요하지는 않지만, {{DISPLAYTITLE:...}} 매직 워드가 제대로 작동하게 하려면 아래 MediaWiki core 구성 변수를 설정해야 합니다.

$wgAllowDisplayTitle = true; // defaults to true
$wgRestrictDisplayTitle = false; // defaults to true

편집하고 있는 중에도 바꾼 제목으로 표시하도록 설정하기

DisplayTitle이 표시 제목을 바꿀 문서들의 우선순위를 바꾸기 위해서는 아래 미디어위키 이름공간의 시스템 메세지를 편집해야 합니다. (가능하면 해당 위키의 언어로 표시하는 게 좋습니다)

시스템 메시지 문서 이름 기존 문서 내용 새 문서 내용
MediaWiki:Editing Editing $1 Editing {{#if: {{NAMESPACE}} | {{NAMESPACE}}: |}}{{#getdisplaytitle:{{SUBJECTPAGENAME}}}}
MediaWiki:Editingcomment Editing $1 (new section) Editing {{#if: {{NAMESPACE}} | {{NAMESPACE}}: |}}{{#getdisplaytitle:{{SUBJECTPAGENAME}}}} (new section)
MediaWiki:Editingsection Editing $1 (section) Editing {{#if: {{NAMESPACE}} | {{NAMESPACE}}: |}}{{#getdisplaytitle:{{SUBJECTPAGENAME}}}} (section)
MediaWiki:Editsectionhint Edit section: $1 Edit section: {{#if: {{NAMESPACE}} | {{NAMESPACE}}: |}}{{#getdisplaytitle:{{SUBJECTPAGENAME}}}}
MediaWiki:Creating Creating $1 Creating {{#if:{{NAMESPACE}}|{{NAMESPACE}}:}} {{#getdisplaytitle: {{SUBJECTPAGENAME}} }}

문서 양식을 사용하는 경우 다음 문서들도 손봐야 합니다.

시스템 메세지 문서 이름 기존 문서 내용 새 문서 내용
MediaWiki:Pf formedit createtitle Create $1: $2 Create $1: {{#if:{{NAMESPACE}}|{{NAMESPACE}}:}} {{#getdisplaytitle: {{SUBJECTPAGENAME}} }}
MediaWiki:Pf formedit edittitle Edit $1: $2 Edit $1: {{#if:{{NAMESPACE}}|{{NAMESPACE}}:}} {{#getdisplaytitle: {{SUBJECTPAGENAME}} }}

사용

문서 연결

다른 링크를 표시하는 제목 동작은 아래와 같이 요약할 수 있습니다. 아래에 있는 표는 상황에 따라 링크 텍스트가 어떻게 표시되는지 정리한 표입니다. 표에서 A는 문서의 제목을 나타내고, a 문서의 제목은 첫 번째 서로 다른 링크를 보여주고, (예시로 이름공간이 있을 경우 이름공간 다음 부분) 소문자로 나타냅니다. 문서가 넘겨주기 문서이거나, (예시로 "A"문서가 "B" 문서로 넘겨주기 되어 있는 경우) 제목 표시가 설정되어 있으면, display title은 확장기능을 무시하게 되므로 이 점을 유의하세요.

문서 링크 내용 "A" 제목인 문서가 넘겨주기 문서가 아닐 경우 "A" 문서가 "B" 제목을 가진 문서를 가리키도록 넘겨주기 된 경우
"A" 문서가 DisplayTitle 확장기능을 사용하지 않는 경우 "A" 문서에서 DisplayTitle 확장기능으로 "Z"로 문서 제목을 바꾸도록 설정했을 경우 "B" 문서가 DisplayTitle 확장기능을 사용하지 않는 경우 "B"문서에서 DisplayTitle 확장기능으로 "Y"를 제목으로 표기하도록 설정되었을 경우
[[A]] A Z B Y
[[a]] a
[[A | A]] A Z B Y
[[a | A]] A Z B Y
[[A | a]] a
[[a | a]] a
[[A | X]] X
[[a | X]] X

<span id="#getdisplaytitle_parser_function">

#getdisplaytitle 파서 함수

#getdisplaytitle 파서 함수는 문서의 display title 값을 가져옵니다. 예를 들어,

{{#getdisplaytitle:Book:42}}

를 작성하면, 문서의 displaytitle은 "Book:42"로 보일 것입니다. 문서의 현재 제목을 보여주려면, 아래 함수를 사용해야 합니다.

{{#getdisplaytitle:{{FULLPAGENAME}}}}

Lua/Scribunto 지원

Two Lua (see 확장기능:Scribunto ) functions exist for getting and setting a page's display title: mw.ext.displaytitle.get() and mw.ext.displaytitle.set(). To use them, you could create a page Module:DisplayTitle containing the following:

local p = {}

function p.set(frame)
	return mw.ext.displaytitle.set(frame.args[1])
end

function p.get(frame)
	return mw.ext.displaytitle.get(frame.args[1])
end

return p

You could then use {{#invoke:DisplayTitle|set|My Display Title}} on a page to set the page's display title to My Display Title, and you could use {{#invoke:DisplayTitle|get|My Page}} to get the display title of page My Page.

넘겨주기 문서

For redirect pages, if the target page has a display title, it will be used as the display title of the redirect page.

Note that this has two implications that may be unexpected the first time a user sees them. When a page with a display title is moved leaving a redirect, on the page indicating that the move was a success the link text will be the same for both the source and target pages. And, on the Special:WhatLinksHere page for a page with a display title that is the target of a redirect, the link text of the redirect page will be the display title of the target page.

A single level of redirect will be followed.

History

The functionality in this extension evolved as part of the Semantic Title extension. Special thanks go to Van de Bugger, the author of version 1.0 of Semantic Title.

Display Title relies only on functionality in MediaWiki core; it does not depend on any other extension. The functionality in Display Title has been removed from Semantic Title, which now retains solely the functionality to set a page's display title from a Semantic MediaWiki property or Cargo field. However, it is recommended that a page's display title be set using {{DISPLAYTITLE:...}} rather than the functionality in Semantic Title. Semantic Title is being maintained for backward compatibility.

업데이트 역사

Version 4.0.2
Version 4.0.1
  • Fix title handling in hooks (T342672)
  • Revert user preference to disable the extension due to a bug (T342727) and since the current approach introduces latency and risk
Version 4.0.0
  • Drop support for MediaWiki 1.38 and earlier
  • Add mw-displaytitle-subtitle class to subtitle (T205250)
  • Fix subpage subtitles for subpages more than two levels deep (T188872)
  • Fix redirect subtitle so it does not use the displaytitle (T306459)
  • Add name and description properties to composer.json (T311321)
  • Add a user preference to disable the extension (T217179)
  • Coding style and test improvements
Version 3.3
  • Do not remove fragments if not proper part of text
  • Change PersonalUrls hook to SkinTemplateNavigation::Universal hook
  • Replace deprecated WikiPage::factory/Use WikiPageFactory
Version 3.2
  • Add config option for changing redirect display ($wgDisplayTitleFollowRedirects)
  • Replace deprecated PageProps::getInstance
Version 3.1
  • Fix incompatibility with the Cite extension
Version 3.0
  • Several fixes to anchor/fragment behavior
  • Updates due to code deprecations in MediaWiki
  • Compatibility dropped with MW 1.34 and lower
Version 2.2.0
  • Add $wgDisplayTitleExcludes array to define a list of pages on which links should not use DisplayTitle
  • Fix behavior when there are underscores in the link text
  • Don't use deprecated ParserBeforeStrip hook
Version 2.1.0
  • Added tests
  • Added null title check
Version 2.0.0
  • Compatibility dropped with MW 1.28 and lower
  • Bug fixes:
    • T181669: Handle integers passed as link text
    • Fixed bug introduced in version 1.5.2 that caused self links to be wrapped in HtmlArmor
Version 1.5.3
  • On redirect pages, show display title of target page
    • Follows a single level of redirect
Version 1.5.2
  • Bug fixes:
    • T180413: Use supplied link text rather than display title when link text matches page title except for case of first character
    • T180409: Undefined variable: found in "DisplayTitleHooks.php" on line 152
    • T181228: Display titles with italics show as HTML
Version 1.5.1
  • Fixed issue for logged-in users on using action "info"
Version 1.5
  • Text that should have overridden link text was being ignored
  • Fix link to user page in header (personal URLs)
Version 1.4
  • Updated to work with MediaWiki 1.28+
Version 1.3
  • Modified self-links to determine display text identically to non-self-links
Version 1.2
  • Added mw.ext.displaytitle.get() and mw.ext.displaytitle.get() Lua functions written by User:Oetterer
Version 1.1
  • Added check for title with only fragment when creating link
Version 1.0
  • Initial release

알려진 비호환성

  • Configuration parameter $wgDisplayTitleHideSubtitle will not work if you also have the Semantic Breadcrumb Links extension lower than version 1.5.0 installed.

Thus the original page title will not display below the title bar.

같이 보기