Zeile 18: |
Zeile 18: |
| if Pagename == nil then return nil end | | if Pagename == nil then return nil end |
| local returnString = "" | | local returnString = "" |
− | local queryResult = mw.smw.ask('[['..Pagename..']]|?Seitentyp|?Basistyp|mainlabel=-') | + | local queryResult = mw.smw.ask('[['..Pagename..']]|?Seitentyp|?Basistyp|?Hauptkategorie|mainlabel=-') |
| if queryResult == nil then return nil end | | if queryResult == nil then return nil end |
| local Seitentyp = queryResult[1]['Seitentyp'] | | local Seitentyp = queryResult[1]['Seitentyp'] |
| + | |
| local Basistyp = nil | | local Basistyp = nil |
− | if queryResult[1]['Basistyp'] ~= nil | + | if queryResult[1]['Basistyp'] ~= nil |
| then | | then |
| Basistyp = queryResult[1]['Basistyp'] | | Basistyp = queryResult[1]['Basistyp'] |
| Basistyp = string.gsub(Basistyp, "%s+", "_") | | Basistyp = string.gsub(Basistyp, "%s+", "_") |
− | end
| + | end |
| + | |
| + | local Hauptkategorie = nil |
| + | if queryResult[1]['Hauptkategorie'] ~= nil |
| + | then |
| + | Hauptkategorie = queryResult[1]['Hauptkategorie'] |
| + | Hauptkategorie = string.gsub(Hauptkategorie, "%s+", "_") |
| + | end |
| --teste ob Seitentyp Kategorie | | --teste ob Seitentyp Kategorie |
| if Seitentyp == 'Kategorie' | | if Seitentyp == 'Kategorie' |
Zeile 42: |
Zeile 50: |
| if Basistyp ~= nil | | if Basistyp ~= nil |
| then | | then |
− | -- teste ob Liste_Pagename vorhanden ist | + | -- teste ob Liste_Basistyp vorhanden ist |
| local Vorlage = mw.title.new('Liste_'..Basistyp, 'Vorlage' ) | | local Vorlage = mw.title.new('Liste_'..Basistyp, 'Vorlage' ) |
| if Vorlage ~= nil | | if Vorlage ~= nil |
| then | | then |
| returnString = mw.getCurrentFrame():expandTemplate{title ="Liste_"..Basistyp} | | returnString = mw.getCurrentFrame():expandTemplate{title ="Liste_"..Basistyp} |
| + | return returnString |
| + | end |
| + | --teste ob Liste_Hauptkategrie vorhanden, wenn ja diese nutzen |
| + | local Vorlage = mw.title.new('Liste_'..Hauptkategorie, 'Vorlage' ) |
| + | if Vorlage ~= nil |
| + | then |
| + | returnString = mw.getCurrentFrame():expandTemplate{title ="Liste_"..Hauptkategorie} |
| return returnString | | return returnString |
| end | | end |