mirror of
https://github.com/gnosygnu/xowa.git
synced 2025-05-31 22:44:34 +00:00
if option is set to use wikitext, but no wikitext is available, and html is available, just use html
This commit is contained in:
parent
18e8f475ff
commit
3e21b4e4db
@ -28,30 +28,44 @@ public class Xowe_page_mgr {
|
||||
|
||||
// load page meta; wait_for_popups
|
||||
Xoae_page page = wiki.Data_mgr().Load_page_and_parse(url, ttl, wiki.Lang(), tab, false);
|
||||
boolean hdump_exists = page.Db().Page().Html_db_id() != -1 && wiki.Appe().Api_root().Wiki().Hdump().Read_preferred();
|
||||
page.Html_data().Hdump_exists_(hdump_exists);
|
||||
Wait_for_popups(wiki.App());
|
||||
|
||||
// auto-update
|
||||
gplx.xowa.addons.wikis.pages.syncs.core.Xosync_read_mgr read_mgr = new gplx.xowa.addons.wikis.pages.syncs.core.Xosync_read_mgr();
|
||||
read_mgr.Auto_update(wiki, page, ttl);
|
||||
|
||||
// load page text
|
||||
boolean parse = true;
|
||||
if (hdump_exists) {
|
||||
wiki.Html__hdump_mgr().Load_mgr().Load_by_edit(page);
|
||||
parse = Bry_.Len_eq_0(page.Db().Html().Html_bry()); // NOTE: need to check if actually empty for archive.org wikis which included html_db_id without html_dbs; DATE:2016-06-22
|
||||
// load page from html_db
|
||||
boolean from_html_db = page.Db().Page().Html_db_id() != -1;
|
||||
if (from_html_db) {
|
||||
if (wiki.Appe().Api_root().Wiki().Hdump().Read_preferred()) {
|
||||
wiki.Html__hdump_mgr().Load_mgr().Load_by_edit(page);
|
||||
from_html_db = Bry_.Len_gt_0(page.Db().Html().Html_bry()); // NOTE: archive.org has some wtxt_dbs which included page|html_db_id without actual html_dbs; DATE:2016-06-22
|
||||
}
|
||||
else
|
||||
from_html_db = false;
|
||||
}
|
||||
if (parse)
|
||||
|
||||
// load page from wtxt_db; occurs if (a) no html_db_id; (b) option says to use wtxt db; (c) html_db_id exists, but no html_db;
|
||||
if (!from_html_db) {
|
||||
wiki.Parser_mgr().Parse(page, false);
|
||||
|
||||
// load from html_dbs if no wtxt found and option just marked as not read_preferred
|
||||
if ( Bry_.Len_eq_0(page.Db().Text().Text_bry()) // no wtxt found
|
||||
&& !wiki.Appe().Api_root().Wiki().Hdump().Read_preferred() // read preferred not marked
|
||||
) {
|
||||
wiki.Html__hdump_mgr().Load_mgr().Load_by_edit(page);
|
||||
from_html_db = Bry_.Len_gt_0(page.Db().Html().Html_bry());
|
||||
}
|
||||
}
|
||||
page.Html_data().Hdump_exists_(from_html_db);
|
||||
|
||||
// if [[Category]], generate catlinks (subc; page; file)
|
||||
if (ttl.Ns().Id_is_ctg()) {
|
||||
wiki.Ctg__catpage_mgr().Write_catpage(tmp_bfr, page);
|
||||
if (parse)
|
||||
page.Html_data().Catpage_data_(tmp_bfr.To_bry_and_clear());
|
||||
else
|
||||
if (from_html_db)
|
||||
page.Db().Html().Html_bry_(Bry_.Add(page.Db().Html().Html_bry(), tmp_bfr.To_bry_and_clear()));
|
||||
else
|
||||
page.Html_data().Catpage_data_(tmp_bfr.To_bry_and_clear());
|
||||
}
|
||||
|
||||
return page;
|
||||
|
Loading…
Reference in New Issue
Block a user