Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

added an init function and a book template for init generation

  • Loading branch information...
commit a55a2e4bf73de398c599bacd12f4d0f89556a9c4 1 parent 53a080f
Scott Chacon authored
View
6 README.asciidoc
@@ -44,14 +44,18 @@ For local generation (evenutally pushing to GitHub will handle gen for you), it
Usage
=====
-Initialize a new book with `init` (not yet completed).
+Initialize a new book with `init`:
$ git scribe init
This will set up the outline for your book. All the book content goes into the 'book' subdirectory with 'book.asc' as the starting point. If you want to split the writing up into multiple files you can simply include them in the book.asc file.
+Then you can generate your book content with the 'git scribe gen' command:
+
$ git scribe gen [site|html|pdf|epub|mobi|all]
+Eventually, simply pushing to GitHub will take care of this for you.
+
Roadmap
=======
View
7 lib/git-scribe.rb
@@ -35,6 +35,13 @@ def help
# start a new scribe directory with skeleton structure
def init
+ name = @args.shift
+ die("needs a directory name") if !name
+ die("directory already exists") if File.exists?(name)
+
+ puts "inititalizing #{name}"
+ from_stdir = File.join(SCRIBE_ROOT, 'template')
+ FileUtils.cp_r from_stdir, name
end
# check that we have everything needed
View
1  template/.gitignore
@@ -0,0 +1 @@
+output
View
5 template/.gitscribe
@@ -0,0 +1,5 @@
+---
+publish: true
+edition: 0.1
+language: en
+version: 1.0
View
1  template/LICENSE
@@ -0,0 +1 @@
+This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License. To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-sa/3.0/ or send a letter to Creative Commons, 171 Second Street, Suite 300, San Francisco, California, 94105, USA.
View
9 template/README.asciidoc
@@ -0,0 +1,9 @@
+This Book
+=========
+
+This book is written using using the git-scribe toolchain, which can be found at:
+
+http://github.com/schacon/git-scribe
+
+Instructions on how to install the tool and use it for things like editing this book,
+submitting errata and providing translations can be found at that site.
View
58 template/book/book.asc
@@ -0,0 +1,58 @@
+Book Title
+==========
+:Author: Your Name
+:Email: <your@email.com>
+
+== Introduction
+
+The introduction for the book could go here.
+
+== The first chapter
+
+This is where the first chapter of the book might go. Each chapter
+will be under a seperate heading like that. Images can be embedded
+in the book like this:
+
+image::image/octocat_professor.png[description]
+
+=== Subsection one
+
+You can even do subsections of each chapter.
+
+==== Sub-sub section
+
+And sub-sub-sections of each chapter.
+
+You can also do tips and warning boxes and such like this:
+
+TIP: Tip.
+
+IMPORTANT: This is important.
+
+WARNING: This is a warning.
+
+CAUTION: Tread lightly.
+
+If you need to embed source code, you can do so from external files
+like this:
+
+[c]
+source~~~~
+include::include/hello.c[]
+source~~~~
+
+=== Source Code Highlighting
+
+Or you can put the code directly in the file, like this.
+
+[source,python]
+if n < 0: print 'Hello World!'
+
+=== Splitting up the book
+
+Now, if you prefer to write so that each chapter is in a seperate file,
+which is probably a good idea, you can instead have each chapter as
+another file and then simply add include lines in this file. Here is
+what including another chapter looks like:
+
+include::chapter2.asc[]
View
8 template/book/chapter2.asc
@@ -0,0 +1,8 @@
+== The second chapter
+
+This is a second chapter.
+
+For more information and a fairly nice Asciidoc cheat sheet, see:
+
+http://powerman.name/doc/asciidoc
+
View
BIN  template/book/image/octocat_professor.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
10 template/book/include/hello.c
@@ -0,0 +1,10 @@
+#include <stdio.h>
+
+main()
+{
+ char hex[] = "599955586da1c3ad514f3e65f1081d2012ec862d";
+ git_oid oid;
+
+ git_oid_mkstr(&oid, hex);
+ printf("Raw 20 bytes: [%s]\n", (&oid)->id);
+}
Please sign in to comment.
Something went wrong with that request. Please try again.