User:Skygo/wikiupdate

I am a long time netbeans wiki user. But I was not aware until I was told during NetCAT 7.4, that lots of pages are editable by registred user and not need any request. (If you respec WikiEtiquette)

I did not hit many pages with categories. I though this was disabled.

I started reflexion of some basic feature we may add to netbeans mediawiki install to enhance content.

http://wiki.netbeans.org/Special:Categories

Contents

Netbeans Wiki updates

Infos

Active wiki users (last 30 days) 7/25,637

  • 4300 pages are deadend no wiki links in thoose pages
  • 1998 links requested but not found
  • almosts all page not categorized

People interested in

Eric Barboni (Skygo)

Sorting Page

Namespace

Why

May allow organization of "top" folder.

Netbeans wiki contains lots of page starting the same that may use namespace instead of "all page at root level".

  1. DevFaqFoo -> DevFaq:Foo
  2. TS_NN_FO -> TS:NN_FO
  3. FaqFoo -> Faq:Foo

... and so on...

How to

Doing so need some wiki configuration changes to have real namespace. Creating a page in namespace Bar with not setup like Bar:PaGe will create the page in the default namespace.

Create Bar and Bar talk namespace

$wgExtraNamespaces[500] = "Bar";
$wgExtraNamespaces[501] = "Bar_talk";
UPDATE page SET page_title = REPLACE(page_title, 'Bar:', ''),page_namespace = 500 WHERE page_title LIKE 'Bar:%' AND page_namespace=0

Categories

Why

Use this to tag any page of the wiki and a categorie page will link back to them. Category:TestSpecification:Obsolete will link all testspec that are tagged as obsolete.

Can be valueable for page in FAQ and DevFAQ, API Proposal and others

Categories can be hierachized

A page can have multiple categories.

How

[[Category:MyCat]] Add this to end of page (by convention) to make a page belonging to Category MyCat

Improving output

Templating

Issue 123123 roughtly 1000 links to issue in netbeans wiki instead of using template

some issue need comments, selector
some issue need to display the short text

This tutorial is NoGO GO for this tutorial

Citing

Allow referencing in more easy way.

Sample text,my ref will be printed there:<ref name="testreF1" />. And thats text.

<references> <ref name="testreF1">My ref text is there</ref> </references>

Tranclusion

Selective transclusion

Categories trees

This is an extension that may display page on categories on the form of tree.

Instead of editing FAQ Menu and FAQItem you may only have to create a FAQ and categorize them.


Upgrade to wiki

  • ParserFunctions (mandatory)
    • allows Selective transclusion
    • allows Template with some conditionnals
  • CategoryTree (helpfull but optionnal)
    • Make tree with category contents. May allow reverse creation of FAQ...
  • Cite.php (helpfull)
    • Easy to make references with less pain



WIP for non available yet parser function

  • NetbeansAggreator (early works)


Category for netbeans Plugins

Aim of this is to use a few categories as portal for netbeans offical plugins (such as Maven, Ant, ...)

kind of early static tests Category:Feature:Ant

This kind of pages more or less allready exists see: JavaEE

What I want to add to this is kind of automatic process that:

  • given a codenamebase: org.netbeans.modules.maven.kit
  • retrieve: Long Description
  • retrieve: Authors
  • retrieve: parse autoupdate.xml and retieve all dependencies and:
    • Also give bugzilla component (need mapping with mercurial repository and codename base)
    • Also give the mercurial repository the team used and also folder within repository (May help community)
    • (AFAIK mapping is not stored anywhere)
Codename base Bugzilla prefered Reposotory
org.netbeans.modules.ide.kit Bugzilla coordinate Mercurial Repository
org.netbeans.modules.javahelp Bugzilla coordinate Mercurial Repository

All docs, and faq and related may be added after that manualy if tutorial is not wiki or also my categorization.

To make more connexion plugins links in the IDE plugins dialogs may point to Category:Feature:Ant instead of www.netbeans.org


Work in progress. Need some more infos to make it nicer, upgraded Mediawiki that may be downloaded 1.16+ so I may adapt this


NetbeansAggregator.i18n.php

<?php
/**
 * Internationalization file.
 */
 
$magicWords = array();
 
$magicWords['en'] = array(
   'bugzillaprojects' => array( 0, 'bugzillaprojects' ),'nbm' => array( 0, 'nbm' ),
);


NetbeansAggregator.php

 
<?php
 
if (!defined('MEDIAWIKI')) {
    echo( "This is an extension to the MediaWiki package and cannot be run standalone.\n" );
    die(-1);
}
 
