Code Monkey home page Code Monkey logo

gostatic's Introduction

gostatic's People

Contributors

abh avatar akerl avatar brenthuisman avatar cameronelliott avatar dottedmag avatar flicaflow avatar gearheart avatar holic avatar iand avatar juev avatar krpors avatar mechmind avatar minhajuddin avatar pidpawel avatar piranha avatar pranavraja avatar q3k avatar rowdypixel avatar temoto avatar waldyrious avatar whilei avatar zhuharev avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

gostatic's Issues

[support] Sorting tags

Hi,

I have this:

<div class="tag-list">
<ul class="glossari">
{{ range .Site.Pages.Children "tags/" }}
  {{ if .Title }}
    <li> <a href="{{ $.Rel .Url }}">{{ .Title }}</a> ({{ with .Site.Pages.WithTag .Title }}{{ .Len }}{{ end }})</li>
  {{ end }}
{{ end }}
</ul>
</div>

and I want to sort .Site.Pages.Children "tags/" alphabetically

Please consider using YAML standard syntax

Hi,

I noticed gostatic uses ---- for marking the end of YAML header. Following the [official specification[(http://www.yaml.org/spec/1.2/spec.html) --- marks the beginning and ... marks the end. Please consider to change gostatic accordingly. Something like:


---
date: 2015-10-01
title: GFoo
...
Hi. This is a post.

[FR] Permalink: опция для использования варианта Jekyll-ссылок

GoStatic появился позже, чем Jekyll, в связи с чем многие имеют блоги именно на Jekyll. При попытке миграции с Jekyll на GoStatic приходиться переименовывать файлы со статьями, воссоздавая всю структуру, что ранее генерировалась автоматически движком.

К примеру, имя файла 2014-04-12-drafts.markdown и при параметре permalink: pretty в конфигурации Jekyll будет создана следующая структура:

- 2014
  |- 04
     |- 12
        |- drafts
           |- index.html

В gostatic для этого придется изначально создавать структуру:

- 2014
  |- 04
     |- 12
        |- drafts.md

Переименование файлов затратная по времени, тем более, если статей много. Плюс, подобную структуру директорий сложно поддерживать. Так как для того, чтобы изменить статью, придется переходить по всему дереву папок.

Почему бы не оставить вариант, что используется в gostatic сейчас, и добавить к нему опцию, с помощью которой можно было бы переключаться на вариант автоматической генерации структуры директорий, как в Jekyll. Одна опция для включения данной возможности, вторая опция для задания варианта структуры на основании имени файла.

Документация по возможным вариантам permalink в Jekyll доступна на странице:
http://jekyllrb.com/docs/permalinks/

Can't compile under "tip" Go (1.1)

Using the "tip" Go (what will become 1.1) gostatic errors out with:

$ go build
# github.com/piranha/gostatic
./processors.go:75: initialization loop:
    /Users/ask/go/src/github.com/piranha/gostatic/processors.go:75 Processors refers to
    /Users/ask/go/src/github.com/piranha/gostatic/processors.go:213 ProcessTags refers to
    /Users/ask/go/src/github.com/piranha/gostatic/page.go:107 (*Page).peek refers to
    /Users/ask/go/src/github.com/piranha/gostatic/processors.go:94 ProcessCommand refers to
    /Users/ask/go/src/github.com/piranha/gostatic/processors.go:75 Processors

Markdown rendering - footnotes extension

Hi,

I noticed that the Markdown processor being created in utils.go doesn't have blackfriday.EXTENSION_FOOTNOTES enabled, and there doesn't seem to be an easy way to override the enabled extensions:

func Markdown(source string) string {
        // set up the HTML renderer
        flags := 0
        flags |= bf.HTML_USE_SMARTYPANTS
        flags |= bf.HTML_SMARTYPANTS_FRACTIONS
        renderer := bf.HtmlRenderer(flags, "", "")

        // set up the parser
        ext := 0
        ext |= bf.EXTENSION_NO_INTRA_EMPHASIS
        ext |= bf.EXTENSION_TABLES
        ext |= bf.EXTENSION_FENCED_CODE
        ext |= bf.EXTENSION_AUTOLINK
        ext |= bf.EXTENSION_STRIKETHROUGH
        ext |= bf.EXTENSION_SPACE_HEADERS

        return string(bf.Markdown([]byte(source), renderer, ext))
}
  • Would you accept a pull request that enabled EXTENSION_FOOTNOTES by default? As I understand, it's an additive feature and won't break any existing rendering.
  • If not, is there an easy way for me to override/enable this from a config, without patching the gostatic source code?

Thanks
pranav

Error under Windows

C:\go-site>gostatic-windows.exe test/config
2013/01/21 00:09:36 ERR command 'lessc' not found

after deleting lessc line from config file (sorry, just wanted to get quick result), site was generated but in little bit strange way - /test/out/blog/index.html does not show list of entries. May be that is the way how your test site supposed to be rendered.

Get a list of pages by pattern

I'm creating an RSS feed for my posts and it'd be great to be able to get all posts under a specific pattern, e.g.

{{ range .Site.Pages.WithPattern "*.md" }}
  {{ .Content }}
{{ end }}

Pagination

Jekyll supports the concept of pagination: http://jekyllrb.com/docs/pagination/

Is it possible to add a (pre)processor like this to gostatic? I took a stab at it, but didn't have much luck as I've never written any Go.

Ideally, I'd be able to paginate a set of pages matched by a rule, e.g.

posts/*.md:
  config
  paginate 10 posts/*.page
  ext .html
  markdown
  template post

posts/*.page:
  ext .html
  template page
  markdown
  template list

The command paginate 10 posts/*.page translates to 10 posts per page (populates a root-level .Pages instead of the site-level .Site.Pages with the posts) replacing * as the page number in the output file.

including content from another page

Unless I'm mistaken, it is not possible to do this:

{{range .Site.Pages.Children "/blog/"}}
    <div class="post">{{ .Content }}</div>
{{end}}

This won't work because the pages concerned are processed before they are included, Which means .Content contains the page after all transformations applied.

Gostatic as library

What do you think about how to rewrite the code as library, like this?

This will facilitate the development of modules and control systems.

Go runtime error when building test site

gostatic exits with a runtime error when I'm trying to build the test site from the repository.

panic: runtime error: index out of range

goroutine 1 [running]:
main.(*SiteConfig).ParseRule(0xf840001640, 0xf8400b16b2, 0x4, 0x3d00000001, 0xffffffff, ...)
    /home/helm/Devel/gostatic/config.go:126 +0x75
main.NewSiteConfig(0x7fffa63208fc, 0x6, 0xf840071f20, 0xf840071fe0, 0xf8400b1380, ...)
    /home/helm/Devel/gostatic/config.go:86 +0x503
main.main()
    /home/helm/Devel/gostatic/gostatic.go:66 +0x1ef

goroutine 2 [syscall]:
created by runtime.main
    /build/buildd/golang-1.0.2/src/pkg/runtime/proc.c:221

Building solovyov.net works without problems.

CRLF newlines problems

Hello, in the last few days I've started to work on a project using gostatic and I can't seem to get it to work as (I) expected. In the result I get, the first page is fine but it seems like the second one is processed but its properties aren't accessible, i.e. the title is empty.
There must be something I'm doing wrong but I can't figure out what and it's frustrating.
Also, I don't know why but the rules in the config file made the files in the static folder to be consiedered as pages O_o. That made me think that maybe a "copy" processor would be welcome, to copy the contents of a folder instead of processing it.
I'm using a markdown for the page that should be processed "as is" and a GoTemplate for the one that's going to need more processing once it get it to render correctly.

My config file looks like this (it has to be UTF-8):

TEMPLATES = site.tmpl
SOURCE = src
OUTPUT = site
TITLE = La bétonneuse
AUTHOR = Guillaume Veys - La bétonneuse

*.md:
    config
    ext .html
    markdown
    template page

*.html:
    config
    ext .html
    inner-template
    template page

And in the src folder contains index.md:

title: Accueil
description: Page d'accueil
----
<h1>Bienvenue</h1>
<p>Bienvenue chez moi !</p>
<p>Texte</p>

and logiciels.html:

title: Logiciels
description: Mes logiciels
----
<p>Voici la liste des logiciels que je vous propose {{ .Title }} :</p>
<p>
    <ul class="logiciels">
        <li>Logiciel 1</li>
        <li>Logiciel 2</li>
    </ul>
</p>

site.tmpl looks like this:

{{ define "header" }}<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<?xml version="1.0" encoding="iso-8859-1" ?>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr" lang="fr">
<head>
    <meta charset="utf-8">
    <meta name="author" content="{{ html .Site.Other.Author }}">
    <title>{{ if .Title }}{{ html .Title }} - {{ end }}{{ html .Site.Other.Title }}</title>
    <link rel="stylesheet" type="text/css" href="{{ .Rel "resources/style/style.css" }}">
    <link href="{{ .Rel "favicon.ico" }}" type="image/x-icon" rel="shortcut icon" />
</head>
<body>
    <div class="bandeau">
        <a href="./" title="{{ html .Site.Other.Title }} - Cliquez ici pour retourner &agrave; la page d'accueil.">La b&eacute;tonneuse</a>
    </div>
    <div id="navigation">
        <ul>{{ range $i, $page := .Site.Pages }}
            <li><a href="{{ $page.Path }}" title="{{ if $page.Other.Description }}{{ html $page.Other.Description }}{{ else }}{{ html $page.Title }}{{ end }}">{{ html $page.Title }}</a></li>{{ end }}
        </ul>
    </div>
    <div id="contenu">
{{ end }}

{{ define "footer" }}
        <div class="validation">
            <a href="http://validator.w3.org/check?uri=referer" title="Ce site est conforme au XHTML 1.0 transitionnel."
                onclick="this.target='_blank';">
                <img src="{{ .Rel "resources/images/valid_xhtml_10.png" }}" width="40" height="14" alt="Conforme au XHTML 1.0 transitionnel." /></a>
            <a href="http://jigsaw.w3.org/css-validator/check/referer" title="Ce site est conforme &agrave; CSS 2."
                onclick="this.target='_blank';">
                <img src="{{ .Rel "resources/images/valid_css.png" }}" width="40" height="14" alt="Conforme &agrave; CSS 2." /></a>
        </div>
    </div>
</body>
</html>
{{ end }}

{{ define "page" }}{{ template "header" . }}
    {{ .Content }}
{{ template "footer" . }}{{ end }}

In the resulting pages, I get

    <div id="navigation">
        <ul>
            <li><a href="index.html" title="Page d&#39;accueil">Accueil</a></li>
            <li><a href="logiciels.html" title=""></a></li>
        </ul>
    </div>
...

    title: Logiciels
description: Mes logiciels
----
<p>Voici la liste des logiciels que je vous propose  :</p>
<p>
    <ul class="logiciels">
        <li>Logiciel 1</li>
        <li>Logiciel 2</li>
    </ul>
</p>

As you can see, the meta-data isn't used for the "logiciels" page. What am I doing wrong?

It also contains

<title>Accueil - La bétonneuse</title>

in the header, wile I expected

<title>Accueil - La b&eacute;tonneuse</title>

Thanks a lot!

[question] Generating sitemap with priority

Hi,

I want to generate a sitemap.xml. I have this preliminary version:

<?xml version='1.0' encoding='UTF-8'?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
{{ with .Site.Pages.Children "" }}
{{ range .Slice 0 50000 }}
<url>
  <loc>{{ .Site.Other.Url }}/{{ .Url }}</loc>
  <lastmod>{{ .ModTime.Format "2006-01-02T15:04:05Z07:00" }}</lastmod>
  <changefreq>weekly</changefreq>
</url>
{{ end }}
{{ end }}
</urlset>

But now I want to specify the priority. I want gostatic to put priority 0.8 in about page. This code:

  {{ if (.Url == "About") }}
  <priority>0.8</priority>
  {{ end }}

does not run. How can I achieve that?

Thanks a lot,

Missing Atom feed

Example website has links to blog.atom, but this file is not generated.

Watcher doesn't detect changes to site template

Hi,

With the --watch option provided, I've noticed that only the source directory is watched for changes:

filemod, err := DirWatcher(config.Source)

However, I believe changes to the site.tmpl or the config should also trigger a rebuild, as the HTML output could change.

Support templates folder?

I'm creating a lot of templates so the TEMPLATES line of config is getting rather long. It would be nice if you could specify a folder TEMPLATES = templates/ (or something similar) and that all templates of that folder would be parsed.

Something like this seems to work (config.go:110):

    case "TEMPLATES":
        templates := strings.Split(bits[1], " ")
        for _, template := range templates {
            if strings.HasSuffix(template, "/") {
                files, _ := filepath.Glob(template + "*.tmpl")
                for _, file := range files {
                    cfg.Templates = append(cfg.Templates, filepath.Join(base, file))
                }
                continue
            }
            cfg.Templates = append(cfg.Templates, filepath.Join(base, template))
        }
    case "SOURCE":

[support] get subdirectories in config

If in src I have content directory which have many subdirectories, how can I check if the files *.md in all subdirectories change?

Something like

content/*/*.md: src/acm-mod.csl, src/static/files/biblio.bib
                         fooo

Thanks

Page Sorting

I'm a n00b as far as go templates go so I couldn't find a way to sort pages. At the moment, I don't know how the pages are sorted but it's not always the same.
At the moment, there are only two pages on my site and sometimes the home page comes second when I build the menu. I thought I could use the pages' properties (.Other.Order) but I couldn't find the syntax for it.
Could you please tell me how it's possible to do that? (If it is at all)
Then there's what I believe to be a real issue with the inconsistent ordering of pages from one build to another.
Cheers. :)

Rename processor is too simplistic

It can perform only the most basic actions and should be improved.

If you have rule like that:

inner/*.md:
    rename ../*.html

This should change extension and move a file up one level. How to do that? My idea is to convert file pattern (inner/*.md) to regular expression, find out file name, then put it into replacement rule and join it with current directory of a file.

Is there any problems with such approach? I do not see them currently.

Very small README change needed

Currently the readme says:

Run gostatic -i my-site to generate basic site in directory name.

It would be less confusing to newcomers to change this to:

Run gostatic -i my-site to generate basic site in directory my-site.

Bug with no src directory

hi,

I have this:


$ ls
config  Seguretat-016.md  site.tmpl
[xan@rulot d]$ gostatic config 
fatal error: all goroutines are asleep - deadlock!

goroutine 1 [chan send]:
main.func·005(0x1884c1bf, 0x3, 0x0, 0x0, 0xb7566bc0, ...)
    /home/xan/go/src/github.com/piranha/gostatic/site.go:60 +0x50
path/filepath.Walk(0x1884c1bf, 0x3, 0x1880a860, 0x1881da50, 0xb747beb8)
    /usr/lib/go/src/pkg/path/filepath/path.go:378 +0x71
main.(*Site).Collect(0x18855140)
    /home/xan/go/src/github.com/piranha/gostatic/site.go:46 +0x72
main.NewSite(0x1881d3c0, 0x0)
    /home/xan/go/src/github.com/piranha/gostatic/site.go:30 +0x13d
main.main()
    /home/xan/go/src/github.com/piranha/gostatic/gostatic.go:85 +0x3c1

only with


TEMPLATES = site.tmpl
SOURCE = src
OUTPUT = site

# this is a comment
*.md:
    config
    ext .html
    directorify
    tags tags/*.tag
    markdown
    template page # yeah, this is a comment as well

So no src directory, implies bug.

Can you fix it? Verbose a message

Include template changes when determining which pages to re-render

Is it possible that the re-rendering of only changed files can include template changes as well? And any pages using those templates?

For example, if I change archive.tmpl, then all the pages using that template should be re-rendered on gostatic config.

Gostatic is already blazing fast (~4 seconds for a full render instead of ~2 minutes with Jekyll), but just curious if it can be even smarter about what it chooses to re-render. :)

Inner template as a template func

Continuing from #34 (comment)

In pagination, I'm using the .Raw content to extract an "excerpt" from each post:

{{ define "excerpt" }}

{{ $more := "\n<!-- more -->\n" }}
{{ $excerpt_open := "<!-- excerpt -->\n" }}
{{ $excerpt_close := "\n<!-- /excerpt -->" }}

{{ if contains $more .Raw }}
    {{ .Raw | cut "" $more | markdown }}
{{ else if contains $excerpt_open .Raw }}
    {{ .Raw | cut $excerpt_open $excerpt_close | markdown }}
{{ else }}
    {{ .Raw | cut "" "\n\n" | markdown }}
{{ end }}

{{ end }}

However, in some cases, the .Raw may contain a template include (e.g. {{ template "youtube" "someid" }} for easier YouTube embeds). Because I'm pulling this from the .Raw content, the template tag is never parsed, so the rendered excerpt on the pagination pages uses the literal {{ template ...}} syntax rather than having it rendered (like inner-template).

I tried adding an inner-template step after the template that creates the excerpt:

pages/*.page: */*/*.md
    rename ../page-*
    ext .html
    directorify
    template archive
    inner-template
    template page

However, the markdown filter/template func in the excerpt template above escapes the " and results in the template string looking like {{ template &quot;youtube&quot; ...}} which results in the following error:

template: ad-hoc:156: unexpected "&" in template invocation

There's two ways I can see this getting fixed.

  1. Move some of the logic of ProcessInnerTemplate into a template function so it can be called like `{{ .Raw | cut "" "\n\n" | render | markdown }} so that the inner template is rendered before processing as Markdown (and ultimately escaping quotes and other HTML entities).

  2. Overwrite page.raw after making a call to the inner-template step in the config, so that ProcessInnerTemplate ends with:

    page.SetContent(buffer.String())
    page.raw = page.Content()
    

The second option does work, but it feels a bit dirty/hacky because we don't know when/where inner-template might be used in the build step. So it might be better to implement it as a template function as described in the first option.

Thoughts?

"site" folder cleanup?

Do you think it would be relevant to have a cleanup command-line switch that would remove all the files that aren't supposed to exist anymore? (and keep the ones that haven't changed)
I wrote a "make-cleanup" batch script that does it but it simply empties the site folder, I'm not sure what's going to happen when I start uploading updates: will the ftp client rely on dates to know if the file has changed?
Thanks. :)

[support] What's the best wat to get excerpt of page?

Hi,

In my blog, I use excerpt of pages. I get this with this code:

<ul class="blocks-3">
{{ range .Site.Pages.Children "posts/" }}

  <li class="marc">
    <div class="marc-content">{{ markdown (truncate 330 .Raw) }}...</div>
    <div class="marc-title">
     <a href="{{ $.Rel .Url }}">{{ .Title }}</a>
     <div class="meta">{{ template "date" .Date }}</div>
    </div>
  </li>

{{ end }}
</ul>

but it does not convince me at all. I want to get something like this.

How can be done?
Thanks in advance,

[support] .Exec does not work in atom template

Hi,

I have this code:

<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xmlns:thr="http://purl.org/syndication/thread/1.0">
  <id>{{ .Site.Other.Url }}</id>
  <title>{{ .Site.Other.Title }}</title>
  {{ with .Site.Pages.Children "posts/" }}
  <updated>{{ .First.Date.Format "2006-01-02T15:04:05Z07:00" }}</updated>
  {{ end }}
  <author><name>{{ .Site.Other.Author }}</name></author>
  <link href="{{ .Site.Other.Url }}" rel="alternate"></link>
  <generator uri="http://github.com/piranha/gostatic/">gostatic</generator>

{{ with .Site.Pages.Children "posts/" }}
{{ range .Slice 0 5 }}
<entry>
  <id>{{ .Url }}</id>
  <author><name>{{ or .Other.Author .Site.Other.Author }}</name></author>
  <title type="html">{{ html .Title }}</title>
  <published>{{ .Date.Format "2006-01-02T15:04:05Z07:00" }}</published>
  {{ range .Tags }}
  <category term="{{ . }}"></category>
  {{ end }}
  <link href="{{ .Site.Other.Url }}/{{ .Url }}" rel="alternate"></link>
  <content type="text">    
    {{ .Raw }}
  </content>
</entry>
{{ end }}
{{ end }}
</feed>

When I add .Exec part, then no results are get with .Exec and .Raw part:

<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xmlns:thr="http://purl.org/syndication/thread/1.0">
  <id>{{ .Site.Other.Url }}</id>
  <title>{{ .Site.Other.Title }}</title>
  {{ with .Site.Pages.Children "posts/" }}
  <updated>{{ .First.Date.Format "2006-01-02T15:04:05Z07:00" }}</updated>
  {{ end }}
  <author><name>{{ .Site.Other.Author }}</name></author>
  <link href="{{ .Site.Other.Url }}" rel="alternate"></link>
  <generator uri="http://github.com/piranha/gostatic/">gostatic</generator>

{{ with .Site.Pages.Children "posts/" }}
{{ range .Slice 0 5 }}
<entry>
  <id>{{ .Url }}</id>
  <author><name>{{ or .Other.Author .Site.Other.Author }}</name></author>
  <title type="html">{{ html .Title }}</title>
  <published>{{ .Date.Format "2006-01-02T15:04:05Z07:00" }}</published>
  {{ range .Tags }}
  <category term="{{ . }}"></category>
  {{ end }}
  <link href="{{ .Site.Other.Url }}/{{ .Url }}" rel="alternate"></link>
  <content type="text">
    {{ .Exec "/bin/bash" "-c" "pandoc --mathjax --smart --toc --from markdown+auto_identifiers+table_captions+simple_tables+strikeout+tex_math_dollars+raw_html+footnotes+inline_notes+citations --to html5 --biblio biblio.bib --csl=acm-mod.csl" }}

    {{ .Raw }}
  </content>
</entry>
{{ end }}
{{ end }}
</feed>

i18n

Is it possible to translate the blog? That is, gostatic could generate .pot and .po files and then we translate it....? Mark it as wish for 3.0

Please choose a license

The repository does not specify under which license the code is distributed. As the readme clearly encourages users to downlad and use the software, a license allowing them to do so would be nice. I enjoyed cyrax license ;)

[support] How to check wether a file exists?

I have this:

         <img class="img-fluid" src="/media/3-acts/{{ .Other.Identity }}/shot.png" alt="preview image" style="width: 100%;">

How can I check in template if the file /media/3-acts/{{ .Other.Identity }}/shot.png exists or not?

Thanks,

Вопрос по шаблонам

С параметрами, что задаются в шапке каждого файла вроде разобрался, доступ к ним осуществляется через .Other и последующим описанием параметра с большой буквы.

А каким образом можно получить информацию о предыдущей и следующей странице относительно текущей? Вижу в описании .Prev и .Next, параметры которые возвращают соответствующие страницы, но как можно получить так же и информацию по ним? К примеру, название и полный адрес этой страницы?

Понемногу разбираюсь, но думаю, еще не скоро во всем разберусь, так как в своем шаблоне страницы использую массу проверок и различных переменных:
https://github.com/Juev/juev.ru/blob/master/source/_layouts/default.html

File with CRLF + markdown renderered incorrectly

In before this gets lost from my memory: source pages which are in markdown format, with some front matter, are rendered incorrectly when their EOL is set to CRLF. To reproduce:

  1. Run gostatic -i bughunt
  2. Change bughunt/src/index.html to have CRLF line endings
  3. Run gostatic bughunt/config
  4. Observe bughunt/site/index.html.

LF version (correct):

<title>Example Site: Main Page</title>
...
<body>

  <ul class="post-list">

  <li>

CRLF version (incorrect):

<title>Example Site</title>
....
<body>

  title: Main Page
----
<ul class="post-list">

  <li>

Support make variables

Can you support variables alà make in config. An example could be:

TEMPLATES = tmpl/site.tmpl
SOURCE = src
OUTPUT = site
TITLE = somenxavier.xyz
URL = http://somenxavier.xyz
AUTHOR = Xavier Bordoy
PANDOC = pandoc --mathjax --smart --toc --from markdown+auto_identifiers+table_captions+simple_tables+strikeout+tex_math_dollars+raw_html+footnotes+inline_notes+citations --to html5 --biblio src/biblio.bib --csl=src/acm-mod.csl

# Each post
posts/*.md: src/acm-mod.csl
    config
    ext .html
    directorify
    tags tags/*.tag
    external $(PANDOC)
    # markdown
    template post
    template page

Thanks,

Handling deleted pages

I'm wondering if there's a way to handle deleted pages? It would be great if running gostatic config with some flag would detect which pages in the OUTPUT dir weren't touched by gostatic and remove them.

Lock down dependencies

I'm not sure how best to do this in the Go universe (I've seen https://github.com/tools/godep), but it would be great to lock down external dependencies to a specific version/revision so that site builds are entirely reproducible. I'm seeing some differences between sites generated on a server with a fresh install of gostatic vs. my local copy.

Thoughts?

minor bug in blog.atom in example template

Hi,

in blog.atom, generated by gostatic -i, please change:

  <link href="{{ .Site.Other.Url }}{{ .Url }}" rel="alternate"></link>

with

  <link href="{{ .Site.Other.Url }}/{{ .Url }}" rel="alternate"></link>

because usually the site is typed without final trail slash (like google.com and not google.com/). Perhaps you could improve that with an if...

Thanks,

[support] multiple input in range .Site.Pages.Children

I have this

<ul reversed class="post-list">
{{ range .Site.Pages.Children "Foo/" }}
  <li>{{ template "date" .Date }} - <a href="{{ $.Rel .Url }}">{{ .Title }}</a></li>
{{ end }}
</ul>

Can I have this?

<ul reversed class="post-list">
{{ range .Site.Pages.Children "Foo/" "Baa/" }}
  <li>{{ template "date" .Date }} - <a href="{{ $.Rel .Url }}">{{ .Title }}</a></li>
{{ end }}
</ul>

Escaping

Placing AUTHOR = i "am" the walrus into config generates invalid HTML <meta name="author" content="i "am" the walrus">.

Проблема при сборке сайта

Пытаюсь перенести свой сайт на gostatic, взял статьи, переконвертировал заголовки файлов, разместил в репозитории https://github.com/Juev/juevru-posts

За основу брался темплейт по умолчанию, менялись только файлы статей и в конфиге изменил расширение на markdown.

При попытке сборки, получаю ошибку:

C:\U\e\Projects\my-site> make
gostatic config
panic: runtime error: index out of range

goroutine 1 [running]:
runtime.panic(0x6d5bc0, 0xa844d7)
        /usr/local/Cellar/go/1.2/libexec/src/pkg/runtime/panic.c:266 +0xc8
main.(*PageHeader).ParseLine(0xc0840609b0, 0xc08406e7e2, 0x3, 0xc084059f80)
        /Users/piranha/dev/go/src/gostatic/header.go:44 +0x1b1
main.ParseHeader(0xc08406e700, 0x1dfd, 0x72e680)
        /Users/piranha/dev/go/src/gostatic/header.go:95 +0x333
main.ProcessConfig(0xc084030c40, 0xc08405e5e0, 0x0, 0x0)
        /Users/piranha/dev/go/src/gostatic/processors.go:235 +0x132
main.ProcessCommand(0xc084030c40, 0xc084005d00)
        /Users/piranha/dev/go/src/gostatic/processors.go:113 +0x31c
main.(*Page).peek(0xc084030c40)
        /Users/piranha/dev/go/src/gostatic/page.go:131 +0xd1
main.NewPage(0xc084005380, 0xc0840649f0, 0x26, 0x44c976)
        /Users/piranha/dev/go/src/gostatic/page.go:65 +0x272
main.(*Site).AddPage(0xc084005380, 0xc0840649f0, 0x26)
        /Users/piranha/dev/go/src/gostatic/site.go:37 +0x3e
main.func┬╖005(0xc0840649f0, 0x26, 0x3512f0, 0xc084006f00, 0x0, ...)
        /Users/piranha/dev/go/src/gostatic/site.go:65 +0x15f
path/filepath.walk(0xc0840649f0, 0x26, 0x3512f0, 0xc084006f00, 0xc084059d20, ...)
        /usr/local/Cellar/go/1.2/libexec/src/pkg/path/filepath/path.go:341 +0x75
path/filepath.walk(0xc08405e550, 0x8, 0x3512f0, 0xc084006cc0, 0xc084059d20, ...)
        /usr/local/Cellar/go/1.2/libexec/src/pkg/path/filepath/path.go:359 +0x33b
path/filepath.walk(0xc08401f71f, 0x3, 0x3512f0, 0xc084006c00, 0xc084059d20, ...)
        /usr/local/Cellar/go/1.2/libexec/src/pkg/path/filepath/path.go:359 +0x33b
path/filepath.Walk(0xc08401f71f, 0x3, 0xc084059d20, 0x716200, 0x0)
        /usr/local/Cellar/go/1.2/libexec/src/pkg/path/filepath/path.go:380 +0xba
main.(*Site).Collect(0xc084005380)
        /Users/piranha/dev/go/src/gostatic/site.go:46 +0x7c
main.NewSite(0xc0840067e0, 0x0)
        /Users/piranha/dev/go/src/gostatic/site.go:30 +0x16e
main.main()
        /Users/piranha/dev/go/src/gostatic/gostatic.go:85 +0x4d0
make: *** [compile] Error 2

Пробовал оставлять только одну, самую последнюю статью, компиляция проходит успешно. Точно могу сказать что один из проблемых файлов:
https://github.com/Juev/juevru-posts/blob/master/2014-03-30-duplicity.markdown

Но что конкретно в нем не так, понять не могу.

Arrays in page config?

Thanks for a nice tool. One thing that I think would be useful is the possibility to define arrays in the page config. I have some pages that for instance need additional css and js files.

title: Main Page
morestyles: app1.css app2.css
----

Then in my header template I would do something like this:

{{ range .Other.Morestyles }}
      <link href="{{ . }}" rel="stylesheet">
{{ end }}

Does this seem reasonable or is there a better way of doing this with gostatic?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.