User:Kevin Reid/Task list updater.e: Difference between revisions

From Rosetta Code
Content added Content deleted
(Created page with "<lang e>#!/usr/bin/env rune pragma.syntax("0.9") pragma.enable("accumulator") def [lang] := interp.getArgs() def unimpURL := <http>[`//rosettacode.org/wiki/Reports:Tasks_not_im...")
 
m (lil bugfix for when it has no work to do)
Line 30: Line 30:
completed with= line
completed with= line
} else {
} else {
if (inClassifySection) {
if (inClassifySection && toAdd.size().aboveZero()) {
var add := toAdd.getElements()[0]
var add := toAdd.getElements()[0]
if (add < title) {
if (add < title) {
Line 37: Line 37:
}
}
}
}
if (inCompleted) {
if (inCompleted && completed.size().aboveZero()) {
var add := completed.getElements()[0]
var add := completed.getElements()[0]
if (add < line) {
if (add < line) {

Revision as of 02:08, 31 January 2011

<lang e>#!/usr/bin/env rune pragma.syntax("0.9") pragma.enable("accumulator")

def [lang] := interp.getArgs()

def unimpURL := <http>[`//rosettacode.org/wiki/Reports:Tasks_not_implemented_in_$lang`] def catURL := <http>[`//rosettacode.org/mw/index.php?title=User:Kevin_Reid/E_tasks&action=raw`]

def unimpText := unimpURL.getText() def catText := catURL.getText()

  1. kludgy...

def unimps := accum [].asSet() for rx`.*?

  • <a href=".*?" title=".*?">(@title.*?)</a>
  • .*` in unimpText.split("id=\"Not_Considered\"")[0].split("\n") { _.with(title) } def catOut := stdout var toAdd := unimps.sort() var completed := [].asSet() var inCompleted := false var inClassifySection := false for line in catText.split("\n") { switch (line) { match rx`\* \[\[(@title.*?)\]\](@note.*)` { toAdd without= title if (!unimps.contains(title) && note.startOf("improve") == -1 && note.startOf("omit") == -1) { # now implemented, so don't print completed with= line } else { if (inClassifySection && toAdd.size().aboveZero()) { var add := toAdd.getElements()[0] if (add < title) { catOut.println(`* $add`) toAdd without= add } } if (inCompleted && completed.size().aboveZero()) { var add := completed.getElements()[0] if (add < line) { catOut.println(line) completed without= add } } catOut.println(line) } } match rx`\s*\s*` { inCompleted := true completed sort= () catOut.println(line) } match rx`\s*\s*` { inCompleted := false for line in completed.sort() { catOut.println(line) } completed := [].asSet() catOut.println(line) } match rx`` { inClassifySection := true catOut.println(line) } match rx`` { inClassifySection := false for title in toAdd.sort() { catOut.println(`* $title`) } catOut.println(line) } match _ { catOut.println(line) } } }</lang>