Skip to content

Commit

Permalink
Setting up interwiki link display text
Browse files Browse the repository at this point in the history
  • Loading branch information
turnermm committed Aug 19, 2020
1 parent ec7b28d commit 9aa31e2
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 7 deletions.
3 changes: 2 additions & 1 deletion action/save.php
Expand Up @@ -199,7 +199,8 @@ function($matches){
return $matches[0];
}
if(preg_match('/[\w\.]+\s*>/',$matches[0])) {
// exclude dokuwiki's wiki links but first remove url display text if needed
return $matches[0];
$this->write_debug($type,$display_url,$rest); // exclude dokuwiki's wiki links but first remove url display text if needed
list($type,$display_url,$rest) = explode('|', $matches[0]);
if(!isset($display_url)) {
return $matches[0];
Expand Down
2 changes: 1 addition & 1 deletion ckeditor/lang/en.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 13 additions & 4 deletions ckeditor/plugins/link/dialogs/link.js.unc
Expand Up @@ -45,13 +45,14 @@ CKEDITOR.dialog.add( 'link', function( editor )
InterWikiLink: "Interwiki Link",
InterWikiType: "Interwiki Type",
InterwikiPlaceHolder: "Interwiki Replacement Text",
InterwikiInfo: "<div style='max-width:350px; white-space: pre-wrap;border:1px solid #cccccc; margin:auto; overflow:auto; padding:4px;line-height:125%;'>Dokuwiki\'s " +
InterwikiInfo: "<div style='min-width:350px; white-space: pre-wrap;border:1px solid #cccccc; margin:auto; overflow:auto; padding:4px;line-height:125%;'>Dokuwiki\'s " +
"interwiki links are short-cuts which look like this: <span style='font-weight:600'>[[wp&gt;Shakespeare]]</span>, which will create a link to the English Wikipedia article on Shakespeare. " +
"The <span style='font-weight:600'>wp</span> part designates a link pattern; " +
"the text following the '<span style='font-weight:900'>&gt;</span>' will be inserted into the link, replacing a place holder, which is enclosed in curly brackets, " +
"as in <span style='font-weight:600'>{NAME}</span>. When there is no place holder, the replacement text will be appended to the end of the link.</div>",
MediaFileLink: "link to media file",
URLText:"<span style='font-weight:bold'>URL Display Text (optional, defaults to url)</span>",
LinkDispText: "Link display text (optional)",
};
var fck_Lang = editor.lang.fbrowser ? editor.lang.fbrowser : defaultFBLang;

Expand Down Expand Up @@ -555,8 +556,8 @@ CKEDITOR.dialog.add( 'link', function( editor )

return {
title : linkLang.title,
minWidth : 375, //350,
minHeight : 250, //230,
minWidth : 475, //350,
minHeight : 300, //230,
contents : [
{
id : 'info',
Expand Down Expand Up @@ -810,6 +811,14 @@ CKEDITOR.dialog.add( 'link', function( editor )
type: 'html',
html: translateItem('InterwikiInfo'),
} ,
{
id: 'iwikidisp',
type: 'text',
label: translateItem('LinkDispText'),
required: false,
},


]
},

Expand Down Expand Up @@ -1211,7 +1220,7 @@ CKEDITOR.dialog.add( 'link', function( editor )
else data.url.url = iwiki_pattern + data.url.selection;
}

iwiki_text = data.url.url;
iwiki_text = "Big Test";//data.url.url;
attributes[ 'data-cke-saved-href' ] = data.url.url;

break;
Expand Down
1 change: 0 additions & 1 deletion scripts/parse_wiki.js.unc
Expand Up @@ -264,7 +264,6 @@ function parse_wikitext(id) {
var iw_type = class_name.match(/iw_(\w+\.?\w{0,12})/);
var iw_title = title.split(/\/\//);
var interwiki_label = iw_title[iw_title.length-1];
// interwiki_label = interwiki_label.replace(String.frasl,"\/");
if(!interwiki_label.match(/oIWIKIo.*?cIWIKIc/)) {
interwiki_label = 'oIWIKIo' + interwiki_label + 'cIWIKIc';
}
Expand Down

0 comments on commit 9aa31e2

Please sign in to comment.