~ritho/rweb

4eb4198a9036098f7ca603cab14ef35de2aa818d — Ritho 2 months ago 01a2233 main
Improve the code output for languages like golang.

Signed-off-by: Ritho <palvarez@ritho.net>
2 files changed, 7 insertions(+), 5 deletions(-)

M Makefile
M internal/engine/storage/blog/article/article.go
M Makefile => Makefile +1 -1
@@ 92,7 92,7 @@ start:
	@$(MAKE) build
	@if [ ! -f $(TOPDIR)/.$(BIN).pid ]; then \
		echo -n "Starting $(BIN)"; \
		$(TOPDIR)/bin/$(BIN) -logtostderr=true -config $(TOPDIR)/conf/web.yaml 1> $(BIN).log < /dev/null 2>&1 & \
		$(TOPDIR)/bin/$(BIN) -config $(TOPDIR)/conf/web.yaml 1> $(BIN).log < /dev/null 2>&1 & \
		export PID=$$! ; \
		echo $$PID > $(TOPDIR)/.$(BIN).pid ; \
		while  ! curl $(HOST):$(PORT)/healthcheck > /dev/null 2>&1; do \

M internal/engine/storage/blog/article/article.go => internal/engine/storage/blog/article/article.go +6 -4
@@ 140,7 140,6 @@ func (a *Article) parseMetadata(line string) bool {

		return true
	case "#+LAYOUT":

		return true
	}



@@ 154,6 153,7 @@ func (a *Article) parseLineContent(line string) {
		if len(a.Content) > 0 {
			a.Content[len(a.Content)-1] += endParagraph
		}

		a.Content = append(a.Content, startParagraph)
	}



@@ 173,11 173,13 @@ func (a *Article) parseLineContent(line string) {
	line = a.url.ReplaceAllString(line, linkTag)
	line = strings.ReplaceAll(line, "*/", startBold)
	line = strings.ReplaceAll(line, "/*", endBold)
	if a.isCode && !strings.Contains(line, "<code") {
		line = "<span>" + line + "</span>"
		line = strings.ReplaceAll(line, "	", "&emsp;&emsp;&emsp;&emsp;")
		line += breakTag
	}

	a.Content[pos] += " " + line
	if a.isCode {
		a.Content[pos] += breakTag
	}
}

// TitleToURL converts the article title to an url path.