Giter Site home page Giter Site logo

gopages's Introduction

// Copyright 2010 Abiola Ibrahim <[email protected]>. All rights reserved.
// Use of this source code is governed by New BSD License
// http://www.opensource.org/licenses/bsd-license.php
// The content and logo is governed by Creative Commons Attribution 3.0
// The mascott is a property of Go governed by Creative Commons Attribution 3.0
// http://creativecommons.org/licenses/by/3.0/

gopages - http://code.google.com/p/gopages
======

A simple web framework that allows embedding pages in <?go ?> tags.

INSTALL
============
-Command
$ go get code.google.com/p/gopages
-Package
$ go get code.google.com/p/gopages/pkg

EXAMPLES
========
$ go get code.google.com/p/gopages/examples
-Run
$ $GOPATH/bin/examples

HELLO WORLD

create a folder 'hello'

create an index.ghtml
-------
 <html> 
 	<body> 
 	<?go print("<h1>Hello World</h1>") ?> 
 	</body> 
 </html> 
-------
then create hello.go
-------
 package main
 
 import (
 	_ "code.google.com/p/gopages/examples/pages"	
	"code.google.com/p/gopages/pkg"
	"net/http"
 )
 
 func main(){
    http.HandleFunc("/", gopages.Handler("hello.ghtml"))
    http.ListenAndServe(":9999", nil)
 }
-------

open terminal

$ cd path/to/project
$ gopages get
$ $GOPATH/bin/hello

finally, point your browser to localhost:9999 

HOW IT WORKS
============
gopages generates go source codes to "pages" directory in your project folder.
It is REQUIRED to run 'gopages' before 'go get' to build the whole project
Or run 'gopages get' to build with 'go get' after generating pages

INBUILT FUNCTIONS
- print(...interface{})
- formValue(string) - retrieve formValue

VARIABLES
writer http.ResponseWriter
request *http.Request

TAGS
=====
-CODE
	<?go ?> 
	e.g. 	"<p> <?go print(i) ?>"
-FRAGMENTS
	<go:include page="path/to/fragment" />
	e.g. 	<go:include page="fragments/login.ghtml" />
			<go:include page="fragments/footer.html" />

	
ADDING SETTINGS
===============
create a pages.json file in project root with the format below.

{
	"extensions" : "ghtml",
	"folders" : "src"
}

extensions - files to generate gopages for [optional][default is "ghtml"]
folders - folders to look for gopages files [optional][default is project root]
-separate multiple values with space. e.g. "extensions": "ghtml ghtm"

gopages's People

Contributors

abiosoft avatar

Watchers

James Cloos avatar Pusparaj Mohanta avatar

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.