Re: [Wikitech-l] Creating a broken link

2017-01-25 Thread Robert Vogel
Hi Victor,

you may use the return value of

    MediaWikiServices::getInstance()->getLinkRenderer()->makeLink(
Title::newFromText( 'Some title that does not exist' ) );

If you are within a ContextSource you may also call the shortcut
"$this->getLinkRenderer()"

--
Robert

On Mi, 2017-01-25 at 15:23 +0200, Victor Porton wrote:
> How to create a broken ("edit", "red") link to a page?
> 
> That is I want to generate a HTML code which displays a link,
> clicking
> which leads to the editor (for a page). The link should be red.
> 
> What is the right way to do this?
> ___
> Wikitech-l mailing list
> Wikitech-l@lists.wikimedia.org
> https://lists.wikimedia.org/mailman/listinfo/wikitech-l
___
Wikitech-l mailing list
Wikitech-l@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikitech-l

Re: [Wikitech-l] Creating a broken link

2017-01-25 Thread Victor Porton
On Wed, 2017-01-25 at 12:03 -0200, Aran wrote:
> You need to add the "new" class to a link for it to be a red link,
> but
> there's no simple way to do this in standard wikitext markup. You'd
> have
> to something like enable raw html, add an extension that allows
> adding
> attributes to link syntax, or you maybe add a CSS rule so you could
> for
> example put a span with class new in the link anchor.

I am authoring an extension, So no need to "add an extension" :-)

I need not only add "new" class (as in the current version of my
extension), but also make the link to the editor rather than to a
regular page.

I can write the HTML code myself, but wonder if MW API provides a
better way to do it.

> On 25/01/17 11:52, Victor Porton wrote:
> > On Wed, 2017-01-25 at 13:45 +, John wrote:
> > > Does the page exist already?
> > 
> > No. The issue is to create a link to a page which does not exist.
> > 
> > I can hard-code HTML link in my PHP script, but I wonder if there
> > is a
> > better way.
> > 
> > > On Wed, Jan 25, 2017 at 8:23 AM Victor Porton 
> > > wrote:
> > > 
> > > > How to create a broken ("edit", "red") link to a page?
> > > > 
> > > > That is I want to generate a HTML code which displays a link,
> > > > clicking
> > > > which leads to the editor (for a page). The link should be red.
> > > > 
> > > > What is the right way to do this?
> > > > ___
> > > > Wikitech-l mailing list
> > > > Wikitech-l@lists.wikimedia.org
> > > > https://lists.wikimedia.org/mailman/listinfo/wikitech-l
> > > 
> > > ___
> > > Wikitech-l mailing list
> > > Wikitech-l@lists.wikimedia.org
> > > https://lists.wikimedia.org/mailman/listinfo/wikitech-l
> > > 
> > 
> > ___
> > Wikitech-l mailing list
> > Wikitech-l@lists.wikimedia.org
> > https://lists.wikimedia.org/mailman/listinfo/wikitech-l
> 
> 
> ___
> Wikitech-l mailing list
> Wikitech-l@lists.wikimedia.org
> https://lists.wikimedia.org/mailman/listinfo/wikitech-l
> 


___
Wikitech-l mailing list
Wikitech-l@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikitech-l

Re: [Wikitech-l] Creating a broken link

2017-01-25 Thread Aran
You need to add the "new" class to a link for it to be a red link, but
there's no simple way to do this in standard wikitext markup. You'd have
to something like enable raw html, add an extension that allows adding
attributes to link syntax, or you maybe add a CSS rule so you could for
example put a span with class new in the link anchor.


On 25/01/17 11:52, Victor Porton wrote:
> On Wed, 2017-01-25 at 13:45 +, John wrote:
>> Does the page exist already?
> No. The issue is to create a link to a page which does not exist.
>
> I can hard-code HTML link in my PHP script, but I wonder if there is a
> better way.
>
>> On Wed, Jan 25, 2017 at 8:23 AM Victor Porton 
>> wrote:
>>
>>> How to create a broken ("edit", "red") link to a page?
>>>
>>> That is I want to generate a HTML code which displays a link,
>>> clicking
>>> which leads to the editor (for a page). The link should be red.
>>>
>>> What is the right way to do this?
>>> ___
>>> Wikitech-l mailing list
>>> Wikitech-l@lists.wikimedia.org
>>> https://lists.wikimedia.org/mailman/listinfo/wikitech-l
>> ___
>> Wikitech-l mailing list
>> Wikitech-l@lists.wikimedia.org
>> https://lists.wikimedia.org/mailman/listinfo/wikitech-l
>>
>
> ___
> Wikitech-l mailing list
> Wikitech-l@lists.wikimedia.org
> https://lists.wikimedia.org/mailman/listinfo/wikitech-l


___
Wikitech-l mailing list
Wikitech-l@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikitech-l

Re: [Wikitech-l] Creating a broken link

2017-01-25 Thread Victor Porton
On Wed, 2017-01-25 at 13:45 +, John wrote:
> Does the page exist already?

No. The issue is to create a link to a page which does not exist.

I can hard-code HTML link in my PHP script, but I wonder if there is a
better way.

> On Wed, Jan 25, 2017 at 8:23 AM Victor Porton 
> wrote:
> 
> > How to create a broken ("edit", "red") link to a page?
> > 
> > That is I want to generate a HTML code which displays a link,
> > clicking
> > which leads to the editor (for a page). The link should be red.
> > 
> > What is the right way to do this?
> > ___
> > Wikitech-l mailing list
> > Wikitech-l@lists.wikimedia.org
> > https://lists.wikimedia.org/mailman/listinfo/wikitech-l
> 
> ___
> Wikitech-l mailing list
> Wikitech-l@lists.wikimedia.org
> https://lists.wikimedia.org/mailman/listinfo/wikitech-l
> 


___
Wikitech-l mailing list
Wikitech-l@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikitech-l

Re: [Wikitech-l] Creating a broken link

2017-01-25 Thread John
Does the page exist already?

On Wed, Jan 25, 2017 at 8:23 AM Victor Porton  wrote:

> How to create a broken ("edit", "red") link to a page?
>
> That is I want to generate a HTML code which displays a link, clicking
> which leads to the editor (for a page). The link should be red.
>
> What is the right way to do this?
> ___
> Wikitech-l mailing list
> Wikitech-l@lists.wikimedia.org
> https://lists.wikimedia.org/mailman/listinfo/wikitech-l
___
Wikitech-l mailing list
Wikitech-l@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikitech-l

[Wikitech-l] Creating a broken link

2017-01-25 Thread Victor Porton
How to create a broken ("edit", "red") link to a page?

That is I want to generate a HTML code which displays a link, clicking
which leads to the editor (for a page). The link should be red.

What is the right way to do this?
___
Wikitech-l mailing list
Wikitech-l@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikitech-l