Skip to content

Commit

Permalink
Fixes styling for TSV html fields
Browse files Browse the repository at this point in the history
  • Loading branch information
richmahn committed Aug 13, 2021
1 parent d9b85f3 commit ef8a64f
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 45 deletions.
12 changes: 3 additions & 9 deletions modules/markup/tsv/tsv.go
Expand Up @@ -10,7 +10,6 @@ import (
"html"
"io"
"regexp"
"strings"

"code.gitea.io/gitea/modules/markup"
"code.gitea.io/gitea/modules/markup/markdown"
Expand Down Expand Up @@ -44,7 +43,6 @@ func (p Parser) Render(rawBytes []byte, urlPrefix string, metas map[string]strin
var tmpBlock bytes.Buffer
tmpBlock.WriteString(`<table class="table tsv">`)
rowID := 0
noteID := -1
for {
fields, err := rd.Read()
if err == io.EOF {
Expand All @@ -54,15 +52,11 @@ func (p Parser) Render(rawBytes []byte, urlPrefix string, metas map[string]strin
continue
}
tmpBlock.WriteString("<tr>")
for colID, field := range fields {
if rowID == 0 && strings.HasSuffix(strings.ToLower(field), "note") {
noteID = colID
}
if rowID > 0 && colID == noteID {
tmpBlock.WriteString(`<td class="note">`)
for _, field := range fields {
tmpBlock.WriteString(`<td>`)
if rowID > 0 {
tmpBlock.WriteString(string(markdown.Render([]byte(newlineRegexp.ReplaceAllString(field, "\n")), urlPrefix, metas)))
} else {
tmpBlock.WriteString("<td>")
tmpBlock.WriteString(html.EscapeString(field))
}
tmpBlock.WriteString("</td>")
Expand Down
68 changes: 32 additions & 36 deletions web_src/less/dcs.less
Expand Up @@ -10,43 +10,39 @@
th,
td {
vertical-align: top;
line-height: normal !important;

h1,
h2,
h3,
h4 {
border-bottom: none;
white-space: nowrap;
}

h1 {
font-size: 2em;
}

h2 {
font-size: 1.5em;
}

h3 {
font-size: 1.25em;
}

h4,
h5,
h6 {
font-size: 1em;
}

&:last-child {
line-height: normal !important;
min-width: 300px;

h1,
h2,
h3,
h4 {
border-bottom: none;
white-space: nowrap;
}

h1 {
font-size: 2em;
}

h2 {
font-size: 1.5em;
}

h3 {
font-size: 1.25em;
}

h4,
h5,
h6 {
font-size: 1em;
}

ol,
ul {
display: flex;
flex-direction: column;
padding-bottom: 16px;
}
ol,
ul {
display: flex;
flex-direction: column;
padding-bottom: 16px;
}
}
}
Expand Down

0 comments on commit ef8a64f

Please sign in to comment.