Skip to content

Commit

Permalink
Merge pull request #2 from foobnix/master
Browse files Browse the repository at this point in the history
oct28
  • Loading branch information
mackeev authored Oct 28, 2019
2 parents fb36c75 + 5ff615d commit f7b23c3
Show file tree
Hide file tree
Showing 611 changed files with 8,474 additions and 3,178 deletions.
4 changes: 3 additions & 1 deletion Builder/all-alpha.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ cd Builder
./link_to_mupdf_1.11.sh

cd ../
./gradlew assembleProRelease
./gradlew assembleBetaRelease
#./gradlew assembleProRelease



./gradlew copyApks -Pbeta
Expand Down
8 changes: 2 additions & 6 deletions Builder/jni-1.11/~mupdf/css-apply.c
Original file line number Diff line number Diff line change
Expand Up @@ -915,13 +915,10 @@ number_from_value_in(fz_css_value *value, float initial, int initial_unit, int i
if (p[0] == 'p' && p[1] == 'x' && p[2] == 0)
return isFont? make_number(x / 25 < 1 ? 1 : x / 25, N_SCALE): make_number(x, N_LENGTH);


/* FIXME: 'rem' should be 'em' of root element. This is a bad approximation. */
if (p[0] == 'r' && p[1] == 'e' && p[2] == 'm' && p[3] == 0)
return isFont? make_number(x <1 ? 1: x, N_SCALE) : make_number(x, N_SCALE);


/* FIXME: 'ch' should be width of '0' character. This is an approximation. */
if (p[0] == 'c' && p[1] == 'h' && p[2] == 0)
return make_number(x / 2, N_LENGTH);

Expand All @@ -932,7 +929,6 @@ number_from_value_in(fz_css_value *value, float initial, int initial_unit, int i
{
if (!strcmp(value->data, "auto"))
return make_number(0, N_LENGTH);
//return make_number(0, N_AUTO);
}

return make_number(initial, initial_unit);
Expand Down Expand Up @@ -1286,8 +1282,8 @@ fz_apply_css_style(fz_context *ctx, fz_html_font_set *set, fz_css_style *style,
}


style->width = number_from_property(match, "width", 0, N_AUTO);
style->height = number_from_property(match, "height", 0, N_AUTO);
//style->width = number_from_property(match, "width", 0, N_AUTO);
//style->height = number_from_property(match, "height", 0, N_AUTO);

style->margin[0] = number_from_property(match, "margin-top", 0, N_LENGTH);
style->margin[1] = number_from_property(match, "margin-right", 0, N_LENGTH);
Expand Down
21 changes: 9 additions & 12 deletions Builder/jni-1.11/~mupdf/html-layout.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ static const char *html_default_css =
"kbd{font-family:monospace}"
"li{display:list-item}"
"menu{display:block;list-style-type:disc;margin:1em 0;padding:0 1em 0 1em}"
"ol{display:block;list-style-type:decimal;margin:1em 0;padding:0 1em 0 1em}"
"ol{display:block;list-style-type:decimal;margin:1em;padding:0 1em 0 1em}"
"p{display:block;}"
"pre{display:block;font-family:monospace;margin:1em 0;white-space:pre}"
"samp{font-family:monospace}"
Expand All @@ -52,7 +52,7 @@ static const char *html_default_css =
"sub{font-size:0.83em;vertical-align:sub}"
"sup{font-size:0.83em;vertical-align:super}"

"table{display:block !important;}"
"table{display:block !important; margin:1em !important;font-size:0.8em;}"
"tr,thead,tfoot {display:block !important;margin-top:0.5em !important;}"
"td,th {display:block !important;border-style:solid; border-width:1px; padding:0.1em 0 0.1em 0.5em}"
"tbody {display:block !important;}"
Expand All @@ -61,13 +61,6 @@ static const char *html_default_css =
"figcaption {display:block; text-align:center}"
"figcaption>p {text-align:center}"

//"tbody{display:table-row-group}"
//"td{display:table-cell;padding:1px}"
//"tfoot{display:table-footer-group}"
//"th{display:table-cell;font-weight:bold;padding:1px;text-align:center}"
//"thead{display:table-header-group}"
//"tr{display:table-row}"

"ul{display:block;list-style-type:disc;margin:1em 0;padding:0 1em 0 1em}"
"ul ul{list-style-type:circle}"
"ul ul ul{list-style-type:square}"
Expand All @@ -92,9 +85,13 @@ static const char *fb2_default_css =
"body,section,title,subtitle,p,cite,epigraph,text-author,date,poem,stanza,v,empty-line{display:block}"
"image{display:block}"
"p>image{display:inline}"
"table{display:table}"
"tr{display:table-row}"
"th,td{display:table-cell}"

"table{display:block !important; margin:1em !important;font-size:0.8em;}"
"tr,thead,tfoot {display:block !important;margin-top:0.5em !important;}"
"td,th {display:block !important;border-style:solid; border-width:1px; padding:0.1em 0 0.1em 0.5em}"
"tbody {display:block !important;}"
"th{font-weight:bold; text-align:center}"

"a{color:#06C;text-decoration:underline}"
"a[type=note]{font-size:small;vertical-align:super}"
"code{white-space:pre;font-family:monospace}"
Expand Down
53 changes: 30 additions & 23 deletions Builder/jni-1.16.1/~mupdf/css-apply.c
Original file line number Diff line number Diff line change
Expand Up @@ -886,15 +886,15 @@ fz_css_strtof(char *s, char **endptr)
}

static fz_css_number
number_from_value(fz_css_value *value, float initial, int initial_unit)
number_from_value(fz_css_value *value, float initial, int initial_unit, int isFont)
{
char *p;

if (!value)
return make_number(initial, initial_unit);

if (value->type == CSS_PERCENT)
return make_number(fz_css_strtof(value->data, NULL), N_PERCENT);
return make_number(fz_css_strtof(value->data, NULL)/2.5, N_PERCENT);

if (value->type == CSS_NUMBER)
return make_number(fz_css_strtof(value->data, NULL), N_NUMBER);
Expand All @@ -903,36 +903,31 @@ number_from_value(fz_css_value *value, float initial, int initial_unit)
{
float x = fz_css_strtof(value->data, &p);



if (p[0] == 'e' && p[1] == 'm' && p[2] == 0)
return make_number(fz_max(0.5f, x), N_SCALE);

if (p[0] == 'r' && p[1] == 'e' && p[2] == 'm' && p[3] == 0)
return make_number(fz_max(0.5f, x), N_SCALE);
return isFont? make_number(x < 0.5 ? 0.5: x, N_SCALE) : make_number(x, N_SCALE);

if (p[0] == 'e' && p[1] == 'x' && p[2] == 0)
return make_number(x / 2, N_SCALE);

if (p[0] == 'i' && p[1] == 'n' && p[2] == 0)
return make_number(x * 72, N_LENGTH);

if (p[0] == 'c' && p[1] == 'm' && p[2] == 0)
return make_number(x * 7200 / 254, N_LENGTH);

if (p[0] == 'm' && p[1] == 'm' && p[2] == 0)
return make_number(x * 720 / 254, N_LENGTH);

if (p[0] == 'p' && p[1] == 'c' && p[2] == 0)
return make_number(x * 12, N_LENGTH);

if (p[0] == 'p' && p[1] == 't' && p[2] == 0)
return x > 5.0f ? make_number(fz_max(0.5f, x / 12), N_SCALE) : make_number(x, N_LENGTH);
return isFont? make_number(x / 12 < 1 ? 1 : x / 12, N_SCALE) :make_number(x, N_LENGTH);

if (p[0] == 'p' && p[1] == 'x' && p[2] == 0)
return x > 5.0f ? make_number(fz_max(0.5f, x / 25), N_SCALE) : make_number(x, N_LENGTH);
return isFont? make_number(x / 25 < 1 ? 1 : x / 25, N_SCALE): make_number(x, N_LENGTH);

if (p[0] == 'r' && p[1] == 'e' && p[2] == 'm' && p[3] == 0)
return isFont? make_number(x <1 ? 1: x, N_SCALE) : make_number(x, N_SCALE);


/* FIXME: 'ch' should be width of '0' character. This is an approximation. */
if (p[0] == 'c' && p[1] == 'h' && p[2] == 0)
return make_number(x / 2, N_LENGTH);

Expand All @@ -943,7 +938,6 @@ number_from_value(fz_css_value *value, float initial, int initial_unit)
{
if (!strcmp(value->data, "auto"))
return make_number(0, N_LENGTH);
//return make_number(0, N_AUTO);
}

return make_number(initial, initial_unit);
Expand All @@ -952,7 +946,7 @@ number_from_value(fz_css_value *value, float initial, int initial_unit)
static fz_css_number
number_from_property(fz_css_match *match, const char *property, float initial, int initial_unit)
{
return number_from_value(value_from_property(match, property), initial, initial_unit);
return number_from_value(value_from_property(match, property), initial, initial_unit,0);
}

static fz_css_number
Expand All @@ -967,7 +961,7 @@ border_width_from_property(fz_css_match *match, const char *property)
return make_number(2, N_LENGTH);
if (!strcmp(value->data, "thick"))
return make_number(4, N_LENGTH);
return number_from_value(value, 0, N_LENGTH);
return number_from_value(value, 0, N_LENGTH,0);
}
return make_number(2, N_LENGTH); /* initial: 'medium' */
}
Expand Down Expand Up @@ -1067,9 +1061,9 @@ color_from_value(fz_css_value *value, fz_css_color initial)
vr = value->args;
vg = vr && vr->next ? vr->next->next : NULL; /* skip the ',' nodes */
vb = vg && vg->next ? vg->next->next : NULL; /* skip the ',' nodes */
r = fz_from_css_number(number_from_value(vr, 0, N_NUMBER), 255, 255, 0);
g = fz_from_css_number(number_from_value(vg, 0, N_NUMBER), 255, 255, 0);
b = fz_from_css_number(number_from_value(vb, 0, N_NUMBER), 255, 255, 0);
r = fz_from_css_number(number_from_value(vr, 0, N_NUMBER,0), 255, 255, 0);
g = fz_from_css_number(number_from_value(vg, 0, N_NUMBER,0), 255, 255, 0);
b = fz_from_css_number(number_from_value(vb, 0, N_NUMBER,0), 255, 255, 0);
return make_color(r, g, b, 255);
}

