From 45f3b842c8ab2275affee64461fcbc61e9c4bfa6 Mon Sep 17 00:00:00 2001 From: Sphericalkat Date: Sun, 28 May 2023 20:06:44 +0530 Subject: [PATCH] fix(mobile): restrict maximum width Signed-off-by: Sphericalkat --- frontend/index.html | 2 +- frontend/show.html | 2 +- pkg/converters/markup_converter_test.go | 43 +++++++++---------------- pkg/converters/paragraph_converter.go | 3 -- 4 files changed, 17 insertions(+), 33 deletions(-) diff --git a/frontend/index.html b/frontend/index.html index f4898e2..ae73fc9 100644 --- a/frontend/index.html +++ b/frontend/index.html @@ -14,7 +14,7 @@ -
+

Medium.rip

An alternative frontend to Medium

diff --git a/frontend/show.html b/frontend/show.html index c18f52f..f539d4e 100644 --- a/frontend/show.html +++ b/frontend/show.html @@ -17,7 +17,7 @@ -
+

{{.Title}}

{{.Author}} on {{.PublishDate}}

{{.Paragraphs}} diff --git a/pkg/converters/markup_converter_test.go b/pkg/converters/markup_converter_test.go index c9e776e..3f3ab69 100644 --- a/pkg/converters/markup_converter_test.go +++ b/pkg/converters/markup_converter_test.go @@ -1,7 +1,6 @@ package converters import ( - "encoding/json" "testing" "github.com/medium.rip/pkg/entities" @@ -59,32 +58,20 @@ func TestRanges(t *testing.T) { } func TestConvert(t *testing.T) { - jsonData := `{ - "name": "254a", - "text": "Early Flush prevents subsequent changes to the headers (e.g to redirect or change the status code). In the React + NodeJS world, it’s common to delegate redirects and error throwing to a React app rendered after the data has been fetched. This won’t work if you’ve already sent an early tag and a 200 OK status.", - "type": "P", - "href": null, - "layout": null, - "markups": [ - { - "title": null, - "type": "CODE", - "href": null, - "userId": null, - "start": 287, - "end": 293, - "anchorType": null - } - ], - "iframe": null, - "metadata": null - }` - p := new(entities.Paragraph) - _ = json.Unmarshal([]byte(jsonData), p) + markup := ConvertMarkup(" and emphasized only", []entities.Markup{ + { + Type: "STRONG", + Start: 0, + End: 12, + }, + { + Type: "EM", + Start: 9, + End: 23, + }, + }) - ConvertMarkup(p.Text, p.Markups) - - // if markup != "strong and emphasized only" { - // t.Errorf("Expected markup to be strong and emphasized only, got %s", markup) - // } + if markup != "<strong> <strong>and</strong> emphasized only" { + t.Errorf("Expected markup to be <strong> <strong>and</strong> emphasized only only, got %s", markup) + } } diff --git a/pkg/converters/paragraph_converter.go b/pkg/converters/paragraph_converter.go index d7f6aab..de6be6a 100644 --- a/pkg/converters/paragraph_converter.go +++ b/pkg/converters/paragraph_converter.go @@ -107,9 +107,6 @@ func ConvertParagraphs(paragraphs []entities.Paragraph) string { ps.WriteString(fmt.Sprintf("
    %s
", listItems)) case "P": children := ConvertMarkup(p.Text, p.Markups) - if p.Name == "ca5b" { - fmt.Println(children) - } ps.WriteString(fmt.Sprintf("

%s

", children)) case "PRE": children := ConvertMarkup(p.Text, p.Markups)