User:TaxonBot/adtarchive.tcl
} $todayM $adtline $tyear] }
set conts [conts t $wday x] set ltempl [regexp -all -inline -- {\{\{.*?\}\}} [ string map [list \{\{\{ {} \}\}\} {}] $conts ]]
foreach templ $ltempl { if { [string first "\{\{Wikipedia:Hauptseite/Artikel des Tages" $templ] > -1 && [string first "\{\{Wikipedia:Hauptseite/Artikel des Tages/" $templ] == -1 } { set ptempl [parse_templ $templ] set adtpage [dict get $ptempl LEMMA] set adttpage Diskussion:$adtpage set adttconts [conts t $adttpage 0] set vtempl [matchtemplate $adttpage {Vorlage:AdT-Vorschlag Hinweis}] set wtempl [matchtemplate $adttpage {Vorlage:War AdT}] if {$vtempl && !$wtempl} { regsub -- {\{\{AdT-Vorschlag Hinweis.*?\}\}} $adttconts "\{\{War AdT|1=$todayB\}\}" adttconts
- set conts1 [conts t $chron 1]
- puts $conts1
if {$tday == 1} { set adtline "\n* $today \[\[$adtpage\]\]" if {$tmonth eq {Januar}} { set chrontemp {Vorlage:Navigationsleiste Chronologien der Artikel des Tages} set chrontempconts [conts t $chrontemp x] set chrontempconts [string map [list \n\}\} " |\n\[\[$chron|$tyear\]\]\n\}\}"] [conts t $chrontemp x]] set ctzuq "Bot: Erweiterung um die \[\[$chron|Chronologie $tyear\]\]" puts [edit $chrontemp $ctzuq $chrontempconts / minor] set conts1 [chronpage0 $adtline] set czuq "Bot: heutiger Artikel des Tages: \[\[$adtpage\]\]" puts [edit $chron $czuq $conts1] } else { set conts1 [conts t $chron 1] set conts1 "=== $todayM ===$adtline\n\n$conts1" set czuq "Bot: heutiger Artikel des Tages: \[\[$adtpage\]\]" puts [edit $chron $czuq $conts1 / section 1 / minor] } } else { set conts1 [conts t $chron 1] regsub -- {\*} $conts1 "* $today \[\[$adtpage\]\]\n*" conts1 set czuq "Bot: heutiger Artikel des Tages: \[\[$adtpage\]\]" puts [edit $chron $czuq $conts1 / section 1 / minor] } } else { regsub -line -- {\{\{AdT-Vorschlag Hinweis.*} $adttconts {} adttconts regexp -line -nocase -- {\{\{War AdT.*} $adttconts wtempl set pwtempl [parse_templ $wtempl] foreach {key val} $pwtempl { if {[incr ikey] > 1} { append bwtempl |$key=$val } } set bwtempl "\{\{War AdT$bwtempl|$ikey=$todayB\}\}" set adttconts [string map [list $wtempl $bwtempl] $adttconts] set conts1 [conts t $chron 1] if {$tday == 1} { set adtline "\n* $today \[\[$adtpage\]\] (erneut)" if {$tmonth eq {Januar}} { set chrontemp {Vorlage:Navigationsleiste Chronologien der Artikel des Tages} set chrontempconts [conts t $chrontemp x] set chrontempconts [string map [list \n\}\} " |\n\[\[$chron|$tyear\]\]\n\}\}"] [conts t $chrontemp x]] set ctzuq "Bot: Erweiterung um die \[\[$chron|Chronologie $tyear\]\]" puts [edit $chrontemp $ctzuq $chrontempconts / minor] set conts1 [chronpage0 $adtline] set czuq "Bot: heutiger Artikel des Tages: \[\[$adtpage\]\] (erneut)" puts [edit $chron $czuq $conts1] } else { set conts1 [conts t $chron 1] set conts1 "=== $todayM ===$adtline\n\n$conts1" set czuq "Bot: heutiger Artikel des Tages: \[\[$adtpage\]\] (erneut)" puts [edit $chron $czuq $conts1 / section 1 / minor] } } else { set conts1 [conts t $chron 1] regsub -- {\*} $conts1 "* $today \[\[$adtpage\]\] (erneut)\n*" conts1 set czuq "Bot: heutiger Artikel des Tages: \[\[$adtpage\]\] (erneut)" puts [edit $chron $czuq $conts1 / section 1 / minor] } } set zuq "Bot: Artikel des Tages $todayB" puts [edit $adttpage $zuq [string trimleft $adttconts] / section 0 / minor] } }
set lerrorpueppen {} foreach adtpage $ladtpage { set lsect [get [ post $wiki {*}$parse / page $adtpage0/$adtpage / prop sections ] parse sections] foreach sect $lsect { dict with sect { if {$level == 2} { unset -nocomplain lemmadate sectconts regexp -- {\d{1,2}\.\d{2}.\d{4}} $line lemmadate if ![exists lemmadate] {set lemmadate {}} set sectconts [conts t $adtpage0/$adtpage $index] set ltempl [regexp -all -inline -- {\{\{.*?\}\}} [ string map [list \{\{\{ {} \}\}\} {}] $sectconts ]] foreach templ $ltempl { if {[string first {Hauptseite/Artikel des Tages} $templ] > -1} { set ptempl [parse_templ $templ] dict with ptempl { if {$LEMMA ni [dict keys $dsect] && $number < 4} { set scanDATUM [clock scan $DATUM -format %e.%m.%Y -timezone :Europe/Berlin -locale de] set scanlemmadate [clock scan $lemmadate -format %e.%m.%Y -timezone :Europe/Berlin -locale de] if {$scanDATUM != $scanlemmadate} { lappend lerrorpueppen "* \[\[$adtpage0/$adtpage#$line\]\]" } if ![exists scan0] { set scan0 [clock scan $todaye -format %e.%m.%Y -timezone :Europe/Berlin -locale de] set dateoffset 0 set stopoffset 0 } else { if {$scanDATUM - $scan0 < 4450000 && $fromtitle ne {Wikipedia_Diskussion:Hauptseite/Artikel_des_Tages/Vorschläge}} { if {$stopoffset == 2} { set dateoffset 0 } else { set dateoffset 50 set stopoffset 1 } } else { set dateoffset 0 if {$stopoffset == 1} { set stopoffset 2 } } } dict lappend dsect $LEMMA sdate $DATUM dateoffset $dateoffset from $fromtitle index $index line $line lemmadate $lemmadate } } } } } } } }
if {![empty lerrorpueppen] && [string first {AdT-Fehlerbericht Datum} [conts t {Benutzer Diskussion:Püppen} x]] == -1} {
set errorconts "Hallo Püppen, in [expr {[llength $lerrorpueppen] == 1 ? {folgendem Abschnitt} : {folgenden Abschnitten}}] habe ich einen Datumsfehler entdeckt, der korrigiert werden sollte:\n[join $lerrorpueppen \n]\nErst wenn Du diesen Diskussionsabschnitt entfernst, werden künftig, falls vorhanden, neue Fehlerberichte zugesandt.
${~}"
puts [edit {Benutzer Diskussion:Püppen} {AdT-Fehlerbericht Datum} $errorconts / section new]
}
foreach {lemma data} $dsect { set refc 0 catch { dict with data { set scandate [clock scan $lemmadate -format %e.%m.%Y] } if {[clock scan $today -format %d.%m.%Y] > $scandate} { set refy [clock format $scandate -format %Y] foreach ref [list 04.$refy 07.$refy 10.$refy 01.[expr $refy + 1]] { if {$scandate < [clock scan 01.$ref -format %d.%m.%Y]} { set archtgt $refy/Q[incr refc] break } else { incr refc } } dict lappend darch larch $scandate $index [set sectconts [conts t $from $index]] dict lappend darch $from $sectconts } } }
if [exists darch] { dict with darch { set lsortlarch [lsort -integer -stride 3 -index 0 [ lsort -integer -stride 3 -index 1 $larch ]] foreach {-- -- conts} $lsortlarch { lappend larchconts $conts } set q "$adtpage0/Archiv/Vorschläge/$archtgt" set iarch [llength $larchconts] set zuq "Bot: Archivierung von $iarch Abschnitt[expr {$iarch > 1 ? "en" : {}}]" puts [edit $q $zuq {} / appendtext \n\n[join $larchconts \n\n]] foreach {key lval} [lrange $darch 2 end] { set conts [conts t $key x] foreach val $lval { set conts [string map [list \n$val\n {}] $conts] } }
set lueconts {} foreach {lemma ddata} $dsect { dict with ddata { if {$dateoffset == 50} { lappend lueconts [conts t $from $index] dict lappend dueconts $from [conts t $from $index] } } } set iue [llength $lueconts] if ![empty lueconts] { set conts [string map [ list {= Ende der Liste} "[join $lueconts \n\n]\n\n= Ende der Liste" ] $conts] } switch $iue { 0 {set appendue ""} 1 {set appendue " + Übertragung $iue neuen Vorschlags"} default {set appendue " + Übertragung $iue neuer Vorschläge"} } set zuq "Bot: Archivierung von $iarch Abschnitt[expr {$iarch > 1 ? "en" : {}}]$appendue" puts [edit $key $zuq $conts] set zuq "Bot: Übertragung neuer Vorschläge nach \[\[$adtpage0/Vorschläge\]\]" foreach {ue lueconts} $dueconts { set conts [conts t $ue x] foreach ueconts $lueconts { set conts [string map [list \n$ueconts\n {}] $conts] } puts [edit $ue $zuq $conts] } } }
set ltc [dict values [regexp -all -line -inline -- {\[\[(.*)\]\]} [conts t $chron x]]] set llc [dict values [regexp -all -line -inline -- {\[\[(.*)\]\]} [conts t $lchron x]]] set lcc [join [list [lrange $ltc 0 end-1] [lrange $llc 0 end-1]]] foreach cc [lrange $lcc 0 4] { lappend lpcc Diskussion:$cc } puts [get [post $wiki {*}$format / action purge / titles [join $lpcc |] / forcerecursivelinkupdate 1]]
set lang test ; source langwiki.tcl ; #set token [login $wiki] puts [edid 63277 {Log: AdT-Archive} {} / appendtext "\n* [clock format [clock seconds] -format %Y-%m-%dT%TZ] AdT-Archive: Task finished!" / minor]
exec ./adtneu.tcl $ladtpage >> adtneu.out 2>@1
</source> -->