Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into move_to_libzim7
Browse files Browse the repository at this point in the history
  • Loading branch information
kelvinhammond committed Aug 7, 2022
2 parents 90c950e + f9e807a commit aed33e7
Show file tree
Hide file tree
Showing 7 changed files with 36 additions and 29 deletions.
7 changes: 7 additions & 0 deletions Changelog
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
1.11.12:
* FIX: ZIM illustration now always in PNG format
* FIX: Somehow cropped ZIM illustration
* NEW: Add support for mw:File typeof
* NEW: Use keep-alive TCP flag
* UPDATE: Redis 8 & Node 18 in Docker image

1.11.11:
* FIX: Workaround wrong Wep mime-type returns sporadically by Mediawiki
* UPDATE: Better speed computation
Expand Down
23 changes: 2 additions & 21 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "mwoffliner",
"version": "1.11.11",
"version": "1.11.12",
"description": "Mediawiki ZIM scraper",
"main": "lib/mwoffliner.lib.js",
"license": "GPL-3.0",
Expand Down
27 changes: 24 additions & 3 deletions res/content.parsoid.css
Original file line number Diff line number Diff line change
Expand Up @@ -51,18 +51,21 @@ sub {
* Block media items
*/

figure[typeof*='mw:File'],
figure[typeof*='mw:Image'],
figure[typeof*='mw:Video'],
figure[typeof*='mw:Audio'] {
margin: 0;
}

figure[typeof*='mw:File'] a,
figure[typeof*='mw:Image'] a,
figure[typeof*='mw:Video'] a,
figure[typeof*='mw:Audio'] a {
border: 0;
}

figure[typeof*='mw:File'].mw-halign-right,
figure[typeof*='mw:Image'].mw-halign-right,
figure[typeof*='mw:Video'].mw-halign-right,
figure[typeof*='mw:Audio'].mw-halign-right {
Expand All @@ -74,6 +77,7 @@ figure[typeof*='mw:Audio'].mw-halign-right {
float: right;
}

figure[typeof*='mw:File'].mw-halign-left,
figure[typeof*='mw:Image'].mw-halign-left,
figure[typeof*='mw:Video'].mw-halign-left,
figure[typeof*='mw:Audio'].mw-halign-left {
Expand All @@ -85,6 +89,7 @@ figure[typeof*='mw:Audio'].mw-halign-left {
float: left;
}

figure[typeof*='mw:File'].mw-halign-none,
figure[typeof*='mw:Image'].mw-halign-none,
figure[typeof*='mw:Video'].mw-halign-none,
figure[typeof*='mw:Audio'].mw-halign-none {
Expand All @@ -93,6 +98,7 @@ figure[typeof*='mw:Audio'].mw-halign-none {
float: none;
}

figure[typeof*='mw:File'].mw-halign-center,
figure[typeof*='mw:Image'].mw-halign-center,
figure[typeof*='mw:Video'].mw-halign-center,
figure[typeof*='mw:Audio'].mw-halign-center {
Expand All @@ -102,6 +108,7 @@ figure[typeof*='mw:Audio'].mw-halign-center {
float: none;
}

figure[typeof*='mw:File']>figcaption,
figure[typeof*='mw:Image']>figcaption,
figure[typeof*='mw:Video']>figcaption,
figure[typeof*='mw:Audio']>figcaption {
Expand All @@ -120,16 +127,19 @@ figure[typeof*='mw:Audio']>figcaption {
background-color: #f8f9fa;
}

figure[typeof*='mw:File']>figcaption table,
figure[typeof*='mw:Image']>figcaption table,
figure[typeof*='mw:Video']>figcaption table,
figure[typeof*='mw:Audio']>figcaption table {
/* reset caption side for tables inside figcaptions */
caption-side: top;
}

figure[typeof~='mw:File/Thumb'],
figure[typeof~='mw:Image/Thumb'],
figure[typeof~='mw:Video/Thumb'],
figure[typeof~='mw:Audio/Thumb'],
figure[typeof~='mw:File/Frame'],
figure[typeof~='mw:Image/Frame'],
figure[typeof~='mw:Video/Frame'],
figure[typeof~='mw:Audio/Frame'] {
Expand All @@ -145,12 +155,20 @@ figure[typeof~='mw:Audio/Frame'] {
float: right;
}

figure[typeof~='mw:File/Thumb']>*:first-child>img,
figure[typeof~='mw:File/Thumb']>*:first-child>video,
figure[typeof~='mw:File/Thumb']>*:first-child>audio,
figure[typeof~='mw:Image/Thumb']>*:first-child>img,
figure[typeof~='mw:Video/Thumb']>*:first-child>video,
figure[typeof~='mw:Audio/Thumb']>*:first-child>video,
figure[typeof~='mw:Audio/Thumb']>*:first-child>audio,
figure[typeof~='mw:File/Frame']>*:first-child>img,
figure[typeof~='mw:File/Frame']>*:first-child>video,
figure[typeof~='mw:File/Frame']>*:first-child>audio,
figure[typeof~='mw:Image/Frame']>*:first-child>img,
figure[typeof~='mw:Video/Frame']>*:first-child>video,
figure[typeof~='mw:Audio/Frame']>*:first-child>video {
figure[typeof~='mw:Audio/Frame']>*:first-child>video,
figure[typeof~='mw:Audio/Frame']>*:first-child>audio {
border: 1px solid #c8ccd1;
margin: 3px;
background: #fff;
Expand All @@ -159,17 +177,20 @@ figure[typeof~='mw:Audio/Frame']>*:first-child>video {
/* Same as img.thumbborder in content.css */

.mw-image-border>*:first-child>img,
.mw-image-border>*:first-child>video {
.mw-image-border>*:first-child>video,
.mw-image-border>*:first-child>audio {
border: 1px solid #eaecf0;
}

/* Hide the caption for frameless and plain floated images */

figure[typeof~='mw:File/Frameless']>figcaption,
figure[typeof~='mw:Image/Frameless']>figcaption,
figure[typeof~='mw:Video/Frameless']>figcaption,
figure[typeof~='mw:Audio/Frameless']>figcaption,
figure[typeof~='mw:File']>figcaption,
figure[typeof~='mw:Image']>figcaption,
figure[typeof~='mw:Video']>figcaption,
figure[typeof~='mw:Audio']>figcaption {
display: none;
}
}
3 changes: 1 addition & 2 deletions src/mwoffliner.lib.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,7 @@ async function execute(argv: any) {
optimisationCacheUrl,
noLocalParserFallback,
forceLocalParser,
customFlavour,
zstd,
customFlavour
} = argv;

(process as any).verbose = !!verbose;
Expand Down
1 change: 0 additions & 1 deletion src/parameterList.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,4 @@ export const parameterDescriptions = {
osTmpDir: 'Override default operating system temporary directory path environment variable',
customFlavour: 'A custom processor that can filter and process articles (see extensions/*.js)',
optimisationCacheUrl: 'S3 url, including credentials and bucket name',
zstd: 'Use Zstandard as ZIM compression (Zstd by default, left for backwards compatability)',
};
2 changes: 1 addition & 1 deletion src/util/saveArticles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -694,7 +694,7 @@ export async function treatMedias(parsoidDoc: DominoElement, mw: MediaWiki, dump

/* Improve image frames */
const figures = parsoidDoc.getElementsByTagName('figure');
const spans = parsoidDoc.querySelectorAll('span[typeof=mw:Image/Frameless]');
const spans = parsoidDoc.querySelectorAll('span[typeof~=mw:Image/Frameless],span[typeof~=mw:File/Frameless]');
const imageNodes = Array.prototype.slice.call(figures).concat(Array.prototype.slice.call(spans));
for (const imageNode of imageNodes) {
treatImageFrames(mw, dump, parsoidDoc, imageNode);
Expand Down

0 comments on commit aed33e7

Please sign in to comment.