<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://test1.pbc.xxx/w/index.php?action=history&amp;feed=atom&amp;title=Module%3ABioboxDatabases</id>
	<title>Module:BioboxDatabases - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://test1.pbc.xxx/w/index.php?action=history&amp;feed=atom&amp;title=Module%3ABioboxDatabases"/>
	<link rel="alternate" type="text/html" href="https://test1.pbc.xxx/w/index.php?title=Module:BioboxDatabases&amp;action=history"/>
	<updated>2026-05-01T17:43:56Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.44.2</generator>
	<entry>
		<id>https://test1.pbc.xxx/w/index.php?title=Module:BioboxDatabases&amp;diff=2970&amp;oldid=prev</id>
		<title>PeaceDeadC: Created page with &quot;local p = {}  local databasesModule = require(&#039;Module:BioboxDatabases/databases&#039;) local databases = databasesModule.databases local databaseOrder = databasesModule.databaseOrder  local PBD = require(&#039;Module:PBD&#039;) local PBDIB = require(&#039;Module:PornBaseDataIB&#039;)  local function isEmpty(value)     return value == nil or value == &#039;&#039; end  local function formatField(state, label, value, fieldName, rowIndex)     if isEmpty(value) then         return &#039;&#039;     end          local row...&quot;</title>
		<link rel="alternate" type="text/html" href="https://test1.pbc.xxx/w/index.php?title=Module:BioboxDatabases&amp;diff=2970&amp;oldid=prev"/>
		<updated>2025-03-19T00:07:00Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;local p = {}  local databasesModule = require(&amp;#039;Module:BioboxDatabases/databases&amp;#039;) local databases = databasesModule.databases local databaseOrder = databasesModule.databaseOrder  local PBD = require(&amp;#039;Module:PBD&amp;#039;) local PBDIB = require(&amp;#039;Module:PornBaseDataIB&amp;#039;)  local function isEmpty(value)     return value == nil or value == &amp;#039;&amp;#039; end  local function formatField(state, label, value, fieldName, rowIndex)     if isEmpty(value) then         return &amp;#039;&amp;#039;     end          local row...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;local p = {}&lt;br /&gt;
&lt;br /&gt;
local databasesModule = require(&amp;#039;Module:BioboxDatabases/databases&amp;#039;)&lt;br /&gt;
local databases = databasesModule.databases&lt;br /&gt;
local databaseOrder = databasesModule.databaseOrder&lt;br /&gt;
&lt;br /&gt;
local PBD = require(&amp;#039;Module:PBD&amp;#039;)&lt;br /&gt;
local PBDIB = require(&amp;#039;Module:PornBaseDataIB&amp;#039;)&lt;br /&gt;
&lt;br /&gt;
local function isEmpty(value)&lt;br /&gt;
    return value == nil or value == &amp;#039;&amp;#039;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local function formatField(state, label, value, fieldName, rowIndex)&lt;br /&gt;
    if isEmpty(value) then&lt;br /&gt;
        return &amp;#039;&amp;#039;&lt;br /&gt;
    end&lt;br /&gt;
    &lt;br /&gt;
    local rowStyle = state:getRowStyle(rowIndex)&lt;br /&gt;
    &lt;br /&gt;
    return string.format(&amp;#039;|-\n! style=&amp;quot;%s %s&amp;quot; | \&amp;#039;\&amp;#039;\&amp;#039;%s\&amp;#039;\&amp;#039;\&amp;#039;\n| style=&amp;quot;%s text-align:left; max-width: 100px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis;&amp;quot; | %s&amp;#039;, &lt;br /&gt;
        rowStyle,&lt;br /&gt;
        state.STYLES.LABEL,&lt;br /&gt;
        label,&lt;br /&gt;
        rowStyle,&lt;br /&gt;
        value)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function collectParametersWithSuffixes(args, paramBase, maxCount)&lt;br /&gt;
    local values = {}&lt;br /&gt;
    maxCount = tonumber(maxCount) or 4&lt;br /&gt;
&lt;br /&gt;
    for i = 1, maxCount do&lt;br /&gt;
        local suffix = i &amp;gt; 1 and i or &amp;quot;&amp;quot;&lt;br /&gt;
        local paramName = paramBase .. suffix&lt;br /&gt;
        if not isEmpty(args[paramName]) then&lt;br /&gt;
            table.insert(values, args[paramName])&lt;br /&gt;
        end&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    return values&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function p.formatDatabase(state, args, databaseConfig, rowIndex)&lt;br /&gt;
    local section = {}&lt;br /&gt;
    local values = {}&lt;br /&gt;
&lt;br /&gt;
    if databaseConfig.paramBase then&lt;br /&gt;
        values = collectParametersWithSuffixes(&lt;br /&gt;
            args,&lt;br /&gt;
            databaseConfig.paramBase,&lt;br /&gt;
            databaseConfig.maxCount&lt;br /&gt;
        )&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    if #values == 0 and args.qid then&lt;br /&gt;
        local entity = mw.wikibase.getEntity(args.qid)&lt;br /&gt;
        if databaseConfig.pbdProps then&lt;br /&gt;
            for _, pbdProp in ipairs(databaseConfig.pbdProps) do&lt;br /&gt;
                if entity and entity.claims and entity.claims[pbdProp] then&lt;br /&gt;
                    if databaseConfig.name == &amp;quot;iafd&amp;quot; and #values &amp;gt; 0 and pbdProp == &amp;quot;P169&amp;quot; then&lt;br /&gt;
                        break&lt;br /&gt;
                    end&lt;br /&gt;
                    &lt;br /&gt;
                    for _, statement in ipairs(entity.claims[pbdProp]) do&lt;br /&gt;
                        if statement.mainsnak.snaktype == &amp;quot;value&amp;quot; and &lt;br /&gt;
                           statement.mainsnak.datavalue then&lt;br /&gt;
                            local id&lt;br /&gt;
                            if statement.mainsnak.datavalue.type == &amp;quot;string&amp;quot; then&lt;br /&gt;
                                id = statement.mainsnak.datavalue.value&lt;br /&gt;
                            elseif statement.mainsnak.datavalue.type == &amp;quot;wikibase-entityid&amp;quot; then&lt;br /&gt;
                                id = statement.mainsnak.datavalue.value.id&lt;br /&gt;
                            end&lt;br /&gt;
                            &lt;br /&gt;
                            if id then&lt;br /&gt;
                                if pbdProp == &amp;quot;P16&amp;quot; and not id:match(&amp;quot;^nm&amp;quot;) then&lt;br /&gt;
                                    id = &amp;quot;nm&amp;quot; .. id&lt;br /&gt;
                                end&lt;br /&gt;
                                &lt;br /&gt;
                                table.insert(values, {id = id, pbdProp = pbdProp})&lt;br /&gt;
                            end&lt;br /&gt;
                        end&lt;br /&gt;
                    end&lt;br /&gt;
                end&lt;br /&gt;
            end&lt;br /&gt;
        end&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    if #values &amp;gt; 0 then&lt;br /&gt;
        local displayValues = {}&lt;br /&gt;
        &lt;br /&gt;
        for _, entry in ipairs(values) do&lt;br /&gt;
            local id, pbdProp&lt;br /&gt;
            if type(entry) == &amp;quot;table&amp;quot; then&lt;br /&gt;
                id = entry.id&lt;br /&gt;
                pbdProp = entry.pbdProp&lt;br /&gt;
            else&lt;br /&gt;
                id = entry&lt;br /&gt;
            end&lt;br /&gt;
            &lt;br /&gt;
            local urlFormat = databaseConfig.urlFormat&lt;br /&gt;
            &lt;br /&gt;
            if databaseConfig.name == &amp;quot;iafd&amp;quot; then&lt;br /&gt;
                if id:match(&amp;quot;^%x+%-%x+%-%x+%-%x+%-%x+$&amp;quot;) then&lt;br /&gt;
                    urlFormat = &amp;quot;https://www.iafd.com/person.rme/id=%s&amp;quot;&lt;br /&gt;
                else&lt;br /&gt;
                    urlFormat = &amp;quot;https://www.iafd.com/person.rme/perfid=%s/gender=m&amp;quot;&lt;br /&gt;
                end&lt;br /&gt;
            end&lt;br /&gt;
            &lt;br /&gt;
            if databaseConfig.name == &amp;quot;imdb&amp;quot; then&lt;br /&gt;
                if not id:match(&amp;quot;^nm%d+$&amp;quot;) then&lt;br /&gt;
                    id = &amp;quot;nm&amp;quot; .. id&lt;br /&gt;
                end&lt;br /&gt;
            end&lt;br /&gt;
            &lt;br /&gt;
            local displayValue = string.format(&amp;#039;[%s %s]&amp;#039;, urlFormat:format(id), id:gsub(&amp;quot;^nm&amp;quot;, &amp;quot;&amp;quot;))&lt;br /&gt;
            table.insert(displayValues, displayValue)&lt;br /&gt;
        end&lt;br /&gt;
        &lt;br /&gt;
        local combinedDisplay = table.concat(displayValues, &amp;#039;&amp;lt;br&amp;gt;&amp;#039;)&lt;br /&gt;
&lt;br /&gt;
        local label&lt;br /&gt;
        if databaseConfig.labelFunc then&lt;br /&gt;
            label = databaseConfig.labelFunc()&lt;br /&gt;
        else&lt;br /&gt;
            local frame = mw.getCurrentFrame()&lt;br /&gt;
            label = frame:expandTemplate{ title = &amp;#039;abbr&amp;#039;, args = { databaseConfig.abbr, databaseConfig.label } }&lt;br /&gt;
        end&lt;br /&gt;
        &lt;br /&gt;
        section[#section + 1] = formatField(state, label, combinedDisplay, databaseConfig.name, rowIndex)&lt;br /&gt;
        rowIndex = rowIndex + 1&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    return section, rowIndex&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function p.formatDatabasesSection(state, args, rowIndex)&lt;br /&gt;
    local section = {}&lt;br /&gt;
    local databaseSections = {}&lt;br /&gt;
    local hasAny = false&lt;br /&gt;
&lt;br /&gt;
    for _, databaseName in ipairs(databaseOrder) do&lt;br /&gt;
        local config = databases[databaseName]&lt;br /&gt;
        if config then&lt;br /&gt;
            local databaseSection, newRowIndex = p.formatDatabase(state, args, config, rowIndex)&lt;br /&gt;
            if #databaseSection &amp;gt; 0 then&lt;br /&gt;
                hasAny = true&lt;br /&gt;
                for _, line in ipairs(databaseSection) do&lt;br /&gt;
                    databaseSections[#databaseSections + 1] = line&lt;br /&gt;
                end&lt;br /&gt;
                rowIndex = newRowIndex&lt;br /&gt;
            end&lt;br /&gt;
        end&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    if hasAny then&lt;br /&gt;
        section[#section + 1] = string.format(&amp;#039;|-\n! colspan=&amp;quot;2&amp;quot; %s | \&amp;#039;\&amp;#039;\&amp;#039;Databases\&amp;#039;\&amp;#039;\&amp;#039;&amp;#039;, state.STYLES.SECTION_HEADER)&lt;br /&gt;
        for _, line in ipairs(databaseSections) do&lt;br /&gt;
            section[#section + 1] = line&lt;br /&gt;
        end&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    return section, rowIndex&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
return p&lt;/div&gt;</summary>
		<author><name>PeaceDeadC</name></author>
	</entry>
</feed>