From 555b7505ee70e38ebbbaa7d18944776b456af30c Mon Sep 17 00:00:00 2001 From: Christopher Mardell Date: Thu, 23 Oct 2014 09:28:18 +1030 Subject: [PATCH 1/4] Allow classic jump list to scroll and fix div tag Updated to match the fixed version from the parallel layout. Also discovered a `` tag was missing. Fixes #302. --- resources/classic/docco.css | 9 +++++++++ resources/classic/docco.jst | 17 ++++++++++------- resources/parallel/docco.jst | 17 +++++++++-------- 3 files changed, 28 insertions(+), 15 deletions(-) diff --git a/resources/classic/docco.css b/resources/classic/docco.css index ef5c27d8..4bd1da5c 100644 --- a/resources/classic/docco.css +++ b/resources/classic/docco.css @@ -105,9 +105,18 @@ ul.sections > li > div { display: block; } +#jump_page_wrapper{ + position: fixed; + right: 0; + top: 0; + bottom: 0; +} + #jump_page { padding: 5px 0 3px; margin: 0 0 25px 25px; + max-height: 100%; + overflow: auto; } #jump_page .source { diff --git a/resources/classic/docco.jst b/resources/classic/docco.jst index bc956dbe..3ab7ff1a 100644 --- a/resources/classic/docco.jst +++ b/resources/classic/docco.jst @@ -16,13 +16,16 @@ Jump To … +
-
- <% for (var i=0, l=sources.length; i - <% var source = sources[i]; %> - - <%= path.basename(source) %> - - <% } %> +
+
+ <% for (var i=0, l=sources.length; i + <% var source = sources[i]; %> + + <%= path.basename(source) %> + + <% } %> +
+
diff --git a/resources/parallel/docco.jst b/resources/parallel/docco.jst index 1cea1ab5..ac940cce 100644 --- a/resources/parallel/docco.jst +++ b/resources/parallel/docco.jst @@ -16,14 +16,15 @@ Jump To … +
-
-
- <% for (var i=0, l=sources.length; i - <% var source = sources[i]; %> - - <%= path.basename(source) %> - - <% } %> +
+
+ <% for (var i=0, l=sources.length; i + <% var source = sources[i]; %> + + <%= path.basename(source) %> + + <% } %> +
From df284c1d216a2832aa277a60d8e3c9584c59725d Mon Sep 17 00:00:00 2001 From: Christopher Mardell Date: Thu, 23 Oct 2014 14:46:05 +1030 Subject: [PATCH 2/4] Use full file path, underscored, for output files MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In the output html files, any directory separators will be replaced with underscores (rather than replicating the folder structure, which would create unnecessary headaches with linking). Fixes #309, fixes #303. Also includes some previous changes that were in `docco.litcoffee` but hadn’t found their way into `docco.js`. Theoretically it would still create a naming conflict in cases where you had two files, `foo_bar.coffee` and `foo/index.coffee` which could be precluded with a double-underscore or similar, but I don’t think there’s a strong likelihood of that occurring. --- docco.js | 11 +++++++---- docco.litcoffee | 2 +- resources/parallel/docco.jst | 2 +- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/docco.js b/docco.js index 36b7781b..9a9d9a82 100644 --- a/docco.js +++ b/docco.js @@ -1,4 +1,4 @@ -// Generated by CoffeeScript 1.7.1 +// Generated by CoffeeScript 1.8.0 (function() { var Docco, buildMatchers, commander, configure, defaults, document, format, fs, getLanguage, highlightjs, languages, marked, parse, path, run, version, write, _, __slice = [].slice; @@ -131,7 +131,7 @@ write = function(source, sections, config) { var destination, first, firstSection, hasTitle, html, title; destination = function(file) { - return path.join(config.output, file + '.html'); + return path.join(config.output, file.replace(/[\\\/]/g, '_') + '.html'); }; firstSection = _.find(sections, function(section) { return section.docsText.length > 0; @@ -169,6 +169,9 @@ config = _.extend({}, defaults, _.pick.apply(_, [options].concat(__slice.call(_.keys(defaults))))); config.languages = buildMatchers(config.languages); if (options.template) { + if (!options.css) { + console.warn("docco: no stylesheet file specified"); + } config.layout = null; } else { dir = config.layout = path.join(__dirname, 'resources', config.layout); @@ -220,9 +223,9 @@ languages = buildMatchers(languages); getLanguage = function(source, config) { - var codeExt, codeLang, ext, lang; + var codeExt, codeLang, ext, lang, _ref; ext = config.extension || path.extname(source) || path.basename(source); - lang = config.languages[ext] || languages[ext]; + lang = ((_ref = config.languages) != null ? _ref[ext] : void 0) || languages[ext]; if (lang && lang.name === 'markdown') { codeExt = path.extname(path.basename(source, ext)); if (codeExt && (codeLang = languages[codeExt])) { diff --git a/docco.litcoffee b/docco.litcoffee index e116ee06..c416a842 100644 --- a/docco.litcoffee +++ b/docco.litcoffee @@ -194,7 +194,7 @@ and rendering it to the specified output path. write = (source, sections, config) -> destination = (file) -> - path.join(config.output, file + '.html') + path.join(config.output, file.replace(/[\\\/]/g, '_') + '.html') The **title** of the file is either the first heading in the prose, or the name of the source file. diff --git a/resources/parallel/docco.jst b/resources/parallel/docco.jst index ac940cce..71afb52a 100644 --- a/resources/parallel/docco.jst +++ b/resources/parallel/docco.jst @@ -21,7 +21,7 @@ <% for (var i=0, l=sources.length; i <% var source = sources[i]; %> - <%= path.basename(source) %> + <%= source %> <% } %>
From 753acb6b680ad8a09a1e481a6613430670f9e21d Mon Sep 17 00:00:00 2001 From: Christopher Mardell Date: Thu, 23 Oct 2014 14:58:02 +1030 Subject: [PATCH 3/4] Apply full filename in links for other templates MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Applied change from previous commit (re: #309 and #303) to the classic and linear templates. I’m not sure if some people have a preference for just showing the basename, but that option isn’t really compatible with multi-directory sites. For single-folder sites (say, if everything is in `app/`, and you don’t want `app/` at the front of all your links) you can get around it simply by running docco from within the folder containing the files (at least with the CLI). --- resources/classic/docco.jst | 2 +- resources/linear/docco.jst | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/resources/classic/docco.jst b/resources/classic/docco.jst index 3ab7ff1a..b2790729 100644 --- a/resources/classic/docco.jst +++ b/resources/classic/docco.jst @@ -21,7 +21,7 @@ <% for (var i=0, l=sources.length; i <% var source = sources[i]; %> - <%= path.basename(source) %> + <%= source %> <% } %>
diff --git a/resources/linear/docco.jst b/resources/linear/docco.jst index c536828b..0b7e76d1 100644 --- a/resources/linear/docco.jst +++ b/resources/linear/docco.jst @@ -30,7 +30,7 @@ <% var source = sources[i]; %>
  • - <%= path.basename(source) %> + <%= source %>
  • <% } %> From 1510276a0bff0228835c74682cc9fe6c97568ddc Mon Sep 17 00:00:00 2001 From: Christopher Mardell Date: Thu, 23 Oct 2014 15:39:57 +1030 Subject: [PATCH 4/4] Allow scrolling contents list in classic Makes all links accessible on large sites. Additional change for #302. --- resources/linear/docco.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/linear/docco.css b/resources/linear/docco.css index 5ef2718c..fa3e35e1 100644 --- a/resources/linear/docco.css +++ b/resources/linear/docco.css @@ -169,7 +169,7 @@ ul.sections { .toc { max-height: 0; - overflow: hidden; + overflow: auto; text-align: center; font-size: 13px; line-height: 20px;