$wgExtensionCredits['parserhook'][] = array(
    'name' => 'NetbeansAggregator',
    'author' => 'Netbeans Fan',
    'url' => 'https://netbeans.org',
    'description' => 'This extension is an example and performs no discernible function',
    'version' => 1.0,
);
 
$wgHooks['ParserFirstCallInit'][] = 'wfNetbeansAggregatorSetup';
 
 
//$wgExtensionFunctions[] = 'wfNetbeansAggregatorSetup';
$wgExtensionMessagesFiles['NetbeansAggregator'] = dirname(__FILE__) . '/NetbeansAggregator.i18n.php';
 
function wfNetbeansAggregatorSetup(&$parser) {
    $parser->setFunctionHook('bugzillaprojects', 'wfBugzillaProjectsRender');
    $parser->setFunctionHook('nbm', 'wfNetbeansIssueRender');
    return true;
}
 
function appendbug($p, $c) {
    return 'https://netbeans.org/bugzilla/buglist.cgi?product=' . trim($p) . '&component=' . trim($c) . '&resolution=---';
}
 
function getBugzillaData() {
    $cache_file = dirname(__FILE__) . "/buginfo.txt";
    if (file_exists($cache_file) && (filemtime($cache_file) > (time() - 60 * 60 * 24))) {
        $file = file_get_contents($cache_file);
    } else {
        $file = file_get_contents('http://hg.netbeans.org/main-silver/raw-file/tip/.nbbugzilla-components');
        file_put_contents($cache_file, $file, LOCK_EX);
    }
    return $file;
}
 
function getAutoUpdateData() {
    $cache_file = dirname(__FILE__) . "/autoupdate.xml";
    if (file_exists($cache_file) && (filemtime($cache_file) > (time() - 60 * 60 * 24))) {
        $file = file_get_contents($cache_file);
    } else {
        $file = file_get_contents('http://deadlock.netbeans.org/job/nbms-and-javadoc/lastStableBuild/artifact/nbbuild/nbms/updates.xml');
        file_put_contents($cache_file, $file, LOCK_EX);
    }
    return $file;
}
 
function wfBugzillaProjectsRender($parser, $param1 = '') {
    $output = $parser->recursiveTagParse($param1);
    $homepage = getBugzillaData();
    $lines = explode("\n", $homepage);
    foreach ($lines as $line) {
        if (strpos($line, $output) !== false) {
            $bugs = explode("=", $line);
            $cp = explode("/", $bugs[1]);
            return appendbug($cp[0], $cp[1]);
        }
    }
    return "NOIssue";
}
 
function getCodenameBase($modulename, $xml) {
    $r = "";
    foreach ($xml->xpath("//manifest[@OpenIDE-Module='" . $modulename . "']/..") as $title) {
        $r .= "" . $title['codenamebase'];
    }
    return $r;
}
 
function translocate($tmp, $xml) {
    $lines = explode(",", $tmp);
    $t = "\n\n{{NBMHEAD}}\n";
    foreach ($lines as $line) {
        $it = explode(" ", trim($line));
        $t.="\n{{:NBMModules|transcludesection=" . getCodenameBase($it[0], $xml) . "}}";
    }
    return $t . "\n{{NBMSTOP}}";
//foreach ($xml->xpath("//manifest[@='" . $param1 . "']") as $title) {
}
 
function wfNetbeansIssueRender($parser, $param1 = '') {
    $output = $parser->recursiveTagParse($param1);
    $xml = simplexml_load_string(getAutoUpdateData());
    $tmp = "";
    foreach ($xml->xpath("//module[@codenamebase='" . $param1 . "']") as $title) {
        $b = "" . $title['codenamebase'];
        $tmp.= "\n===" . $b . "===\n";
        $tmp.= "'''Description''':\n\n";
        $a = "" . $title->children()[0]['OpenIDE-Module-Long-Description'];
        $a1 = preg_replace(array('"<a href=\"(.*?)\">"', '"</a>"'), array('[$1 ', ']'), $a);
        $a2 = preg_replace('"<p>"', '<br><br>', $a1);
        $tmp.=$a2;
        $tmp.= "\n\n'''Author''':";
        $a = "" . $title['moduleauthor'];
        $a = preg_replace(array('"<a href=\"(.*?)\">"', '"</a>"'), array('[$1 ', ']'), $a);
        $tmp.=$a;
        // OpenIDE-Module-Module-Dependencies;
        $dep = "" . $title->children()[0]['OpenIDE-Module-Module-Dependencies'];
        $tmp.=translocate($dep, $xml);
    }
    return array($tmp, 'noparse' => false);
}
Not logged in. Log in, Register

By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo