Package org.luaj.vm2.ast

Examples of org.luaj.vm2.ast.Name


        return "mw.title";
    }

    @Override
    public LuaTable getInterface() {
        LuaTable table = new LuaTable();
        table.set("newTitle", newTitle());
        table.set("makeTitle", makeTitle());
        table.set("getUrl", getUrl());
        table.set("getContent", getContent());
        table.set("fileExists", fileExists());
        table.set("protectionLevels", defaultFunction());
        return table;
    }
View Full Code Here


        };
    }

    @Override
    public LuaValue getSetupOptions() {
        LuaTable table = new LuaTable();
        table.set("thisTitle", title());
        table.set("NS_MEDIA", MEDIA_NAMESPACE_KEY.code);
        return table;
    }
View Full Code Here

            LuaValue.valueOf("fragment"),
            LuaValue.valueOf("interwiki"));
    }

    private LuaValue title(LuaValue ns, LuaValue title, LuaValue fragment, LuaValue interwiki) {
        LuaTable table = new LuaTable();
        table.set("isLocal", "");
        table.set("isRedirect", "");
        table.set("subjectNsText", "");
        table.set("interwiki", interwiki);
        table.set("namespace", LuaValue.valueOf(MAIN_NAMESPACE_KEY.code));
        table.set("nsText", "");
        table.set("text", "");
        table.set("id", title);
        table.set("fragment", fragment);
        table.set("contentModel", "");
        table.set("thePartialUrl", "");
        return table;
    }
View Full Code Here

        return "mw.ustring";
    }

    @Override
    public LuaTable getInterface() {
        return new LuaTable();
    }
View Full Code Here

        return new LuaTable();
    }

    @Override
    public LuaValue getSetupOptions() {
        LuaTable table = new LuaTable();
        // https://www.mediawiki.org/wiki/Manual:$wgMaxArticleSize
        // stringLengthLimit = $wgMaxArticleSize * 1024;
        table.set("stringLengthLimit"2048 * 1024);
        table.set("patternLengthLimit", 10000);
        return table;
    }
View Full Code Here

        return "mw.site";
    }

    @Override
    public LuaTable getInterface() {
        LuaTable table = new LuaTable();
        table.set("getNsIndex", getNsIndex());
        table.set("pagesInCategory", pagesInCategory());
        table.set("pagesInNamespace", pagesInNamespace());
        table.set("usersInGroup", usersInGroup());
        return table;
    }
View Full Code Here

        };
    }

    @Override
    public LuaValue getSetupOptions() {
        LuaTable table = new LuaTable();
        table.set("siteName", "test");      // $GLOBALS['wgSitename'],
        table.set("server", "server");      // $GLOBALS['wgServer'],
        table.set("scriptPath", "");        // $GLOBALS['wgScriptPath'],
        table.set("stylePath""");        // $GLOBALS['wgStylePath'],
        table.set("currentVersion", "1.0"); // SpecialVersion::getVersion(),
        table.set("stats", stats());
        table.set("namespaces", namespaces());
        return table;
    }
View Full Code Here

        table.set("namespaces", namespaces());
        return table;
    }

    private LuaTable stats() {
        LuaTable stats = new LuaTable();

        stats.set("pages", 0);        // (int)SiteStats::pages(),
        stats.set("articles", 0);     // (int)SiteStats::articles(),
        stats.set("files", 0);        // (int)SiteStats::images(),
        stats.set("edits", 0);        // (int)SiteStats::edits(),
        stats.set("views", NIL);      // $wgDisableCounters ? null : (int)SiteStats::views(),
        stats.set("users", 0);        // (int)SiteStats::users(),
        stats.set("activeUsers", 0)// (int)SiteStats::activeUsers(),
        stats.set("admins", 0);       // (int)SiteStats::numberingroup( 'sysop' ),
        return stats;
    }
View Full Code Here

        stats.set("admins", 0);       // (int)SiteStats::numberingroup( 'sysop' ),
        return stats;
    }

    private LuaTable namespaces() {
        LuaTable table = new LuaTable();
        for (INamespace.NamespaceCode code : INamespace.NamespaceCode.values()) {
            INamespaceValue namespaceValue = wikiModel.getNamespace().getNamespaceByNumber(code);
            table.set(code.code, luaDataForNamespace(namespaceValue));
        }
        return table;
    }
View Full Code Here

        }
        return table;
    }

    private LuaTable luaDataForNamespace(INamespaceValue namespaceValue) {
        LuaTable ns = new LuaTable();
        ns.set("id", namespaceValue.getCode().code);
        ns.set("name", namespaceValue.getPrimaryText().replace('_', ' '));
        ns.set("canonicalName", namespaceValue.getCanonicalName().replace('_', ' '));
        ns.set("hasSubpages", LuaValue.valueOf(namespaceValue.hasSubpages()));
        ns.set("hasGenderDistinction", LuaValue.valueOf(namespaceValue.hasGenderDistinction()));
        ns.set("isCapitalized", LuaValue.valueOf(namespaceValue.isCapitalized()));
        ns.set("isContent", LuaValue.valueOf(namespaceValue.isContent()));
        ns.set("isIncludable", LuaValue.valueOf(namespaceValue.isIncludable()));
        ns.set("isMovable", LuaValue.valueOf(namespaceValue.isMovable()));
        ns.set("isSubject", LuaValue.valueOf(namespaceValue.isSubject()));
        ns.set("isTalk", LuaValue.valueOf(namespaceValue.isTalk()));
        ns.set("defaultContentModel", NIL);

        LuaValue[] aliases = new LuaValue[namespaceValue.getTexts().size()-1];
        for (int i=0; i<namespaceValue.getTexts().size()-1; i++) {
            aliases[i] = LuaValue.valueOf(namespaceValue.getTexts().get(i+1));
        }
        ns.set("aliases", LuaValue.listOf(aliases));

        if (namespaceValue.getCode().code >= INamespace.NamespaceCode.MAIN_NAMESPACE_KEY.code) {
            ns.set("subject",    namespaceValue.getContentspace().getCode().code);
            ns.set("talk",       namespaceValue.getTalkspace().getCode().code);
            Namespace.NamespaceValue associated = namespaceValue.getAssociatedspace();
            if (associated != null) {
                ns.set("associated", associated.getCode().code);
            } else {
                ns.set("associated", NIL);
            }
        } else {
            ns.set("subject", namespaceValue.getCode().code);
        }
        return ns;
    }
View Full Code Here

TOP

Related Classes of org.luaj.vm2.ast.Name

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.