Expand Down Expand Up @@ -1257,7 +1251,14 @@ fz_apply_css_style(fz_context *ctx, fz_html_font_set *set, fz_css_style *style,
else if (!strcmp(value->data, "smaller")) style->font_size = make_number(1/1.2f, N_SCALE);
else if (!strcmp(value->data, "inherit")) style->font_size = make_number(1.0f, N_SCALE);

else style->font_size = number_from_value(value, 1, N_SCALE);
else
{
if (value->type == CSS_PERCENT){
style->font_size = make_number(fz_css_strtof(value->data, NULL)/100, N_SCALE);
}else{
style->font_size = number_from_value(value, 1, N_SCALE,1);
}
}
}
else
{
Expand Down Expand Up @@ -1289,8 +1290,9 @@ fz_apply_css_style(fz_context *ctx, fz_html_font_set *set, fz_css_style *style,

style->text_indent = number_from_property(match, "text-indent", 0, N_LENGTH);

style->width = number_from_property(match, "width", 0, N_AUTO);
style->height = number_from_property(match, "height", 0, N_AUTO);
//style->width = number_from_property(match, "width", 0, N_AUTO);
//style->height = number_from_property(match, "height", 0, N_AUTO);


style->margin[0] = number_from_property(match, "margin-top", 0, N_LENGTH);
style->margin[1] = number_from_property(match, "margin-right", 0, N_LENGTH);
Expand All @@ -1308,6 +1310,7 @@ fz_apply_css_style(fz_context *ctx, fz_html_font_set *set, fz_css_style *style,
if(style->margin[2].unit==N_SCALE && style->margin[2].value<-2)style->margin[2].value=-2;
if(style->margin[3].unit==N_SCALE && style->margin[3].value<-2)style->margin[3].value=-2;


style->padding[0] = number_from_property(match, "padding-top", 0, N_LENGTH);
style->padding[1] = number_from_property(match, "padding-right", 0, N_LENGTH);
style->padding[2] = number_from_property(match, "padding-bottom", 0, N_LENGTH);
Expand All @@ -1316,6 +1319,8 @@ fz_apply_css_style(fz_context *ctx, fz_html_font_set *set, fz_css_style *style,
style->padding[1].value = style->padding[1].value / 2;
style->padding[3].value = style->padding[3].value / 2;



style->color = color_from_property(match, "color", black);
style->background_color = color_from_property(match, "background-color", transparent);

Expand All @@ -1334,6 +1339,8 @@ fz_apply_css_style(fz_context *ctx, fz_html_font_set *set, fz_css_style *style,
style->border_width[2] = border_width_from_property(match, "border-bottom-width");
style->border_width[3] = border_width_from_property(match, "border-left-width");



{
const char *font_weight = string_from_property(match, "font-weight", "normal");
const char *font_style = string_from_property(match, "font-style", "normal");
Expand Down
23 changes: 14 additions & 9 deletions Builder/jni-1.16.1/~mupdf/html-parse.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ static const char *html_default_css =
"kbd{font-family:monospace}"
"li{display:list-item}"
"menu{display:block;list-style-type:disc;margin:1em 0;padding:0 1em 0 1em}"
"ol{display:block;list-style-type:decimal;margin:1em 0;padding:0 1em 0 1em}"
"ol{display:block;list-style-type:decimal;margin:1em;padding:0 1em 0 1em}"
"p{display:block;}"
"pre{display:block;font-family:monospace;margin:1em 0;white-space:pre}"
"samp{font-family:monospace}"
Expand All @@ -49,13 +49,13 @@ static const char *html_default_css =
"style{display:none}"
"sub{font-size:0.83em;vertical-align:sub}"
"sup{font-size:0.83em;vertical-align:super}"

"table{display:table}"
"tbody{display:table-row-group}"
"td{display:table-cell;padding:1px}"
"tfoot{display:table-footer-group}"
"th{display:table-cell;font-weight:bold;padding:1px;text-align:center}"
"thead{display:table-header-group}"
"tr{display:table-row;margin-top:0.5em !important;}"
"tbody,tfoot,thead,tr{display:table-row}"
"td,th{display:table-cell; text-align:left}"
"th{font-weight:bold}"
"td,th{font-size:0.7em !important;}"

"ul{display:block;list-style-type:disc;margin:1em 0;padding:0 0 0 30pt}"
"ul ul{list-style-type:circle}"
"ul ul ul{list-style-type:square}"
Expand All @@ -79,9 +79,14 @@ static const char *fb2_default_css =
"body,section,title,subtitle,p,cite,epigraph,text-author,date,poem,stanza,v,empty-line{display:block}"
"image{display:block}"
"p>image{display:inline}"

"table{display:table}"
"tr{display:table-row}"
"th,td{display:table-cell}"
"tbody,tfoot,thead,tr{display:table-row}"
"td,th{display:table-cell; text-align:left}"
"th{font-weight:bold}"
"td,th{font-size:0.7em !important;}"


"a{color:#06C;text-decoration:underline}"
"a[type=note]{font-size:small;vertical-align:super}"
"code{white-space:pre;font-family:monospace}"
Expand Down
19 changes: 15 additions & 4 deletions Builder/src/main/java/web/GenerateFAQ.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@
import java.io.File;
import java.io.FileReader;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;

public class GenerateFAQ {

Expand All @@ -16,20 +20,27 @@ public static void main(String[] args) throws Exception {
WikiTranslate.translate("/home/ivan-dev/git/LirbiReader/docs/wiki/faq", "it");
}

public static void updateIndex(final String in, String pageTitle, int version) throws Exception {
public static void updateIndex(final String in, String pageTitle) throws Exception {
File outFile = new File(in, "index.md");
final PrintWriter out = new PrintWriter(outFile);
out.println("---");
out.println("layout: main");
out.println("version: " + version);
out.println("---");
out.println("[<](/wiki/)");
//out.println("[<](/wiki/)");
out.println("");
out.println("# " + pageTitle);
out.println("");

File list = new File(in);
for (File file : list.listFiles()) {
List<File> files = Arrays.asList(list.listFiles());
Collections.sort(files, new Comparator<File>() {
@Override
public int compare(File file, File t1) {
return Long.compare(t1.lastModified(), file.lastModified());
}
});

for (File file : files) {
if (file.isDirectory()) {
File child = new File(file, "index.md");
String title = getTitle(child).trim();
Expand Down
Loading

0 comments on commit f7b23c3

Please sign in to comment.