mirror of
https://github.com/gnosygnu/xowa.git
synced 2024-09-29 23:10:52 +00:00
Mw_parse: Start porting Title
This commit is contained in:
parent
85f05bfd02
commit
fdf6c49a05
4829
400_xowa/src/gplx/xowa/mws/Xomw_Title.java
Normal file
4829
400_xowa/src/gplx/xowa/mws/Xomw_Title.java
Normal file
File diff suppressed because it is too large
Load Diff
@ -22,7 +22,7 @@ import gplx.xowa.mws.parsers.lnkis.*;
|
|||||||
import gplx.xowa.mws.filerepo.file.*;
|
import gplx.xowa.mws.filerepo.file.*;
|
||||||
public abstract class Xomw_MediaTransformOutput {
|
public abstract class Xomw_MediaTransformOutput {
|
||||||
public Xomw_MediaTransformOutput(Xomw_File file, byte[] url, byte[] path, int width, int height) {
|
public Xomw_MediaTransformOutput(Xomw_File file, byte[] url, byte[] path, int width, int height) {
|
||||||
// this.file = file;
|
this.file = file;
|
||||||
this.url = url;
|
this.url = url;
|
||||||
this.width = width;
|
this.width = width;
|
||||||
this.height = height;
|
this.height = height;
|
||||||
@ -31,9 +31,9 @@ public abstract class Xomw_MediaTransformOutput {
|
|||||||
// * from pixel density (eg 1.5 or 2) to additional URLs.
|
// * from pixel density (eg 1.5 or 2) to additional URLs.
|
||||||
// */
|
// */
|
||||||
// public $responsiveUrls = [];
|
// public $responsiveUrls = [];
|
||||||
//
|
|
||||||
// /** @var File */
|
/** @var File */
|
||||||
// private final Xomw_File file;
|
private final Xomw_File file;
|
||||||
|
|
||||||
/** @var int Image width */
|
/** @var int Image width */
|
||||||
protected final int width;
|
protected final int width;
|
||||||
@ -235,15 +235,15 @@ public abstract class Xomw_MediaTransformOutput {
|
|||||||
// return $contents;
|
// return $contents;
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
//
|
|
||||||
// /**
|
/**
|
||||||
// * @param String $title
|
* @param String $title
|
||||||
// * @param String|array $params Query parameters to add
|
* @param String|array $prms Query parameters to add
|
||||||
// * @return array
|
* @return array
|
||||||
// */
|
*/
|
||||||
// public function getDescLinkAttribs( $title = null, $params = [] ) {
|
public void getDescLinkAttribs(List_adp attribs, byte[] title, List_adp prms) {
|
||||||
// if ( is_array( $params ) ) {
|
// if ( is_array( prms ) ) {
|
||||||
// $query = $params;
|
// $query = prms;
|
||||||
// } else {
|
// } else {
|
||||||
// $query = [];
|
// $query = [];
|
||||||
// }
|
// }
|
||||||
@ -254,20 +254,18 @@ public abstract class Xomw_MediaTransformOutput {
|
|||||||
// $query['lang'] = $this->lang;
|
// $query['lang'] = $this->lang;
|
||||||
// }
|
// }
|
||||||
//
|
//
|
||||||
// if ( is_string( $params ) && $params !== '' ) {
|
// if ( is_string( prms ) && prms !== '' ) {
|
||||||
// $query = $params . '&' . wfArrayToCgi( $query );
|
// $query = prms . '&' . wfArrayToCgi( $query );
|
||||||
// }
|
// }
|
||||||
//
|
|
||||||
// $attribs = [
|
attribs.Clear();
|
||||||
// 'href' => $this->file->getTitle()->getLocalURL( $query ),
|
// 'href' => $this->file->getTitle()->getLocalURL( $query ),
|
||||||
// 'class' => 'image',
|
attribs.Add_many(Gfh_atr_.Bry__href, this.file.getTitle());
|
||||||
// ];
|
attribs.Add_many(Gfh_atr_.Bry__class, Bry__class__image);
|
||||||
// if ( $title ) {
|
if (title != null) {
|
||||||
// $attribs['title'] = $title;
|
attribs.Add_many(Gfh_atr_.Bry__title, title);
|
||||||
// }
|
}
|
||||||
//
|
}
|
||||||
// return $attribs;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// Wrap some XHTML text in an anchor tag with the given attributes
|
// Wrap some XHTML text in an anchor tag with the given attributes
|
||||||
// XO.MW:SYNC:1.29; DATE:2017-02-03
|
// XO.MW:SYNC:1.29; DATE:2017-02-03
|
||||||
@ -279,4 +277,5 @@ public abstract class Xomw_MediaTransformOutput {
|
|||||||
bfr.Add(contents);
|
bfr.Add(contents);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
private static final byte[] Bry__class__image = Bry_.new_a7("image");
|
||||||
}
|
}
|
||||||
|
@ -166,6 +166,10 @@ public class Xomw_ThumbnailImage extends Xomw_MediaTransformOutput { private fin
|
|||||||
// empty(options['title']) ? null : options['title'],
|
// empty(options['title']) ? null : options['title'],
|
||||||
// $query
|
// $query
|
||||||
// );
|
// );
|
||||||
|
link_attribs.Clear();
|
||||||
|
this.getDescLinkAttribs(link_attribs,
|
||||||
|
Php_utl_.empty(options.title) ? null : options.title,
|
||||||
|
null);
|
||||||
}
|
}
|
||||||
else if (!Php_utl_.empty(options.file_link)) {
|
else if (!Php_utl_.empty(options.file_link)) {
|
||||||
// link_attribs.Clear();
|
// link_attribs.Clear();
|
||||||
|
@ -26,13 +26,13 @@ public class Xomw_lnki_wkr__file__tst {
|
|||||||
fxt.Init__file("A.png", 300, 200);
|
fxt.Init__file("A.png", 300, 200);
|
||||||
}
|
}
|
||||||
@Test public void Plain() {
|
@Test public void Plain() {
|
||||||
fxt.Test__to_html("[[File:A.png]]", "<a><img alt='A.png' src='/orig/7/70/A.png' /></a>");
|
fxt.Test__to_html("[[File:A.png]]", "<a href='A.png' class='image'><img alt='A.png' src='/orig/7/70/A.png' /></a>");
|
||||||
}
|
}
|
||||||
@Test public void Thumb() {
|
@Test public void Thumb() {
|
||||||
fxt.Test__to_html("[[File:A.png|thumb]]", "<div class='thumb tright'><div class='thumbinner' style='width:222px;'><a><img alt='A.png' src='/thumb/7/70/A.png/220px-A.png' class='thumbimage' /></a> <div class='thumbcaption'><div class='magnify'><a href='' class='internal'></a></div></div></div></div>");
|
fxt.Test__to_html("[[File:A.png|thumb]]", "<div class='thumb tright'><div class='thumbinner' style='width:222px;'><a href='A.png' class='image'><img alt='A.png' src='/thumb/7/70/A.png/220px-A.png' class='thumbimage' /></a> <div class='thumbcaption'><div class='magnify'><a href='' class='internal'></a></div></div></div></div>");
|
||||||
}
|
}
|
||||||
@Test public void Size() {
|
@Test public void Size() {
|
||||||
fxt.Test__to_html("[[File:A.png|123x456px]]", "<a><img alt='A.png' src='/thumb/7/70/A.png/123px-A.png' /></a>");
|
fxt.Test__to_html("[[File:A.png|123x456px]]", "<a href='A.png' class='image'><img alt='A.png' src='/thumb/7/70/A.png/123px-A.png' /></a>");
|
||||||
}
|
}
|
||||||
@Test public void fitBoxWidth() {
|
@Test public void fitBoxWidth() {
|
||||||
// COMMENT:"Height is the relative smaller dimension, so scale width accordingly"
|
// COMMENT:"Height is the relative smaller dimension, so scale width accordingly"
|
||||||
|
@ -146,4 +146,7 @@ public class Php_str_ {
|
|||||||
}
|
}
|
||||||
return dirty ? tmp.To_bry_and_clear() : src;
|
return dirty ? tmp.To_bry_and_clear() : src;
|
||||||
}
|
}
|
||||||
|
public static byte[] strtr(byte[] src, byte find, byte repl) {
|
||||||
|
return Bry_.Replace(src, 0, src.length, find, repl);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user