[Pkg-javascript-commits] [pdf.js] 66/141: Redo and add more documentation to gh-pages.
David Prévot
taffit at moszumanska.debian.org
Sat Apr 19 22:40:31 UTC 2014
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to branch master
in repository pdf.js.
commit 3ce622a10655157d8ae985b2d54ba712b9ceb5c1
Author: Brendan Dahl <brendan.dahl at gmail.com>
Date: Thu Apr 10 10:01:51 2014 -0700
Redo and add more documentation to gh-pages.
---
docs/config.json | 22 +++++
docs/contents/api/index.md | 8 ++
docs/contents/css/bootstrap.min.css | 7 ++
docs/contents/css/main.css | 119 +++++++++++++++++++++++++++
docs/contents/examples/index.md | 65 +++++++++++++++
docs/contents/getting_started/index.md | 114 +++++++++++++++++++++++++
docs/contents/images/favicon.ico | Bin 0 -> 32988 bytes
docs/contents/images/logo.svg | 41 +++++++++
docs/contents/index.md | 14 ++++
docs/contents/js/bootstrap.min.js | 6 ++
docs/contents/js/jquery-2.1.0.min.js | 4 +
docs/plugins/wintersmith-makerelative.coffee | 15 ++++
docs/templates/layout.jade | 52 ++++++++++++
make.js | 74 +++++++++++------
package.json | 6 ++
pdfjs.config | 6 ++
16 files changed, 530 insertions(+), 23 deletions(-)
diff --git a/docs/config.json b/docs/config.json
new file mode 100644
index 0000000..539c608
--- /dev/null
+++ b/docs/config.json
@@ -0,0 +1,22 @@
+{
+ "locals": {
+ "url": "http://localhost:8080",
+ "name": "PDF.js Documentation",
+ "description": ""
+ },
+ "require": {
+ "moment": "moment",
+ "_": "underscore",
+ "typogr": "typogr"
+ },
+ "jade": {
+ "pretty": true
+ },
+ "markdown": {
+ "smartLists": true,
+ "smartypants": true
+ },
+ "plugins": [
+ "./plugins/wintersmith-makerelative.coffee"
+ ]
+}
diff --git a/docs/contents/api/index.md b/docs/contents/api/index.md
new file mode 100644
index 0000000..435edee
--- /dev/null
+++ b/docs/contents/api/index.md
@@ -0,0 +1,8 @@
+---
+title: API
+template: layout.jade
+---
+
+# API
+
+We're currently working on better API docs, but the API is well documented in [api.js](https://github.com/mozilla/pdf.js/blob/master/src/display/api.js).
\ No newline at end of file
diff --git a/docs/contents/css/bootstrap.min.css b/docs/contents/css/bootstrap.min.css
new file mode 100644
index 0000000..679272d
--- /dev/null
+++ b/docs/contents/css/bootstrap.min.css
@@ -0,0 +1,7 @@
+/*!
+ * Bootstrap v3.1.1 (http://getbootstrap.com)
+ * Copyright 2011-2014 Twitter, Inc.
+ * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
+ */
+
+/*! normalize.css v3.0.0 | MIT License | git.io/normalize */html{font-family:sans-serif;-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%}body{margin:0}article,aside,details,figcaption,figure,footer,header,hgroup,main,nav,section,summary{display:block}audio,canvas,progress,video{display:inline-block;vertical-align:baseline}audio:not([controls]){display:none;height:0}[hidden],template{display:none}a{background:0 0}a:active,a:hover{outline:0}abbr[title]{border-bottom:1px dotted}b,str [...]
\ No newline at end of file
diff --git a/docs/contents/css/main.css b/docs/contents/css/main.css
new file mode 100644
index 0000000..d54057c
--- /dev/null
+++ b/docs/contents/css/main.css
@@ -0,0 +1,119 @@
+body {
+}
+.starter-template {
+ padding: 0 15px;
+}
+.navbar-brand {
+ padding: 4px 15px;
+}
+.navbar-brand img {
+ height: 42px;
+}
+.navbar {
+ border-color: #e5e7e8;
+}
+.navbar-default .navbar-nav > .active > a,
+.navbar-default .navbar-nav > .active > a:hover,
+.navbar-default .navbar-nav > .active > a:focus {
+ background-color: #fff;
+ border: 1px solid #e5e7e8;
+ border-width: 0 1px;
+ position: relative;
+ top: 1px;
+}
+
+footer {
+ padding-top: 40px;
+ padding-bottom: 40px;
+ margin-top: 100px;
+ color: #777;
+ text-align: center;
+ border-top: 1px solid #E5E5E5;
+}
+
+/* code styling */
+
+code {
+ font-family: 'Anonymous Pro', monospace;
+ font-size: 0.85em;
+ color: #000;
+}
+
+pre code {
+ display: block;
+ line-height: 1.1;
+}
+
+p code {
+ padding: 0.1em 0.3em 0.2em;
+ border-radius: 0.3em;
+ position: relative;
+ top: -0.15em;
+ background: #444;
+ color: #fff;
+ white-space: nowrap;
+}
+
+/* syntax hl stuff */
+
+code.lang-markdown {
+ color: #424242;
+}
+
+code.lang-markdown .header,
+code.lang-markdown .strong {
+ font-weight: bold;
+}
+
+code.lang-markdown .emphasis {
+ font-style: italic;
+}
+
+code.lang-markdown .horizontal_rule,
+code.lang-markdown .link_label,
+code.lang-markdown .code,
+code.lang-markdown .header,
+code.lang-markdown .link_url {
+ color: #555;
+}
+
+code.lang-markdown .blockquote,
+code.lang-markdown .bullet {
+ color: #bbb;
+}
+
+/* Tomorrow Theme */
+/* http://jmblog.github.com/color-themes-for-google-code-highlightjs */
+/* Original theme - https://github.com/chriskempson/tomorrow-theme */
+/* http://jmblog.github.com/color-themes-for-google-code-highlightjs */
+.tomorrow-comment, pre .comment, pre .title {
+ color: #8e908c;
+}
+
+.tomorrow-red, pre .variable, pre .attribute, pre .tag, pre .regexp, pre .ruby .constant, pre .xml .tag .title, pre .xml .pi, pre .xml .doctype, pre .html .doctype, pre .css .id, pre .css .class, pre .css .pseudo {
+ color: #c82829;
+}
+
+.tomorrow-orange, pre .number, pre .preprocessor, pre .built_in, pre .literal, pre .params, pre .constant {
+ color: #f5871f;
+}
+
+.tomorrow-yellow, pre .class, pre .ruby .class .title, pre .css .rules .attribute {
+ color: #eab700;
+}
+
+.tomorrow-green, pre .string, pre .value, pre .inheritance, pre .header, pre .ruby .symbol, pre .xml .cdata {
+ color: #718c00;
+}
+
+.tomorrow-aqua, pre .css .hexcolor {
+ color: #3e999f;
+}
+
+.tomorrow-blue, pre .function, pre .python .decorator, pre .python .title, pre .ruby .function .title, pre .ruby .title .keyword, pre .perl .sub, pre .javascript .title, pre .coffeescript .title {
+ color: #4271ae;
+}
+
+.tomorrow-purple, pre .keyword, pre .javascript .function {
+ color: #8959a8;
+}
diff --git a/docs/contents/examples/index.md b/docs/contents/examples/index.md
new file mode 100644
index 0000000..e4d1ed2
--- /dev/null
+++ b/docs/contents/examples/index.md
@@ -0,0 +1,65 @@
+---
+title: Examples
+template: layout.jade
+---
+
+## Hello World Walkthrough
+
+[Full source](https://github.com/mozilla/pdf.js/tree/master/examples/helloworld)
+
+PDF.js heavily relies on the use of [Promises](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise). If promises are new to you, it's recommended you become familiar with them before continuing on.
+
+### Document
+
+The object structure of PDF.js loosely follows the structure of an actual PDF. At the top level there is a document object. From the document, more information and individual pages can be fetched. To get the document:
+
+```js
+PDFJS.getDocument('helloworld.pdf')
+```
+
+Remember though that PDF.js uses promises, so the above will return a promise that is resolved with the document object.
+
+```js
+PDFJS.getDocument('helloworld.pdf').then(function(pdf)) {
+ // you can now use *pdf* here
+});
+```
+
+### Page
+Now that we have the document, we can get a page. Again, this uses promises.
+
+```js
+pdf.getPage(1).then(function(page) {
+ // you can now use *page* here
+});
+```
+
+### Rendering the Page
+Each PDF page has its own viewport which defines the size in pixels(72DPI) and initial rotation. By default the viewport is scaled to the original size of the PDF, but this can be changed by modifying the viewport. When the viewport is created an initial transformation matrix will also be created that takes into account the desired scale, rotation, and it transforms the coordinate system (the 0,0 point in PDF documents the bottom-left whereas canvas 0,0 is top-left).
+
+```js
+var scale = 1.5;
+var viewport = page.getViewport(scale);
+
+var canvas = document.getElementById('the-canvas');
+var context = canvas.getContext('2d');
+canvas.height = viewport.height;
+canvas.width = viewport.width;
+
+var renderContext = {
+ canvasContext: context,
+ viewport: viewport
+};
+page.render(renderContext);
+```
+
+Alternatively, if you want the canvas to render to a certain pixel size you could do the following:
+
+```js
+var desiredWidth = 100;
+var viewport = page.getViewport(1);
+var scale = desiredWidth / viewport.width;
+var scaledViewport = page.getViewport(scale);
+```
+
+
diff --git a/docs/contents/getting_started/index.md b/docs/contents/getting_started/index.md
new file mode 100644
index 0000000..4152672
--- /dev/null
+++ b/docs/contents/getting_started/index.md
@@ -0,0 +1,114 @@
+---
+title: Getting Started
+template: layout.jade
+---
+
+# Getting Started
+
+An introduction to PDF.js with examples.
+
+## Introduction
+
+Before downloading PDF.js please take a moment to understand the different layers of the PDF.js project.
+
+<table class="table">
+ <thead>
+ <tr>
+ <th>Layer</th>
+ <th>About</th>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td>Core</td>
+ <td>The core layer is where a binary PDF is parsed and interpreted. This layer is the foundation for all subsequent layers. It is not documented here because using it directly is considered an advanced usage and the API is likely to change. For an example of using the core layer see the [PDF Object Browser](https://github.com/brendandahl/pdf.js.utils/tree/master/browser)
+ </td>
+ </tr>
+ <tr>
+ <td>Display</td>
+ <td>The display layer takes the core layer and exposes an easier to use API to render PDFs and get other information out of a document. This API is what the version number is based on.</td>
+ </tr>
+ <tr>
+ <td>Viewer</td>
+ <td>The viewer is built on the display layer and is the UI for PDF viewer in Firefox and the other browser extensions within the project. It can be a good starting point for building your own viewer. *However, we do ask if you plan to embed the viewer in your own site, that it not just be an unmodified version. Please re-skin it or build upon it.*</td>
+ </tr>
+ </tbody>
+</table>
+
+## Download
+
+<div class="row">
+ <div class="col-md-6">
+ <h3>Pre-built</h3>
+ <p>
+ Includes the generic build of PDF.js and the viewer.
+ </p>
+ <span class="btn-group-vertical centered">
+ <a type="button" class="btn btn-primary" href="https://github.com/mozilla/pdf.js/releases/download/vSTABLE_VERSION/pdfjs-STABLE_VERSION-dist.zip">Stable (vSTABLE_VERSION)</a>
+ <a type="button" class="btn btn-warning" href="https://github.com/mozilla/pdf.js/releases/download/vBETA_VERSION/pdfjs-BETA_VERSION-dist.zip">Beta (vBETA_VERSION)</a>
+ </span>
+ </div>
+ <div class="col-md-6">
+ <h3>Source</h3>
+ To get a local copy of the current code, clone it using git:
+ <pre><code>$ git clone git://github.com/mozilla/pdf.js.git pdfjs
+$ cd pdfjs
+</code></pre>
+ </div>
+</div>
+
+## File Layout Overview
+
+### Prebuilt
+
+```
+├── LICENSE
+├── build/
+│ ├── pdf.js - display layer
+│ └── pdf.worker.js - core layer
+└── web/
+ ├── cmaps/ - character maps(required by core)
+ ├── compatibility.js - polyfills for missing features
+ ├── compressed.tracemonkey-pldi-09.pdf - test pdf
+ ├── debugger.js - helpful pdf debugging features
+ ├── images/ - images for the viewer and annotation icons
+ ├── l10n.js - localization
+ ├── locale/ - translation files
+ ├── viewer.css - viewer style sheet
+ ├── viewer.html - viewer html
+ └── viewer.js - viewer layer
+```
+
+### Source
+
+```
+├── AUTHORS
+├── CONTRIBUTING.md
+├── LICENSE
+├── README.md
+├── build/ - output of build steps (empty)
+├── docs/ - this
+├── examples/ - bare bones examples
+├── extensions/ - various browser extensions
+├── external/ - third party code
+├── l10n/ - translation files
+├── make.js - build script
+├── package.json
+├── src/
+│ ├── core/ - core layer
+│ ├── display/ - display layer
+│ ├── images/
+│ ├── pdf.js - wrapper file that everything is bundled into
+│ ├── shared/ - shared code between core and display layers
+│ └── worker_loader.js - used for developer builds to load worker files
+├── test/ - reference, unit, and font tests
+└── web/ - viewer layer
+```
+
+## Trying the Viewer
+
+With the prebuilt or source version open `web/viewer.html` in a browser and the test pdf should load. Note: the worker is not enabled for file:// urls, so use a server. If you're using the source build and have node, you can run `node make server`.
+
+## More Information
+
+For a further walkthrough of a minimal viewer see the [hello world example](/examples/). More documentation can be found in our [wiki](https://github.com/mozilla/pdf.js/wiki) too.
\ No newline at end of file
diff --git a/docs/contents/images/favicon.ico b/docs/contents/images/favicon.ico
new file mode 100644
index 0000000..39040bb
Binary files /dev/null and b/docs/contents/images/favicon.ico differ
diff --git a/docs/contents/images/logo.svg b/docs/contents/images/logo.svg
new file mode 100644
index 0000000..9c2486e
--- /dev/null
+++ b/docs/contents/images/logo.svg
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg
+ xmlns="http://www.w3.org/2000/svg"
+ width="64"
+ height="64">
+ <path
+ d="M 4.8364028,0.4891005 32.096378,4.5726641 59.163597,0.4891005 54.680408,57.805097 32.096378,63.510899 8.3116209,57.805097 z"
+ style="fill:#e5e7e8;fill-opacity:1;fill-rule:nonzero;stroke:#cccccc" />
+ <path
+ d="M 32.096378,10.745857 53.925414,6.8301117 51.016574,53.81906 32.096378,58.517955 z"
+ style="fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:none" />
+ <rect
+ width="34.027256"
+ height="19.136194"
+ x="3.7557135"
+ y="22.431904"
+ style="fill:#ff2600;fill-opacity:1;fill-rule:nonzero;stroke:none" />
+ <rect
+ width="23.480518"
+ height="19.136194"
+ x="36.763767"
+ y="22.431904"
+ style="fill:#ff501a;fill-opacity:1;fill-rule:nonzero;stroke:none" />
+ <g transform="matrix(0.42778543,0,0,0.42778543,58.617711,9.6737064)">
+ <path
+ d="m -120.53125,34.59375 0,35.1875 6.53125,0 0,-5.9375 0,-5.96875 8.875,0 4.15625,-3.71875 0,-7.71875 0,-7.71875 -4.21875,-4.125 -15.34375,0 z m 6.53125,6.8125 6.21875,0 0,10.21875 -6.21875,0 0,-10.21875 z"
+ style="fill:#ffffff;fill-opacity:1" />
+ <path
+ d="m -98.125,34.59375 0,35.1875 16.125,0 3.75,-3.625 0,-27.96875 -3.96875,-3.59375 -15.90625,0 z m 6.8125,6.8125 6.8125,0 0,21.5625 -6.8125,0 0,-21.5625 z" id="path3056"
+ style="fill:#ffffff;fill-opacity:1" />
+ <path
+ d="m -74.856072,34.602929 c 5.485697,0 10.971394,0 16.457091,0 0,2.269943 0,4.539887 0,6.80983 -3.404915,0 -6.809831,0 -10.214746,0 0,2.472069 0,4.944138 0,7.416206 2.93201,0.110496 5.864021,-0.110494 8.796031,0 l 0,3.366025 0,3.375914 c -2.93201,0.110495 -5.864021,-0.110495 -8.796031,0 l 0,7.146446 0,7.069702 c -2.080782,0 -4.161563,0 -6.242345,0 0,-11.728041 0,-23.456082 0,-35.184123 z"
+ style="fill:#ffffff;fill-opacity:1" />
+ <path
+ d="m -42.8813,67.942723 -2.181762,-1.844329 c 0,-1.986871 0,-3.973742 0,-5.960613 2.175363,6.7e-4 4.350725,0.0013 6.526088,0.002 0,0.94581 0,1.891619 0,2.837429 1.891619,0 3.783239,0 5.674858,0 0,-9.458098 0,-18.916195 0,-28.374293 2.175363,-1.26e-4 4.350725,-2.52e-4 6.526088,-3.78e-4 0,10.498614 0,20.997229 0,31.495843 -1.454508,1.229554 -2.909019,2.459106 -4.363529,3.688658 -3.333325,0 -6.666651,0 -9.999976,0 -0.727237,-0.614768 -1.454563,-1.229595 -2.181767,-1.844308 z"
+ style="fill:#ffffff;fill-opacity:1" />
+ <path
+ d="m -21.316836,67.942723 -2.109122,-1.844329 0,-5.978379 c 2.061011,0 4.392437,0.01978 6.453448,0.01978 0,0.94581 0,1.891619 0,2.837429 2.269943,0 4.539887,0 6.80983,0 0,-2.459105 0,-4.918211 0,-7.377316 -3.196954,0 -6.393909,0 -9.590863,0 l -3.745055,-3.688659 0,-6.80983 0,-6.80983 3.745055,-3.688658 c 3.863156,0 7.726313,0 11.5894692,0 l 4.2511106,3.688658 c -0.00204,1.797039 -0.00472,3.594077 -0.00737,5.391115 -2.0807816,0 -4.1615632,0 -6.2423448,0 0,-0.756648 0,-1.513295 0,-2 [...]
+ style="fill:#ffffff;fill-opacity:1" />
+ </g>
+</svg>
diff --git a/docs/contents/index.md b/docs/contents/index.md
new file mode 100644
index 0000000..7acd043
--- /dev/null
+++ b/docs/contents/index.md
@@ -0,0 +1,14 @@
+---
+title: PDF.js
+template: layout.jade
+---
+
+
+<h1 class="text-center">PDF.js</h1>
+<p class="text-center" style="font-size: 20px">A general-purpose, web standards-based platform for parsing and rendering PDFs.
+</p>
+<p class="text-center">
+ <a type="button" class="btn btn-lg btn-default" href="getting_started/#download">Download</a>
+ <a type="button" class="btn btn-lg btn-default" href="web/viewer.html">Demo</a>
+ <a type="button" class="btn btn-lg btn-default" href="https://github.com/mozilla/pdf.js">Github Project</a>
+</p>
diff --git a/docs/contents/js/bootstrap.min.js b/docs/contents/js/bootstrap.min.js
new file mode 100644
index 0000000..b04a0e8
--- /dev/null
+++ b/docs/contents/js/bootstrap.min.js
@@ -0,0 +1,6 @@
+/*!
+ * Bootstrap v3.1.1 (http://getbootstrap.com)
+ * Copyright 2011-2014 Twitter, Inc.
+ * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
+ */
+if("undefined"==typeof jQuery)throw new Error("Bootstrap's JavaScript requires jQuery");+function(a){"use strict";function b(){var a=document.createElement("bootstrap"),b={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd otransitionend",transition:"transitionend"};for(var c in b)if(void 0!==a.style[c])return{end:b[c]};return!1}a.fn.emulateTransitionEnd=function(b){var c=!1,d=this;a(this).one(a.support.transition.end,function(){c=!0});var e= [...]
\ No newline at end of file
diff --git a/docs/contents/js/jquery-2.1.0.min.js b/docs/contents/js/jquery-2.1.0.min.js
new file mode 100644
index 0000000..cbe6abe
--- /dev/null
+++ b/docs/contents/js/jquery-2.1.0.min.js
@@ -0,0 +1,4 @@
+/*! jQuery v2.1.0 | (c) 2005, 2014 jQuery Foundation, Inc. | jquery.org/license */
+!function(a,b){"object"==typeof module&&"object"==typeof module.exports?module.exports=a.document?b(a,!0):function(a){if(!a.document)throw new Error("jQuery requires a window with a document");return b(a)}:b(a)}("undefined"!=typeof window?window:this,function(a,b){var c=[],d=c.slice,e=c.concat,f=c.push,g=c.indexOf,h={},i=h.toString,j=h.hasOwnProperty,k="".trim,l={},m=a.document,n="2.1.0",o=function(a,b){return new o.fn.init(a,b)},p=/^-ms-/,q=/-([\da-z])/gi,r=function(a,b){return b.toUppe [...]
+while(c--)d=g[c].name,0===d.indexOf("data-")&&(d=o.camelCase(d.slice(5)),P(f,d,e[d]));L.set(f,"hasDataAttrs",!0)}return e}return"object"==typeof a?this.each(function(){M.set(this,a)}):J(this,function(b){var c,d=o.camelCase(a);if(f&&void 0===b){if(c=M.get(f,a),void 0!==c)return c;if(c=M.get(f,d),void 0!==c)return c;if(c=P(f,d,void 0),void 0!==c)return c}else this.each(function(){var c=M.get(this,d);M.set(this,d,b),-1!==a.indexOf("-")&&void 0!==c&&M.set(this,a,b)})},null,b,arguments.length [...]
+return d||(f=$b[b],$b[b]=e,e=null!=c(a,b,d)?b.toLowerCase():null,$b[b]=f),e}});var _b=/^(?:input|select|textarea|button)$/i;o.fn.extend({prop:function(a,b){return J(this,o.prop,a,b,arguments.length>1)},removeProp:function(a){return this.each(function(){delete this[o.propFix[a]||a]})}}),o.extend({propFix:{"for":"htmlFor","class":"className"},prop:function(a,b,c){var d,e,f,g=a.nodeType;if(a&&3!==g&&8!==g&&2!==g)return f=1!==g||!o.isXMLDoc(a),f&&(b=o.propFix[b]||b,e=o.propHooks[b]),void 0!= [...]
diff --git a/docs/plugins/wintersmith-makerelative.coffee b/docs/plugins/wintersmith-makerelative.coffee
new file mode 100644
index 0000000..167a2b2
--- /dev/null
+++ b/docs/plugins/wintersmith-makerelative.coffee
@@ -0,0 +1,15 @@
+module.exports = (env, callback) ->
+ count = (string, substr) ->
+ num = pos = 0
+ return 1/0 unless substr.length
+ num++ while pos = 1 + string.indexOf(substr, pos)
+ num
+
+ env.helpers.makeRelative = (source, dest) ->
+ return dest unless dest.indexOf("/") == 0
+ depth = count(source, '/') # 1 being /
+ ret = ""
+ ret += "../" while depth = depth - 1
+ ret + dest.substr(1)
+
+ callback()
\ No newline at end of file
diff --git a/docs/templates/layout.jade b/docs/templates/layout.jade
new file mode 100644
index 0000000..7f03f3a
--- /dev/null
+++ b/docs/templates/layout.jade
@@ -0,0 +1,52 @@
+- makeRelative = env.helpers.makeRelative
+doctype html
+html(lang='en')
+ head
+ meta(charset='utf-8')
+ meta(name='viewport', content='width=device-width, initial-scale=1.0')
+ meta(name='description', content='')
+ meta(name='author', content='')
+ link(rel='shortcut icon', href=makeRelative(page.url, '/images/favicon.ico'))
+ title=page.title
+ // Bootstrap core CSS
+ link(href=makeRelative(page.url, '/css/bootstrap.min.css'), rel='stylesheet')
+ // Custom styles for this template
+ link(href=makeRelative(page.url, '/css/main.css'), rel='stylesheet')
+
+ body
+ header.navbar.navbar-default.navbar-static-top
+ .container
+ .navbar-header
+ button.navbar-toggle(type='button', data-toggle='collapse', data-target='.navbar-collapse')
+ span.icon-bar
+ span.icon-bar
+ span.icon-bar
+ a.navbar-brand(href='#')
+ img(src=makeRelative(page.url, '/images/logo.svg'))
+ .collapse.navbar-collapse
+ ul.nav.navbar-nav
+ li(class=(page.url === '/' ? 'active' : ''))
+ a(href=makeRelative(page.url, '/')) Home
+ li(class=(page.url === '/getting_started/' ? 'active' : ''))
+ a(href=makeRelative(page.url, '/getting_started/')) Getting Started
+ li(class=(page.url === '/examples/' ? 'active' : ''))
+ a(href=makeRelative(page.url, '/examples/')) Examples
+ li
+ a(href='https://github.com/mozilla/pdf.js/wiki/Frequently-Asked-Questions') FAQ
+ li(class=(page.url === '/api/' ? 'active' : ''))
+ a(href=makeRelative(page.url, '/api/')) API
+
+ .container
+ .starter-template
+ section.content!= typogr(page.html).typogrify()
+
+ .container
+ footer
+ p ©Mozilla and individual contributors
+ :markdown
+ PDF.js is licensed under [Apache](https://github.com/mozilla/pdf.js/blob/master/LICENSE),
+ documentation is licensed under [CC BY-SA 2.5](http://creativecommons.org/licenses/by-sa/2.5/)
+
+ // Bootstrap core JavaScript
+ script(src=makeRelative(page.url, '/js/jquery-2.1.0.min.js'))
+ script(src=makeRelative(page.url, '/js/bootstrap.min.js'))
diff --git a/make.js b/make.js
index 953867b..2fd89ef 100644
--- a/make.js
+++ b/make.js
@@ -23,7 +23,16 @@
require('./external/shelljs/make');
var builder = require('./external/builder/builder.js');
var crlfchecker = require('./external/crlfchecker/crlfchecker.js');
+var wintersmith = require('wintersmith');
var path = require('path');
+var fs = require('fs');
+
+var CONFIG_FILE = 'pdfjs.config';
+var config = JSON.parse(fs.readFileSync(CONFIG_FILE));
+
+// Defined by buildnumber target.
+var BUILD_NUMBER,
+ VERSION;
var ROOT_DIR = __dirname + '/', // absolute path to project's root
BUILD_DIR = 'build/',
@@ -109,6 +118,7 @@ target.generic = function() {
defines: defines,
copy: [
[COMMON_WEB_FILES, GENERIC_DIR + '/web'],
+ ['LICENSE', GENERIC_DIR],
['external/webL10n/l10n.js', GENERIC_DIR + '/web'],
['web/viewer.css', GENERIC_DIR + '/web'],
['web/compatibility.js', GENERIC_DIR + '/web'],
@@ -156,19 +166,42 @@ target.web = function() {
GH_PAGES_DIR + EXTENSION_SRC_DIR + 'firefox/');
cp(CHROME_BUILD_DIR + '/*.crx', FIREFOX_BUILD_DIR + '/*.rdf',
GH_PAGES_DIR + EXTENSION_SRC_DIR + 'chromium/');
- cp('web/index.html.template', GH_PAGES_DIR + '/index.html');
cp('-R', 'test/features', GH_PAGES_DIR);
cp('-R', B2G_BUILD_DIR, GH_PAGES_DIR + EXTENSION_SRC_DIR + 'b2g/');
- cd(GH_PAGES_DIR);
- exec('git init');
- exec('git remote add origin ' + REPO);
- exec('git add -A');
- exec('git commit -am "gh-pages site created via make.js script"');
- exec('git branch -m gh-pages');
+ var env = wintersmith('docs/config.json');
+ env.build(GH_PAGES_DIR, function (error) {
+ if (error) {
+ throw error;
+ }
+ sed('-i', /STABLE_VERSION/g, config.stableVersion,
+ GH_PAGES_DIR + '/getting_started/index.html');
+ sed('-i', /BETA_VERSION/g, config.betaVersion,
+ GH_PAGES_DIR + '/getting_started/index.html');
+ echo('Done building with wintersmith.');
+
+ cd(GH_PAGES_DIR);
+ exec('git init');
+ exec('git remote add origin ' + REPO);
+ exec('git add -A');
+ exec('git commit -am "gh-pages site created via make.js script"');
+ exec('git branch -m gh-pages');
+
+ echo();
+ echo('Website built in ' + GH_PAGES_DIR);
+ });
+};
- echo();
- echo('Website built in ' + GH_PAGES_DIR);
+target.dist = function() {
+ target.generic();
+ config.stableVersion = config.betaVersion;
+ config.betaVersion = VERSION;
+ fs.writeFileSync(CONFIG_FILE, JSON.stringify(config, null, 2));
+ cd(GENERIC_DIR);
+ var distFilename = 'pdfjs-' + VERSION + '-dist.zip';
+ exec('zip -r ' + ROOT_DIR + BUILD_DIR + distFilename + ' *');
+ echo('Built distribution file: ' + distFilename);
+ cd(ROOT_DIR);
};
//
@@ -285,7 +318,7 @@ target.bundle = function(args) {
}
var bundle = cat(SRC_FILES),
- bundleVersion = EXTENSION_VERSION,
+ bundleVersion = VERSION,
bundleBuild = exec('git log --format="%h" -n 1',
{silent: true}).output.replace('\n', '');
@@ -487,11 +520,6 @@ target.minified = function() {
// Extension stuff
//
-var EXTENSION_BASE_VERSION = '0ac55ac879d1c0eea9c0d155d5bbd9b11560f631',
- EXTENSION_VERSION_PREFIX = '0.8.',
- EXTENSION_BUILD_NUMBER,
- EXTENSION_VERSION;
-
//
// make extension
//
@@ -511,13 +539,13 @@ target.buildnumber = function() {
echo('### Getting extension build number');
var lines = exec('git log --format=oneline ' +
- EXTENSION_BASE_VERSION + '..', {silent: true}).output;
+ config.baseVersion + '..', {silent: true}).output;
// Build number is the number of commits since base version
- EXTENSION_BUILD_NUMBER = lines ? lines.match(/\n/g).length : 0;
+ BUILD_NUMBER = lines ? lines.match(/\n/g).length : 0;
- echo('Extension build number: ' + EXTENSION_BUILD_NUMBER);
+ echo('Extension build number: ' + BUILD_NUMBER);
- EXTENSION_VERSION = EXTENSION_VERSION_PREFIX + EXTENSION_BUILD_NUMBER;
+ VERSION = config.versionPrefix + BUILD_NUMBER;
};
//
@@ -612,9 +640,9 @@ target.firefox = function() {
});
// Update the build version number
- sed('-i', /PDFJSSCRIPT_VERSION/, EXTENSION_VERSION,
+ sed('-i', /PDFJSSCRIPT_VERSION/, VERSION,
FIREFOX_BUILD_DIR + '/install.rdf');
- sed('-i', /PDFJSSCRIPT_VERSION/, EXTENSION_VERSION,
+ sed('-i', /PDFJSSCRIPT_VERSION/, VERSION,
FIREFOX_BUILD_DIR + '/update.rdf');
sed('-i', /PDFJSSCRIPT_STREAM_CONVERTER_ID/, FIREFOX_STREAM_CONVERTER_ID,
@@ -745,7 +773,7 @@ target.mozcentral = function() {
cp(DEFAULT_LOCALE_FILES, MOZCENTRAL_L10N_DIR);
// Update the build version number
- sed('-i', /PDFJSSCRIPT_VERSION/, EXTENSION_VERSION,
+ sed('-i', /PDFJSSCRIPT_VERSION/, VERSION,
MOZCENTRAL_EXTENSION_DIR + 'README.mozilla');
sed('-i', /PDFJSSCRIPT_STREAM_CONVERTER_ID/, MOZCENTRAL_STREAM_CONVERTER_ID,
@@ -845,7 +873,7 @@ target.chromium = function() {
cleanupJSSource(CHROME_BUILD_CONTENT_DIR + '/web/viewer.js');
// Update the build version number
- sed('-i', /PDFJSSCRIPT_VERSION/, EXTENSION_VERSION,
+ sed('-i', /PDFJSSCRIPT_VERSION/, VERSION,
CHROME_BUILD_DIR + '/manifest.json');
// Allow PDF.js resources to be loaded by adding the files to
diff --git a/package.json b/package.json
index 1dcdf82..30c9a4f 100644
--- a/package.json
+++ b/package.json
@@ -5,6 +5,12 @@
"jshint": "2.4.x",
"yargs": "~1.2.1"
},
+ "devDependencies": {
+ "wintersmith": "2.0.x",
+ "moment": "2.3.x",
+ "underscore": "1.4.x",
+ "typogr": "0.5.x"
+ },
"scripts": {
"test": "node make lint"
},
diff --git a/pdfjs.config b/pdfjs.config
new file mode 100644
index 0000000..e105dde
--- /dev/null
+++ b/pdfjs.config
@@ -0,0 +1,6 @@
+{
+ "betaVersion": "0.8.1114",
+ "stableVersion": "0.8.1334",
+ "baseVersion": "0ac55ac879d1c0eea9c0d155d5bbd9b11560f631",
+ "versionPrefix": "0.8."
+}
\ No newline at end of file
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/pdf.js.git
More information about the Pkg-javascript-commits
mailing list