Skip to content

Commit

Permalink
Make the frames view the default. (Fixes #30)
Browse files Browse the repository at this point in the history
  • Loading branch information
netzpirat committed Apr 1, 2012
1 parent be32bab commit 96e7f95
Show file tree
Hide file tree
Showing 8 changed files with 29 additions and 81 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
@@ -1,5 +1,6 @@
# Master

- [#30](https://github.com/netzpirat/codo/issues/30): Make the frames view the default. ([@netzpirat][])
- [#35](https://github.com/netzpirat/codo/issues/35): Links aren't working on Class/Module List dropdown for parent nodes. ([@netzpirat][])
- [#15](https://github.com/netzpirat/codo/issues/15): Generate a TOC for file contents. ([@netzpirat][])
- Detect inner (nested) classes. ([@netzpirat][])
Expand Down
45 changes: 10 additions & 35 deletions lib/generator.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

52 changes: 14 additions & 38 deletions src/generator.coffee
Expand Up @@ -25,48 +25,24 @@ module.exports = class Generator
#
#
generate: ->
@generateFrames()
@generateReadme()
@generateIndex()

@generateClasses()
@generateModules()
@generateExtras()
@generateIndex()
@generateLists()
@generateFiles()

@generateClassAndModuleIndex()

@generateClassAndModuleLists()
@generateMethodList()
@generateFileList()

@copyAssets()

# Generate the frame source.
#
generateFrames: ->
@templater.render 'frames', { path: '' }, 'frames.html'

# Generate the home page. This is the readme
#
generateReadme: ->
try
readme = fs.readFileSync @options.readme, 'utf-8'
readme = marked readme if /\.(markdown|md)$/.test @options.readme
filename = 'index.html'

@templater.render 'file', {
path: ''
filename: @options.readme,
content: readme
breadcrumbs: [
{
href: 'class_index.html'
name: 'Index'
}
{
href: "File: #{ filename }"
name: @options.readme
}
]
}, filename

catch error
console.log "[ERROR] Cannot generate readme file #{ @options.readme }: #{ error }"
generateIndex: ->
@templater.render 'frames', { index: @options.readme, path: '' }, 'index.html'

# Generates the pages for all the classes.
#
Expand Down Expand Up @@ -140,7 +116,7 @@ module.exports = class Generator

# Generates the pages for all the extra files.
#
generateExtras: ->
generateFiles: ->
for extra in _.union [@options.readme], @options.extras
try
content = fs.readFileSync extra, 'utf-8'
Expand All @@ -166,9 +142,9 @@ module.exports = class Generator
catch error
console.log "[ERROR] Cannot generate extra file #{ extra }: #{ error }"

# Generate the alphabetical index
# Generate the alphabetical index of all classes and modules.
#
generateIndex: ->
generateClassAndModuleIndex: ->
sortedClasses = {}

# Sort in character group
Expand All @@ -190,7 +166,7 @@ module.exports = class Generator

# Generates the drop down class list
#
generateLists: ->
generateClassAndModuleLists: ->
classes = []
modules = []

Expand Down
2 changes: 1 addition & 1 deletion theme/default/assets/codo.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion theme/default/lib/styles/base.css
@@ -1,6 +1,6 @@
/* line 1, ../../src/styles/base.scss */
body {
padding: 0 20px;
padding: 0 5px;
font-family: "Lucida Sans", "Lucida Grande", Verdana, Arial, sans-serif;
font-size: 13px;
}
Expand Down
2 changes: 1 addition & 1 deletion theme/default/src/styles/base.scss
@@ -1,5 +1,5 @@
body {
padding: 0 20px;
padding: 0 5px;
font-family: "Lucida Sans", "Lucida Grande", Verdana, Arial, sans-serif;
font-size: 13px;
}
Expand Down
2 changes: 1 addition & 1 deletion theme/default/templates/frames.hamlc
Expand Up @@ -3,4 +3,4 @@
!= @JST['partials/head'](@)
%frameset{ cols: '20%, *' }
%frame{ name: 'list', src: 'class_list.html' }
%frame{ name: 'main', src: 'index.html' }
%frame{ name: 'main', src: "#{ @index }.html" }
4 changes: 0 additions & 4 deletions theme/default/templates/partials/header.hamlc
Expand Up @@ -12,10 +12,6 @@

%nav
%ul
%li.frames
!= surround '(', ')', =>
%a.frames{ href: "#{ @path }frames.html" }> frames

%li.noframes
!= surround '(', ')', ->
%a.noframes{ href: '#' }> no frames
Expand Down

0 comments on commit 96e7f95

Please sign in to comment.