Re: [Vim-l] Tip templates project

2007-10-30 Thread John Beckett
Santhalus wrote:
 Do you use some automata for the pre-wrapping and code
 indenting or do it manually?
 Tip: When doing code formatting manually I found it often
 more convenient to copy/paste the content from the original
 vim tip than modify the code in the imported version - this
 way you can preserve the original indentation easily.

Did you see the amazing code from Ipkiss?

He has an automated method for doing what you suggest above.

http://vim.wikia.com/wiki/User:Ipkiss/Using_vim_to_edit_tips

http://vim.wikia.com/wiki/User:Ipkiss/Restoring_part_of_an_original_tip

However, I confess that I haven't yet used the above because
I've been in a scripting frenzy (while learning Python and
Pywikipedia). I haven't spent much time indenting code, so I
haven't implemented an automated procedure (although I have
downloaded everything and admired it).

While bulk editing, I mostly work in a trance, and I can't give
much attention to fixing code, although I have done a bit.

I've only done this in the last few days, using:

nnoremap \0 :bufdo %s/\s\+$//eCR bar %s/#35;/#/geCR
nnoremap \1 :bufdo %s/^== \| ==$/==/gceCR
nnoremap \2 :bufdo %s#\(/\{0,1\}\)code#\1tt#gceCR
nnoremap ,, opreEsc}
nnoremap , O/preEsc0

\0 trims trailing spaces and converts '#35;' to '#'.

\1 converts stuff like '== Comments ==' to '==Comments=='
(sorry, but since I'm doing this, I thought I would indulge my
preferences!).

\2 converts code../code to tt../tt (I like consistency,
and I think most of use (all?) currently use tt).

I find it easy to type the ',,' and ',' stuff, which insert the
pre tags. I might need to press '}' a few times after ',,'.

Suggestions on the above are welcome.

John

___
Vim-l mailing list
Vim-l@wikia.com
http://lists.wikia.com/mailman/listinfo/vim-l


Re: [Vim-l] Tip templates project

