Skip to content

Commit

Permalink
Markdown to html, generate page to awesome-go.com (avelino#1127)
Browse files Browse the repository at this point in the history
* initial version html generate
After being made to change the master generate html based on markdown,
ref avelino#363

* change package name, repo to main

* up port 80 on caddy server

* install mux on travis build

* generate sitemap

* added robots.txt

* set metatags on html page

* update repo via exec
get the most current readme

* remove unnecessary lowdash assign

* fix linter errors, remove unnecessary conversion, add binary to .gitignore

* fix fonts, use domain-level assets
  • Loading branch information
Thiago Avelino authored and kirillDanshin committed Oct 11, 2016
1 parent ff219e2 commit d6a65b7
Show file tree
Hide file tree
Showing 57 changed files with 2,014 additions and 3 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
tmpl/index.html
awesome-go
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ sudo: false
install:
- go get github.com/russross/blackfriday
- go get github.com/PuerkitoBio/goquery

- go get github.com/gorilla/mux
8 changes: 8 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
FROM golang:alpine

RUN apk add --update -t build-deps curl go git libc-dev gcc libgcc
RUN go get github.com/russross/blackfriday github.com/gorilla/mux

WORKDIR /srv

CMD ["go", "run", "repo.go"]
15 changes: 15 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
version: "2"

services:
caddy:
image: abiosoft/caddy
volumes:
- ./tmpl:/srv
ports:
- 80:2015
webhook:
build: ./
volumes:
- ./:/srv
ports:
- 9000:9000
42 changes: 41 additions & 1 deletion repo.go
Original file line number Diff line number Diff line change
@@ -1 +1,41 @@
package repo
package main

import (
"io/ioutil"
"net/http"
"os"
"os/exec"
"text/template"

"github.com/gorilla/mux"
"github.com/russross/blackfriday"
)

type content struct {
Body string
}

func generateHTML() {
// Update repo
exec.Command("git", "checkout", "-f").Output()
exec.Command("git", "pull").Output()

input, _ := ioutil.ReadFile("./README.md")
body := string(blackfriday.MarkdownCommon(input))
c := &content{Body: body}

t := template.Must(template.ParseFiles("tmpl/tmpl.html"))
f, _ := os.Create("tmpl/index.html")
t.Execute(f, c)
}

func hookHandler(w http.ResponseWriter, r *http.Request) {
go generateHTML()
w.Write([]byte("Done!\n"))
}

func main() {
r := mux.NewRouter()
r.HandleFunc("/hook", hookHandler)
http.ListenAndServe(":9000", r)
}
2 changes: 1 addition & 1 deletion repo_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package repo
package main

import (
"bytes"
Expand Down
43 changes: 43 additions & 0 deletions tmpl/assets/awesome-go.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
* {
max-width: 100%;
box-sizing: border-box;
font-family: "Fira Sans";
text-decoration: none;
font-weight: 300;
}
.awesome-logo {
max-width: 500px;
width: 100%;
margin: auto;
display: block;
}

a {
color: #669;
}
a:visited, h1, h2, h3, h4 {
color: #494368;
font-weight: 400;
}
h1 > a:nth-child(1) {
margin-left: 10px;
}
h1 > a img {
padding-right: 5px;
}

#content {
width: 100%;
padding: 40px 80px;
}

@media (max-width: 720px) {
#content {
padding: 20px 40px;
}
}
@media (max-width: 420px) {
#content * {
word-wrap: break-word;
}
}
140 changes: 140 additions & 0 deletions tmpl/assets/fonts/firasans.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,140 @@
@font-face {
font-family: 'Fira Sans';
src: local('Fira Sans ExtraLight'),
local('FiraSans-ExtraLight'),
url('/assets/fonts/firasansextralight.woff2') format('woff2'),
url('/assets/fonts/firasansextralight.woff') format('woff'),
url('/assets/fonts/firasansextralight.ttf') format('truetype');
font-weight: 100;
font-style: normal;
}
@font-face {
font-family: 'Fira Sans';
src: local('Fira Sans ExtraLight Italic'),
local('FiraSans-ExtraLightItalic'),
url('/assets/fonts/firasansextralightitalic.woff2') format('woff2'),
url('/assets/fonts/firasansextralightitalic.woff') format('woff'),
url('/assets/fonts/firasansextralightitalic.ttf') format('truetype');
font-weight: 100;
font-style: italic;
}
@font-face {
font-family: 'Fira Sans';
src: local('Fira Sans Light'),
local('FiraSans-Light'),
url('/assets/fonts/firasanslight.woff2') format('woff2'),
url('/assets/fonts/firasanslight.woff') format('woff'),
url('/assets/fonts/firasanslight.ttf') format('truetype');
font-weight: 200;
font-style: normal;
}
@font-face {
font-family: 'Fira Sans';
src: local('Fira Sans Light Italic'),
local('FiraSans-LightItalic'),
url('/assets/fonts/firasanslightitalic.woff2') format('woff2'),
url('/assets/fonts/firasanslightitalic.woff') format('woff'),
url('/assets/fonts/firasanslightitalic.ttf') format('truetype');
font-weight: 200;
font-style: italic;
}
@font-face {
font-family: 'Fira Sans';
src: local('Fira Sans Book'),
local('FiraSans-Book'),
url('/assets/fonts/firasansbook.woff2') format('woff2'),
url('/assets/fonts/firasansbook.woff') format('woff'),
url('/assets/fonts/firasansbook.ttf') format('truetype');
font-weight: 300;
font-style: normal;
}
@font-face {
font-family: 'Fira Sans';
src: local('Fira Sans Book Italic'),
local('FiraSans-BookItalic'),
url('/assets/fonts/firasansbookitalic.woff2') format('woff2'),
url('/assets/fonts/firasansbookitalic.woff') format('woff'),
url('/assets/fonts/firasansbookitalic.ttf') format('truetype');
font-weight: 300;
font-style: italic;
}
@font-face {
font-family: 'Fira Sans';
src: local('Fira Sans'),
local('FiraSans-Regular'),
url('/assets/fonts/firasans.woff2') format('woff2'),
url('/assets/fonts/firasans.woff') format('woff'),
url('/assets/fonts/firasans.ttf') format('truetype');
font-weight: 400;
font-style: normal;
}
@font-face {
font-family: 'Fira Sans';
src: local('Fira Sans Italic'),
local('FiraSans-Italic'),
url('/assets/fonts/firasansitalic.woff2') format('woff2'),
url('/assets/fonts/firasansitalic.woff') format('woff'),
url('/assets/fonts/firasansitalic.ttf') format('truetype');
font-weight: 400;
font-style: italic;
}
@font-face {
font-family: 'Fira Sans';
src: local('Fira Sans Medium'),
local('FiraSans-Medium'),
url('/assets/fonts/firasansmedium.woff2') format('woff2'),
url('/assets/fonts/firasansmedium.woff') format('woff'),
url('/assets/fonts/firasansmedium.ttf') format('truetype');
font-weight: 500;
font-style: normal;
}
@font-face {
font-family: 'Fira Sans';
src: local('Fira Sans Medium Italic'),
local('FiraSans-MediumItalic'),
url('/assets/fonts/firasansmediumitalic.woff2') format('woff2'),
url('/assets/fonts/firasansmediumitalic.woff') format('woff'),
url('/assets/fonts/firasansmediumitalic.ttf') format('truetype');
font-weight: 500;
font-style: italic;
}
@font-face {
font-family: 'Fira Sans';
src: local('Fira Sans SemiBold'),
local('FiraSans-SemiBold'),
url('/assets/fonts/firasanssemibold.woff2') format('woff2'),
url('/assets/fonts/firasanssemibold.woff') format('woff'),
url('/assets/fonts/firasanssemibold.ttf') format('truetype');
font-weight: 600;
font-style: normal;
}
@font-face {
font-family: 'Fira Sans';
src: local('Fira Sans SemiBold Italic'),
local('FiraSans-SemiBoldItalic'),
url('/assets/fonts/firasanssemibolditalic.woff2') format('woff2'),
url('/assets/fonts/firasanssemibolditalic.woff') format('woff'),
url('/assets/fonts/firasanssemibolditalic.ttf') format('truetype');
font-weight: 600;
font-style: italic;
}
@font-face {
font-family: 'Fira Sans';
src: local('Fira Sans Bold'),
local('FiraSans-Bold'),
url('/assets/fonts/firasansbold.woff2') format('woff2'),
url('/assets/fonts/firasansbold.woff') format('woff'),
url('/assets/fonts/firasansbold.ttf') format('truetype');
font-weight: 700;
font-style: normal;
}
@font-face {
font-family: 'Fira Sans';
src: local('Fira Sans Bold Italic'),
local('FiraSans-BoldItalic'),
url('/assets/fonts/firasansbolditalic.woff2') format('woff2'),
url('/assets/fonts/firasansbolditalic.woff') format('woff'),
url('/assets/fonts/firasansbolditalic.ttf') format('truetype');
font-weight: 700;
font-style: italic;
}
Binary file added tmpl/assets/fonts/firasans.ttf
Binary file not shown.
Binary file added tmpl/assets/fonts/firasans.woff
Binary file not shown.
Binary file added tmpl/assets/fonts/firasans.woff2
Binary file not shown.
Binary file added tmpl/assets/fonts/firasansbold.ttf
Binary file not shown.
Binary file added tmpl/assets/fonts/firasansbold.woff
Binary file not shown.
Binary file added tmpl/assets/fonts/firasansbold.woff2
Binary file not shown.
Binary file added tmpl/assets/fonts/firasansbolditalic.ttf
Binary file not shown.
Binary file added tmpl/assets/fonts/firasansbolditalic.woff
Binary file not shown.
Binary file added tmpl/assets/fonts/firasansbolditalic.woff2
Binary file not shown.
Binary file added tmpl/assets/fonts/firasansbook.ttf
Binary file not shown.
Binary file added tmpl/assets/fonts/firasansbook.woff
Binary file not shown.
Binary file added tmpl/assets/fonts/firasansbook.woff2
Binary file not shown.
Binary file added tmpl/assets/fonts/firasansbookitalic.ttf
Binary file not shown.
Binary file added tmpl/assets/fonts/firasansbookitalic.woff
Binary file not shown.
Binary file added tmpl/assets/fonts/firasansbookitalic.woff2
Binary file not shown.
Binary file added tmpl/assets/fonts/firasansextralight.ttf
Binary file not shown.
Binary file added tmpl/assets/fonts/firasansextralight.woff
Binary file not shown.
Binary file added tmpl/assets/fonts/firasansextralight.woff2
Binary file not shown.
Binary file added tmpl/assets/fonts/firasansextralightitalic.ttf
Binary file not shown.
Binary file added tmpl/assets/fonts/firasansextralightitalic.woff
Binary file not shown.
Binary file added tmpl/assets/fonts/firasansextralightitalic.woff2
Binary file not shown.
Binary file added tmpl/assets/fonts/firasansitalic.ttf
Binary file not shown.
Binary file added tmpl/assets/fonts/firasansitalic.woff
Binary file not shown.
Binary file added tmpl/assets/fonts/firasansitalic.woff2
Binary file not shown.
Binary file added tmpl/assets/fonts/firasanslight.ttf
Binary file not shown.
Binary file added tmpl/assets/fonts/firasanslight.woff
Binary file not shown.
Binary file added tmpl/assets/fonts/firasanslight.woff2
Binary file not shown.
Binary file added tmpl/assets/fonts/firasanslightitalic.ttf
Binary file not shown.
Binary file added tmpl/assets/fonts/firasanslightitalic.woff
Binary file not shown.
Binary file added tmpl/assets/fonts/firasanslightitalic.woff2
Binary file not shown.
Binary file added tmpl/assets/fonts/firasansmedium.ttf
Binary file not shown.
Binary file added tmpl/assets/fonts/firasansmedium.woff
Binary file not shown.
Binary file added tmpl/assets/fonts/firasansmedium.woff2
Binary file not shown.
Binary file added tmpl/assets/fonts/firasansmediumitalic.ttf
Binary file not shown.
Binary file added tmpl/assets/fonts/firasansmediumitalic.woff
Binary file not shown.
Binary file added tmpl/assets/fonts/firasansmediumitalic.woff2
Binary file not shown.
Binary file added tmpl/assets/fonts/firasanssemibold.ttf
Binary file not shown.
Binary file added tmpl/assets/fonts/firasanssemibold.woff
Binary file not shown.
Binary file added tmpl/assets/fonts/firasanssemibold.woff2
Binary file not shown.
Binary file added tmpl/assets/fonts/firasanssemibolditalic.ttf
Binary file not shown.
Binary file added tmpl/assets/fonts/firasanssemibolditalic.woff
Binary file not shown.
Binary file added tmpl/assets/fonts/firasanssemibolditalic.woff2
Binary file not shown.
5 changes: 5 additions & 0 deletions tmpl/assets/jquery-custom.min.js

Large diffs are not rendered by default.

Binary file added tmpl/assets/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit d6a65b7

Please sign in to comment.