diff options
Diffstat (limited to 'src/gmdocument.c')
-rw-r--r-- | src/gmdocument.c | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/src/gmdocument.c b/src/gmdocument.c index b844c0f6..eac0ac62 100644 --- a/src/gmdocument.c +++ b/src/gmdocument.c | |||
@@ -97,8 +97,8 @@ struct Impl_GmDocument { | |||
97 | iBool enableCommandLinks; /* `about:command?` only allowed on selected pages */ | 97 | iBool enableCommandLinks; /* `about:command?` only allowed on selected pages */ |
98 | iArray layout; /* contents of source, laid out in document space */ | 98 | iArray layout; /* contents of source, laid out in document space */ |
99 | iPtrArray links; | 99 | iPtrArray links; |
100 | enum iGmDocumentBanner bannerType; | 100 | // enum iGmDocumentBanner bannerType; |
101 | iString bannerText; | 101 | // iString bannerText; |
102 | iString title; /* the first top-level title */ | 102 | iString title; /* the first top-level title */ |
103 | iArray headings; | 103 | iArray headings; |
104 | iArray preMeta; /* metadata about preformatted blocks */ | 104 | iArray preMeta; /* metadata about preformatted blocks */ |
@@ -573,7 +573,7 @@ static void doLayout_GmDocument_(iGmDocument *d) { | |||
573 | const iArray *oldPreMeta = collect_Array(copy_Array(&d->preMeta)); /* remember fold states */ | 573 | const iArray *oldPreMeta = collect_Array(copy_Array(&d->preMeta)); /* remember fold states */ |
574 | clear_Array(&d->preMeta); | 574 | clear_Array(&d->preMeta); |
575 | clear_String(&d->title); | 575 | clear_String(&d->title); |
576 | clear_String(&d->bannerText); | 576 | // clear_String(&d->bannerText); |
577 | if (d->size.x <= 0 || isEmpty_String(&d->source)) { | 577 | if (d->size.x <= 0 || isEmpty_String(&d->source)) { |
578 | return; | 578 | return; |
579 | } | 579 | } |
@@ -587,7 +587,7 @@ static void doLayout_GmDocument_(iGmDocument *d) { | |||
587 | int preFont = preformatted_FontId; | 587 | int preFont = preformatted_FontId; |
588 | uint16_t preId = 0; | 588 | uint16_t preId = 0; |
589 | iBool enableIndents = iFalse; | 589 | iBool enableIndents = iFalse; |
590 | iBool addSiteBanner = d->bannerType != none_GmDocumentBanner; | 590 | // iBool addSiteBanner = d->bannerType != none_GmDocumentBanner; |
591 | const iBool isNormalized = isNormalized_GmDocument_(d); | 591 | const iBool isNormalized = isNormalized_GmDocument_(d); |
592 | enum iGmLineType prevType = text_GmLineType; | 592 | enum iGmLineType prevType = text_GmLineType; |
593 | enum iGmLineType prevNonBlankType = text_GmLineType; | 593 | enum iGmLineType prevNonBlankType = text_GmLineType; |
@@ -669,7 +669,7 @@ static void doLayout_GmDocument_(iGmDocument *d) { | |||
669 | if (d->format == gemini_SourceFormat && | 669 | if (d->format == gemini_SourceFormat && |
670 | startsWithSc_Rangecc(line, "```", &iCaseSensitive)) { | 670 | startsWithSc_Rangecc(line, "```", &iCaseSensitive)) { |
671 | isPreformat = iFalse; | 671 | isPreformat = iFalse; |
672 | addSiteBanner = iFalse; /* overrides the banner */ | 672 | // addSiteBanner = iFalse; /* overrides the banner */ |
673 | continue; | 673 | continue; |
674 | } | 674 | } |
675 | run.mediaType = max_MediaType; /* preformatted block */ | 675 | run.mediaType = max_MediaType; /* preformatted block */ |
@@ -677,6 +677,7 @@ static void doLayout_GmDocument_(iGmDocument *d) { | |||
677 | run.font = (d->format == plainText_SourceFormat ? plainText_FontId : preFont); | 677 | run.font = (d->format == plainText_SourceFormat ? plainText_FontId : preFont); |
678 | indent = indents[type]; | 678 | indent = indents[type]; |
679 | } | 679 | } |
680 | #if 0 | ||
680 | if (addSiteBanner) { | 681 | if (addSiteBanner) { |
681 | addSiteBanner = iFalse; | 682 | addSiteBanner = iFalse; |
682 | const iRangecc bannerText = urlHost_String(&d->url); | 683 | const iRangecc bannerText = urlHost_String(&d->url); |
@@ -697,6 +698,7 @@ static void doLayout_GmDocument_(iGmDocument *d) { | |||
697 | 1.5f * lineHeight_Text(paragraph_FontId) * prefs->lineSpacing; | 698 | 1.5f * lineHeight_Text(paragraph_FontId) * prefs->lineSpacing; |
698 | } | 699 | } |
699 | } | 700 | } |
701 | #endif | ||
700 | /* Empty lines don't produce text runs. */ | 702 | /* Empty lines don't produce text runs. */ |
701 | if (isEmpty_Range(&line)) { | 703 | if (isEmpty_Range(&line)) { |
702 | if (type == quote_GmLineType && !prefs->quoteIcon) { | 704 | if (type == quote_GmLineType && !prefs->quoteIcon) { |
@@ -1068,13 +1070,13 @@ void init_GmDocument(iGmDocument *d) { | |||
1068 | init_String(&d->source); | 1070 | init_String(&d->source); |
1069 | init_String(&d->url); | 1071 | init_String(&d->url); |
1070 | init_String(&d->localHost); | 1072 | init_String(&d->localHost); |
1071 | d->bannerType = siteDomain_GmDocumentBanner; | 1073 | // d->bannerType = siteDomain_GmDocumentBanner; |
1072 | d->outsideMargin = 0; | 1074 | d->outsideMargin = 0; |
1073 | d->size = zero_I2(); | 1075 | d->size = zero_I2(); |
1074 | d->enableCommandLinks = iFalse; | 1076 | d->enableCommandLinks = iFalse; |
1075 | init_Array(&d->layout, sizeof(iGmRun)); | 1077 | init_Array(&d->layout, sizeof(iGmRun)); |
1076 | init_PtrArray(&d->links); | 1078 | init_PtrArray(&d->links); |
1077 | init_String(&d->bannerText); | 1079 | // init_String(&d->bannerText); |
1078 | init_String(&d->title); | 1080 | init_String(&d->title); |
1079 | init_Array(&d->headings, sizeof(iGmHeading)); | 1081 | init_Array(&d->headings, sizeof(iGmHeading)); |
1080 | init_Array(&d->preMeta, sizeof(iGmPreMeta)); | 1082 | init_Array(&d->preMeta, sizeof(iGmPreMeta)); |
@@ -1089,7 +1091,7 @@ void init_GmDocument(iGmDocument *d) { | |||
1089 | void deinit_GmDocument(iGmDocument *d) { | 1091 | void deinit_GmDocument(iGmDocument *d) { |
1090 | iReleasePtr(&d->openURLs); | 1092 | iReleasePtr(&d->openURLs); |
1091 | delete_Media(d->media); | 1093 | delete_Media(d->media); |
1092 | deinit_String(&d->bannerText); | 1094 | // deinit_String(&d->bannerText); |
1093 | deinit_String(&d->title); | 1095 | deinit_String(&d->title); |
1094 | clearLinks_GmDocument_(d); | 1096 | clearLinks_GmDocument_(d); |
1095 | deinit_PtrArray(&d->links); | 1097 | deinit_PtrArray(&d->links); |
@@ -1625,9 +1627,11 @@ void setFormat_GmDocument(iGmDocument *d, enum iSourceFormat format) { | |||
1625 | d->format = format; | 1627 | d->format = format; |
1626 | } | 1628 | } |
1627 | 1629 | ||
1630 | #if 0 | ||
1628 | void setBanner_GmDocument(iGmDocument *d, enum iGmDocumentBanner type) { | 1631 | void setBanner_GmDocument(iGmDocument *d, enum iGmDocumentBanner type) { |
1629 | d->bannerType = type; | 1632 | d->bannerType = type; |
1630 | } | 1633 | } |
1634 | #endif | ||
1631 | 1635 | ||
1632 | void setWidth_GmDocument(iGmDocument *d, int width, int outsideMargin) { | 1636 | void setWidth_GmDocument(iGmDocument *d, int width, int outsideMargin) { |
1633 | d->size.x = width; | 1637 | d->size.x = width; |
@@ -2104,6 +2108,7 @@ iInt2 size_GmDocument(const iGmDocument *d) { | |||
2104 | return d->size; | 2108 | return d->size; |
2105 | } | 2109 | } |
2106 | 2110 | ||
2111 | #if 0 | ||
2107 | enum iGmDocumentBanner bannerType_GmDocument(const iGmDocument *d) { | 2112 | enum iGmDocumentBanner bannerType_GmDocument(const iGmDocument *d) { |
2108 | return d->bannerType; | 2113 | return d->bannerType; |
2109 | } | 2114 | } |
@@ -2126,6 +2131,7 @@ const iGmRun *siteBanner_GmDocument(const iGmDocument *d) { | |||
2126 | const iString *bannerText_GmDocument(const iGmDocument *d) { | 2131 | const iString *bannerText_GmDocument(const iGmDocument *d) { |
2127 | return &d->bannerText; | 2132 | return &d->bannerText; |
2128 | } | 2133 | } |
2134 | #endif | ||
2129 | 2135 | ||
2130 | const iArray *headings_GmDocument(const iGmDocument *d) { | 2136 | const iArray *headings_GmDocument(const iGmDocument *d) { |
2131 | return &d->headings; | 2137 | return &d->headings; |