2007-10-25 Thread Santhalus
John Beckett wrote:
 
 Just one minor issue regarding the navigation: when I press 
 'Random page' I am sometimes directed to a OriginalMissing 
 page.
 
 Ugh. I'm afraid that is an unforeseen side effect of what I did earlier. The
 current plan will have no effect.
 
 My guess is that random page picks any page in the main namespace. If that
 page is a redirect, another is picked.
 
 Previously, the 200 missing tips had no wiki page. For example, the VimTip56
 redirect page previously redirected to a single tip is missing page. All
 missing tips redirected to the same tip is missing page, so there was a
 low probability that random page would hit it.
 
 My previous efforts have greatly improved tip navigation. If you are at
 VimTip55 you can press 'Next tip' to go to VimTip56, which is NOT a
 redirect, but is an individual page explaining that tip 56 is missing, with
 a link to the original vim.org location so a persistent reader could verify
 that tip 56 really did not exist. There are also links to the previous and
 next tips.
 
 However, because VimTip56 is now a real page rather than a redirect, it is
 available for random page. I don't know if we can overcome that problem. I
 was going to investigate it later. I imagine one would need to either read
 the wikia source code (I assume it's available somewhere), or find someone
 who understood it. Then you could see how random page works, and whether
 there is some way to disqualify pages from being a random target. There are
 200 missing tips, 15 missing because they were duplicates, and we have
 removed another 60. That's 275 pages for random page to hit.

Does the Wikia use the mediawiki engine or it's own custom engine?

Here is fragment from mediawiki source (1.11.0) 
(includes\SpecialRandompage.php), in case they use it.

$extra = $wgExtraRandompageSQL ? AND ($wgExtraRandompageSQL) : ;
$sql = SELECT page_title
FROM $page $use_index
WHERE page_namespace = $ns
AND page_is_redirect = $redirect
AND page_random = $randstr
$extra
ORDER BY page_random;

As you can see, there is a parameter for filtering the results 
($wgExtraRandompageSQL) but I suspect it's global for the whole wiki.
But it seems that putting those missing pages on another namespace 
could solve the problem.

Perhaps we would not even need Next/Prev tags in the template then, 
but instead go to nearest next/prev page in our namespace?
How can the administrators control what's called on pressing 
Next/Prev? Is it possible to embed some custom php functions/sql 
queries there?

Regards,
Santhalus

___
Vim-l mailing list
Vim-l@wikia.com
http://lists.wikia.com/mailman/listinfo/vim-l


Re: [Vim-l] Tip templates project

2007-10-25 Thread John Beckett
Santhalus wrote:
 Does the Wikia use the mediawiki engine or it's own custom engine?
...
 parameter for filtering the results ($wgExtraRandompageSQL)

The problem of 'Random page' sometimes picking missing pages is serious,
and deserves our attention.

I know nothing about the above questions. Bastl set up a wiki on his own
machine to experiment with the import. Maybe he could comment on the
likelihood of us being able to modify $wgExtraRandompageSQL. I gather
from Google that you would put an entry in LocalSettings.php (but is
there one of these exclusively for our wiki, and can we change it?).

Your suggestion about using a different namespace is intriguing and
ingenious, but I suspect it may need a fair bit of work to implement.

Here is the dilemma (tip 55 exists, tip 56 is missing):
- Tip 55 has a 'Next Tip' that is effectively [[VimTip56]].
- Tip 55 has no idea that tip 56 is missing.
- Therefore [[VimTip56]] has to be in the main namespace
  (because it might be a normal tip as far as tip 55 knows).
- That means Random Page can pick tip 56.

I could do something tricky with a script to have one kind of 'Next Tip'
redirect if redirecting to a normal tip, and another kind of 'Next Tip'
if redirecting to a missing/removed page (in another namespace). That
is, tip 55 _would_ have knowledge that 56 was missing.

Hmmm. If we put *all* VimTipNr pages in another namespace, then none of
them would be a target of Random Page. I'll have to ponder this, but it
seems like a brilliant manoeuvre. Thanks for finding the idea.

 Perhaps we would not even need Next/Prev tags in the template
 then, but instead go to nearest next/prev page in our namespace?
 How can the administrators control what's called on pressing
 Next/Prev? Is it possible to embed some custom php
 functions/sql queries there?

My guess is that custom functions/queries are totally impossible.
I imagine that wikia.com has no practical way of evaluating and
implementing code that people on its wikis might want to use.

The Next/Prev links are done entirely with wikitext. They use a
template, but that simply substitutes wikitext. So we just need to plan
how the wikitext should look, then work out how to reliably and simply
implement it.

For example, the following wikitext would create a link that displays as
Next Tip. The target is a page in another namespace.

[[Vim Tips Wiki:Comment guidelines|Next Tip]]

I don't know what's involved in creating a namespace. I think you just
create a page with a colon in its name??

Currently we have pages like [[VimTip55]] in the main namespace.

Maybe we could instead have [[VimTip:55]] so the page title would be 55
in the namespace VimTip:.

In the body of a tip, you might want to create a link to tip 55. You
could put [[VimTip:55|The text you would like to display]].

Let's chew this over for a few days. It would be quite a dramatic
change, but quite readily achievable with scripts (I'm too battle
scarred to say easy). I think it would totally solve the problem
of Random Page picking missing tips.

John

___
Vim-l mailing list
Vim-l@wikia.com
http://lists.wikia.com/mailman/listinfo/vim-l


Re: [Vim-l] Tip templates project

2007-10-24 Thread Santhalus

I think it's a very clever idea. Right now, awfully lots of imported 
tips are completely broken and this will hopefully remedy this situation.

Just one minor issue regarding the navigation: when I press 'Random 
page' I am sometimes directed to a OriginalMissing page. Does your 
operation fix this behaviour, too? Also, what happens when I press 
Next or Prev on pages which have 'next' and 'prev' arguments missing? 
Does it fallback to old navigation then?

Regards,
Santhalus


John Beckett wrote:
 As mentioned a couple of weeks ago, I propose running a script that will
 progressively change the {{Tip}} template used on imported tips. I also have
 developed another template that I propose will be used for new tips that we
 intend to keep. However, I'm less concerned about fixing the new tips, and
 will not be pursuing that at the moment.
 
 The main motivation for changing the Tip template is to remove the 'text'
 argument so that the tip body is no longer an argument to the template. Then
 we won't have to worry about pipe characters or double braces in the tip. If
 we keep the current template, we have to fix all the existing tips which use
 the problematic characters, *and* we have to worry about the tips being
 broken by future editing.
 
 The imported tips have numbers from 1 to 1504. In that range, over 280 are
 missing (spam deleted on vim.org, or other glitches, or tips we've deleted).
 Another motivation for changing the Tip template is to improve the tip
 navigation so that Previous and Next will skip the missing tips.
 
 I intend taking advantage of this opportunity to do some other processing:
 Trim trailing spaces; replace '#35;' with '#'; maybe manually inspect
 '--AT--' and replace with '@', or delete if an email address; maybe move
 [[Category]] to the end of each tip.
 
 See the following for examples and more details:
 http://vim.wikia.com/wiki/User:JohnBeckett/Tip_templates_project
 
 Please let me know if you like or dislike the proposals.
 
 John
 
 ___
 Vim-l mailing list
 Vim-l@wikia.com
 http://lists.wikia.com/mailman/listinfo/vim-l
 
___
Vim-l mailing list
Vim-l@wikia.com
http://lists.wikia.com/mailman/listinfo/vim-l


Re: [Vim-l] Tip templates project

2007-10-24 Thread John Beckett
Santhalus wrote:
 I think it's a very clever idea. Right now, awfully lots of 
 imported tips are completely broken and this will hopefully 
 remedy this situation.

Thanks for the feedback. Yes, I fixed two tips broken by '|' last week, and
the new template business would eliminate that.

I'm hoping people will look at the examples mentioned on my user page, and
speak up if they don't like the appearance. I will start the transition in a
couple of days, so this is a hint to anyone that they should speak now or
forever hold their peace.

 Just one minor issue regarding the navigation: when I press 
 'Random page' I am sometimes directed to a OriginalMissing 
 page.

Ugh. I'm afraid that is an unforeseen side effect of what I did earlier. The
current plan will have no effect.

My guess is that random page picks any page in the main namespace. If that
page is a redirect, another is picked.

Previously, the 200 missing tips had no wiki page. For example, the VimTip56
redirect page previously redirected to a single tip is missing page. All
missing tips redirected to the same tip is missing page, so there was a
low probability that random page would hit it.

My previous efforts have greatly improved tip navigation. If you are at
VimTip55 you can press 'Next tip' to go to VimTip56, which is NOT a
redirect, but is an individual page explaining that tip 56 is missing, with
a link to the original vim.org location so a persistent reader could verify
that tip 56 really did not exist. There are also links to the previous and
next tips.

However, because VimTip56 is now a real page rather than a redirect, it is
available for random page. I don't know if we can overcome that problem. I
was going to investigate it later. I imagine one would need to either read
the wikia source code (I assume it's available somewhere), or find someone
who understood it. Then you could see how random page works, and whether
there is some way to disqualify pages from being a random target. There are
200 missing tips, 15 missing because they were duplicates, and we have
removed another 60. That's 275 pages for random page to hit.

BTW the current project will further improve tip navigation. If you are at
VimTip55, the next real tip is 58. That's where you will go if you press
Next tip on 55.

If the Next argument is missing, there will be an ugly mess including
{{{Next}}} visible in the tip navigation, and the navigation won't work. I
decided that was acceptable because a script will be inserting Next/Previous
in each tip and there won't be any missing items. Moreover, if I were run
over by a bus and Next/Previous were never updated, the wiki would still be
ahead because the Next/Previous will never be totally wrong. For example, if
tip 58 is ever deleted, then pressing Next tip on 55 would go to VimTip58
which would say this tip has been removed. If someone cared, they could
manually change the Next link in 55, or my update script could do it
automatically.

You can see the ugly {{{Next}}} stuff if you edit tip 1151 and remove
Next=1152, then press Show preview. I thought it better to keep the
templates extremely simple, and to plainly show that there is a problem,
rather than to do complex calculations to evaluate 1152 if Next is missing.
Templates do NOT have a good way of doing what would be simple in a script.

As evidence, here is the quite simple Template:Help :)

includeonly[http://vimplugin.sourceforge.net/cgi-bin/help?tag={{{tag|{{url
encode:{{{1|{{{id}}} :help
{{{2|{{{label|{{{1|{{{id]/includeonlynoinclude{{/doc}}
/noinclude

John

___
Vim-l mailing list
Vim-l@wikia.com
http://lists.wikia.com/mailman/listinfo/vim-l


Re: [Vim-l] Tip templates project

2007-10-23 Thread Benjamin Fritz
I like the proposed improvements to the tip template, but I'm a little wary
about a tip template for new tips.  How exactly do you propose that that
would work?  From what I understand, any tips we want to keep would be given
this template.  But what about tips that don't get reviewed within the time
period you suggest?  Do they just get deleted?  I think that a good solution
may be to count any tips without a tip template as needing review, similar
to the way in which all imported tips have the review template applied
right away.  Is there a way to automatically insert the review template, or
would we need to detect the absence of a tip template?  Can we even do that?

This also does not address the issue of people that just enter a tip and put
in the template themselves.

Oh, and if you can make improvements as part of the script like moving the
category or replacing html entities, that would also be great.  I see no
reason not to do that.

On 10/22/07, John Beckett [EMAIL PROTECTED] wrote:

 As mentioned a couple of weeks ago, I propose running a script that will
 progressively change the {{Tip}} template used on imported tips. I also
 have
 developed another template that I propose will be used for new tips that
 we
 intend to keep. However, I'm less concerned about fixing the new tips, and
 will not be pursuing that at the moment.

 The main motivation for changing the Tip template is to remove the 'text'
 argument so that the tip body is no longer an argument to the template.
 Then
 we won't have to worry about pipe characters or double braces in the tip.
 If
 we keep the current template, we have to fix all the existing tips which
 use
 the problematic characters, *and* we have to worry about the tips being
 broken by future editing.

 The imported tips have numbers from 1 to 1504. In that range, over 280 are
 missing (spam deleted on vim.org, or other glitches, or tips we've
 deleted).
 Another motivation for changing the Tip template is to improve the tip
 navigation so that Previous and Next will skip the missing tips.

 I intend taking advantage of this opportunity to do some other processing:
 Trim trailing spaces; replace '#35;' with '#'; maybe manually inspect
 '--AT--' and replace with '@', or delete if an email address; maybe move
 [[Category]] to the end of each tip.

 See the following for examples and more details:
 http://vim.wikia.com/wiki/User:JohnBeckett/Tip_templates_project

 Please let me know if you like or dislike the proposals.

 John

 ___
 Vim-l mailing list
 Vim-l@wikia.com
 http://lists.wikia.com/mailman/listinfo/vim-l

___
Vim-l mailing list
Vim-l@wikia.com
http://lists.wikia.com/mailman/listinfo/vim-l