testo = '';
from = 401;
to = 500;
title = '';
for (i = from; i <= to; i++) {
title += '|Pagina:Raccolta di poesie in dialetto veneziano 1845.djvu/' + i;
}
new mw.Api().get({
action: 'query',
prop: 'revisions',
rvprop: 'content',
format: 'json',
titles: title,
}).done(function (data) {
pages = Object.entries(data.query.pages);
pages = pages.sort((a,b) => (a['1'].title > b['1'].title) ? 1 : ((b['1'].title > a['1'].title) ? -1 : 0));
for (i = 0; i < pages.length; i++) {
console.log(pages[i]['1'].title);
element = pages[i]['1'];
if (element.revisions) {
t = element.revisions[0]['*'];
t = t.replace(/<noinclude>\n<references\/><\/noinclude>/g, '')
.replace(/<noinclude><pagequality level=".*" user=".*" \/><\/noinclude>/g, '')
.replace(/<section begin="?\S+"?\s*\/>/g, '')
.replace(/<section end="?\S+"?\s*\/>/g, '')
.replace(/<\/?noinclude>/g, '')
.replace("{{Colona}}", "")
.replace("{{AltraColona}}", "")
.replace("{{FineColona}}", "")
testo += t;
}
};
});