Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Remove Rubyforge page (except RDoc) and redirect to GitHub page

  • Loading branch information...
commit 5fe881fb1e723758e98cb2002699eb56389722d6 1 parent 72e6875
Tore Darell authored
113 site/barcodes.html
View
@@ -1,113 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html lang="en" xmlns="http://www.w3.org/1999/xhtml">
- <head>
- <title>Barby</title>
- <meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
- <link href="style.css" media="screen" rel="stylesheet" type="text/css" />
- <!--
- <link href="syntax.css" media="screen" rel="stylesheet" type="text/css" />
- <script type="text/javascript" src="code_highlighter/all.js"></script>
- -->
- </head>
- <body>
-
- <h1 id="header">Barby</h1>
- <p id="header-copy">
- <strong>Bar</strong>codes for Ru<strong>by</strong>
- </p>
- <img src="code128b_header.png" alt="Code 128 B" id="header-barcode" class="barcode" />
-
- <ul id="menu">
- <li><a href="index.html">Home</a></li>
- <li><a href="howto.html">Howto</a></li>
- <li><a href="rdoc">RDoc</a></li>
- <li class="current"><a href="barcodes.html">Barcodes</a></li>
- <li><a href="outputters.html">Outputters</a></li>
- </ul>
-
- <p>
- The following barcode symbologies are currently supported:
- </p>
-
- <ul>
- <li>1D
- <ul>
- <li>
- Code128
- <ul>
- <li>GS1 128</li>
- </ul>
- </li>
- <li>EAN-13</li>
- <ul>
- <li>Bookland</li>
- </ul>
- <li>EAN-8</li>
- <li>Code39</li>
- <li>Code93</li>
- <li>Code25 (2 of 5)</li>
- </ul>
- </li>
- <li>2D
- <ul>
- <li>QR Code</li>
- </ul>
- </li>
- </ul>
-
- <h2>Writing your own barcode class</h2>
-
- <p>
- If you want to add support for a symbology that isn't currently supported,
- that's pretty easy. The only requirement is that your class has an <code>encoding</code>
- method which returns a string representation of the encoded barcode. It should also
- inherit the <code>Barcode1D</code> class. As an example, this
- EAN-8 barcode,
- </p>
-
- <img src="ean8.png" alt="EAN-8 barcode" class="barcode" />
-
- <p>
- is represented by the string
- <code>"1010111011010111100110010010011010101011100101110010011101000100101"</code>.
- </p>
-
- <p>
- In the string, "black" or "bar" is represented with a 1 and "white" or "space" is represented by 0. One digit
- is one "X dimension" in length. So, a thick black line is represented by several 1s together. The image above
- was created with the outputter's <code>:xdim</code> option set to 2, i.e. 2 pixels, so the thinnest line possible
- is 2px wide.
- </p>
-
- <p>
- This string is what the outputter classes use as input when generating images etc for a barcode.
- </p>
-
- <h3>2D barcodes</h3>
-
- <p>
- 2D barcodes are similar to 1D barcodes with the only difference that their <code>encoding</code>
- method should return an <em>array of strings</em> instead of a single string. 2D barcodes are thus
- considered to be several 1D barcodes layered on top of each other. As an example, this QR Code,
- </p>
-
- <img src="qrcode.png" alt="QR Code barcode" class="barcode" />
-
- <p>
- is represented by this array of strings:
- </p>
-
- <pre><code>["111111100100101111111", "100000101001001000001", "101110100100001011101",
-"101110101001001011101", "101110100011101011101", "100000101110101000001",
-"111111101010101111111", "000000000011100000000", "111110111100110101010",
-"011011010110110110111", "100101101001011000010", "110100000000010001110",
-"100011111001001110010", "000000001101100111100", "111111101110110001110",
-"100000100101110011101", "101110101010101111001", "101110101100111110100",
-"101110101011000001000", "100000101000000101100", "111111101101000110010"]</code></pre>
-
- <p id="footer">
- <a href="http://tore.darell.no/">I</a> made this.
- </p>
-
- </body>
-</html>
BIN  site/code128b.gif
View
Deleted file not rendered
BIN  site/code128b.png
View
Deleted file not rendered
BIN  site/code128b_header.png
View
Deleted file not rendered
BIN  site/code39.png
View
Deleted file not rendered
296 site/code_highlighter/all.js
View
@@ -1,296 +0,0 @@
-/* Unobtrustive Code Highlighter By Dan Webb 11/2005
- Version: 0.4
-
- Usage:
- Add a script tag for this script and any stylesets you need to use
- to the page in question, add correct class names to CODE elements,
- define CSS styles for elements. That's it!
-
- Known to work on:
- IE 5.5+ PC
- Firefox/Mozilla PC/Mac
- Opera 7.23 + PC
- Safari 2
-
- Known to degrade gracefully on:
- IE5.0 PC
-
- Note: IE5.0 fails due to the use of lookahead in some stylesets. To avoid script errors
- in older browsers use expressions that use lookahead in string format when defining stylesets.
-
- This script is inspired by star-light by entirely cunning Dean Edwards
- http://dean.edwards.name/star-light/.
-*/
-
-// replace callback support for safari.
-if ("a".replace(/a/, function() {return "b"}) != "b") (function(){
- var default_replace = String.prototype.replace;
- String.prototype.replace = function(search,replace){
- // replace is not function
- if(typeof replace != "function"){
- return default_replace.apply(this,arguments)
- }
- var str = "" + this;
- var callback = replace;
- // search string is not RegExp
- if(!(search instanceof RegExp)){
- var idx = str.indexOf(search);
- return (
- idx == -1 ? str :
- default_replace.apply(str,[search,callback(search, idx, str)])
- )
- }
- var reg = search;
- var result = [];
- var lastidx = reg.lastIndex;
- var re;
- while((re = reg.exec(str)) != null){
- var idx = re.index;
- var args = re.concat(idx, str);
- result.push(
- str.slice(lastidx,idx),
- callback.apply(null,args).toString()
- );
- if(!reg.global){
- lastidx += RegExp.lastMatch.length;
- break
- }else{
- lastidx = reg.lastIndex;
- }
- }
- result.push(str.slice(lastidx));
- return result.join("")
- }
-})();
-
-var CodeHighlighter = { styleSets : new Array };
-
-CodeHighlighter.addStyle = function(name, rules) {
- // using push test to disallow older browsers from adding styleSets
- if ([].push) this.styleSets.push({
- name : name,
- rules : rules,
- ignoreCase : arguments[2] || false
- })
-
- function setEvent() {
- // set highlighter to run on load (use LowPro if present)
- if (typeof Event != 'undefined' && typeof Event.onReady == 'function')
- return Event.onReady(CodeHighlighter.init.bind(CodeHighlighter));
-
- var old = window.onload;
-
- if (typeof window.onload != 'function') {
- window.onload = function() { CodeHighlighter.init() };
- } else {
- window.onload = function() {
- old();
- CodeHighlighter.init();
- }
- }
- }
-
- // only set the event when the first style is added
- if (this.styleSets.length==1) setEvent();
-}
-
-CodeHighlighter.init = function() {
- if (!document.getElementsByTagName) return;
- if ("a".replace(/a/, function() {return "b"}) != "b") return; // throw out Safari versions that don't support replace function
- // throw out older browsers
-
- var codeEls = document.getElementsByTagName("CODE");
- // collect array of all pre elements
- codeEls.filter = function(f) {
- var a = new Array;
- for (var i = 0; i < this.length; i++) if (f(this[i])) a[a.length] = this[i];
- return a;
- }
-
- var rules = new Array;
- rules.toString = function() {
- // joins regexes into one big parallel regex
- var exps = new Array;
- for (var i = 0; i < this.length; i++) exps.push(this[i].exp);
- return exps.join("|");
- }
-
- function addRule(className, rule) {
- // add a replace rule
- var exp = (typeof rule.exp != "string")?String(rule.exp).substr(1, String(rule.exp).length-2):rule.exp;
- // converts regex rules to strings and chops of the slashes
- rules.push({
- className : className,
- exp : "(" + exp + ")",
- length : (exp.match(/(^|[^\\])\([^?]/g) || "").length + 1, // number of subexps in rule
- replacement : rule.replacement || null
- });
- }
-
- function parse(text, ignoreCase) {
- // main text parsing and replacement
- return text.replace(new RegExp(rules, (ignoreCase)?"gi":"g"), function() {
- var i = 0, j = 1, rule;
- while (rule = rules[i++]) {
- if (arguments[j]) {
- // if no custom replacement defined do the simple replacement
- if (!rule.replacement) return "<span class=\"" + rule.className + "\">" + arguments[0] + "</span>";
- else {
- // replace $0 with the className then do normal replaces
- var str = rule.replacement.replace("$0", rule.className);
- for (var k = 1; k <= rule.length - 1; k++) str = str.replace("$" + k, arguments[j + k]);
- return str;
- }
- } else j+= rule.length;
- }
- });
- }
-
- function highlightCode(styleSet) {
- // clear rules array
- var parsed, clsRx = new RegExp("(\\s|^)" + styleSet.name + "(\\s|$)");
- rules.length = 0;
-
- // get stylable elements by filtering out all code elements without the correct className
- var stylableEls = codeEls.filter(function(item) { return clsRx.test(item.className) });
-
- // add style rules to parser
- for (var className in styleSet.rules) addRule(className, styleSet.rules[className]);
-
-
- // replace for all elements
- for (var i = 0; i < stylableEls.length; i++) {
- // EVIL hack to fix IE whitespace badness if it's inside a <pre>
- if (/MSIE/.test(navigator.appVersion) && stylableEls[i].parentNode.nodeName == 'PRE') {
- stylableEls[i] = stylableEls[i].parentNode;
-
- parsed = stylableEls[i].innerHTML.replace(/(<code[^>]*>)([^<]*)<\/code>/i, function() {
- return arguments[1] + parse(arguments[2], styleSet.ignoreCase) + "</code>"
- });
- parsed = parsed.replace(/\n( *)/g, function() {
- var spaces = "";
- for (var i = 0; i < arguments[1].length; i++) spaces+= "&nbsp;";
- return "\n" + spaces;
- });
- parsed = parsed.replace(/\t/g, "&nbsp;&nbsp;&nbsp;&nbsp;");
- parsed = parsed.replace(/\n(<\/\w+>)?/g, "<br />$1").replace(/<br \/>[\n\r\s]*<br \/>/g, "<p><br></p>");
-
- } else parsed = parse(stylableEls[i].innerHTML, styleSet.ignoreCase);
-
- stylableEls[i].innerHTML = parsed;
- }
- }
-
- // run highlighter on all stylesets
- for (var i=0; i < this.styleSets.length; i++) {
- highlightCode(this.styleSets[i]);
- }
-}
-
-CodeHighlighter.addStyle("css", {
- comments : {
- exp : /\/\*[^*]*\*+([^\/][^*]*\*+)*\//
- },
- keywords : {
- exp : /@\w[\w\s]*/
- },
- selectors : {
- exp : "([\\w-:\\[.#\\*][^{};>]*)(?={)"
- },
- properties : {// + values
- exp : "([\\w-]+)(\\s*:\\s*)(.*?)(\\s*;)",
- replacement: '<span class="properties">$1</span>$2<span class="values">$3</span>$4'
- },
-/* units : {
- exp : /([0-9])(em|en|px|%|pt)\b/,
- replacement : "$1<span class=\"$0\">$2</span>"
- },
- urls : {
- exp : /url\([^\)]*\)/
- },*/
- curly : {
- exp : /\{|\}/
- }
- });
-
-
-CodeHighlighter.addStyle("html", {
- xml : {
- exp : /^\s*&lt;\?xml .*?\?&gt;/
- },
- doctype : {
- exp: /&lt;!DOCTYPE([^&]|&[^g]|&g[^t])*&gt;/
- },
- comment : {
- exp: /&lt;!\s*(--([^-]|[\r\n]|-[^-])*--\s*)&gt;/
- },
- tag : {
- exp: /(&lt;)(\/?)([a-zA-Z0-9]+\s?)/,
- replacement: "<span class=\"brackets\">$1</span>$2<span class=\"$0\">$3</span>"
- },
- brackets : {
- exp: /&gt;|&lt;/
- },
-/* string : {
- exp : /'[^']*'|"[^"]*"/
- },*/
- attribute : {
- exp: /\b([a-zA-Z-:]+)(=)('[^']*'|"[^"]*")/,
- replacement: "<span class=\"attribute\">$1</span><span class=\"separator\">$2</span><span class=\"value\">$3</span>"
- }
-});
-
-CodeHighlighter.addStyle("javascript",{
- comment : {
- exp : /(\/\/[^\n]*(\n|$))|(\/\*[^*]*\*+([^\/][^*]*\*+)*\/)/
- },
- brackets : {
- exp : /\(|\)/
- },
- string : {
- exp : /'[^']*'|"[^"]*"/
- },
- keywords : {
- exp : /\b(arguments|break|case|continue|default|delete|do|else|false|for|function|if|in|instanceof|new|null|return|switch|this|true|typeof|var|void|while|with)\b/
- },
- global : {
- exp : /\b(toString|valueOf|window|element|prototype|constructor|document|escape|unescape|parseInt|parseFloat|setTimeout|clearTimeout|setInterval|clearInterval|NaN|isNaN|Infinity)\b/
- }
-});
-
-CodeHighlighter.addStyle("ruby",{
- comment : {
- exp : /#[^\n]+/
- },
- parens : {
- exp : /\(|\)/
- },
- brackets : {
- exp : /\[|\]/
- },
- curly : {
- exp : /\{|\}/
- },
- string : {
- exp : /'[^']*'|"[^"]*"/
- },
- keywords : {
- exp : /\b(do|end|self|class|def|if|module|yield|then|else|for|until|unless|while|elsif|case|when|break|retry|redo|rescue|require|raise)\b/
- },
- /* Added by Shelly Fisher (shelly@agileevolved.com) */
- symbol : {
- exp : /:[A-Za-z0-9_!?]+/
- },
- instance : {
- exp : /[^@]@[a-zA-Z0-9_]+/
- },
- 'class' : {
- exp : /@@[a-zA-Z0-9_]+/
- },
- numbers : {
- exp : /[0-9][0-9\._]*/
- },
- constants : {
- exp : /(:{0,2}[A-Z][a-zA-Z]*)+/
- }
-});
188 site/code_highlighter/code_highlighter.js
View
@@ -1,188 +0,0 @@
-/* Unobtrustive Code Highlighter By Dan Webb 11/2005
- Version: 0.4
-
- Usage:
- Add a script tag for this script and any stylesets you need to use
- to the page in question, add correct class names to CODE elements,
- define CSS styles for elements. That's it!
-
- Known to work on:
- IE 5.5+ PC
- Firefox/Mozilla PC/Mac
- Opera 7.23 + PC
- Safari 2
-
- Known to degrade gracefully on:
- IE5.0 PC
-
- Note: IE5.0 fails due to the use of lookahead in some stylesets. To avoid script errors
- in older browsers use expressions that use lookahead in string format when defining stylesets.
-
- This script is inspired by star-light by entirely cunning Dean Edwards
- http://dean.edwards.name/star-light/.
-*/
-
-// replace callback support for safari.
-if ("a".replace(/a/, function() {return "b"}) != "b") (function(){
- var default_replace = String.prototype.replace;
- String.prototype.replace = function(search,replace){
- // replace is not function
- if(typeof replace != "function"){
- return default_replace.apply(this,arguments)
- }
- var str = "" + this;
- var callback = replace;
- // search string is not RegExp
- if(!(search instanceof RegExp)){
- var idx = str.indexOf(search);
- return (
- idx == -1 ? str :
- default_replace.apply(str,[search,callback(search, idx, str)])
- )
- }
- var reg = search;
- var result = [];
- var lastidx = reg.lastIndex;
- var re;
- while((re = reg.exec(str)) != null){
- var idx = re.index;
- var args = re.concat(idx, str);
- result.push(
- str.slice(lastidx,idx),
- callback.apply(null,args).toString()
- );
- if(!reg.global){
- lastidx += RegExp.lastMatch.length;
- break
- }else{
- lastidx = reg.lastIndex;
- }
- }
- result.push(str.slice(lastidx));
- return result.join("")
- }
-})();
-
-var CodeHighlighter = { styleSets : new Array };
-
-CodeHighlighter.addStyle = function(name, rules) {
- // using push test to disallow older browsers from adding styleSets
- if ([].push) this.styleSets.push({
- name : name,
- rules : rules,
- ignoreCase : arguments[2] || false
- })
-
- function setEvent() {
- // set highlighter to run on load (use LowPro if present)
- if (typeof Event != 'undefined' && typeof Event.onReady == 'function')
- return Event.onReady(CodeHighlighter.init.bind(CodeHighlighter));
-
- var old = window.onload;
-
- if (typeof window.onload != 'function') {
- window.onload = function() { CodeHighlighter.init() };
- } else {
- window.onload = function() {
- old();
- CodeHighlighter.init();
- }
- }
- }
-
- // only set the event when the first style is added
- if (this.styleSets.length==1) setEvent();
-}
-
-CodeHighlighter.init = function() {
- if (!document.getElementsByTagName) return;
- if ("a".replace(/a/, function() {return "b"}) != "b") return; // throw out Safari versions that don't support replace function
- // throw out older browsers
-
- var codeEls = document.getElementsByTagName("CODE");
- // collect array of all pre elements
- codeEls.filter = function(f) {
- var a = new Array;
- for (var i = 0; i < this.length; i++) if (f(this[i])) a[a.length] = this[i];
- return a;
- }
-
- var rules = new Array;
- rules.toString = function() {
- // joins regexes into one big parallel regex
- var exps = new Array;
- for (var i = 0; i < this.length; i++) exps.push(this[i].exp);
- return exps.join("|");
- }
-
- function addRule(className, rule) {
- // add a replace rule
- var exp = (typeof rule.exp != "string")?String(rule.exp).substr(1, String(rule.exp).length-2):rule.exp;
- // converts regex rules to strings and chops of the slashes
- rules.push({
- className : className,
- exp : "(" + exp + ")",
- length : (exp.match(/(^|[^\\])\([^?]/g) || "").length + 1, // number of subexps in rule
- replacement : rule.replacement || null
- });
- }
-
- function parse(text, ignoreCase) {
- // main text parsing and replacement
- return text.replace(new RegExp(rules, (ignoreCase)?"gi":"g"), function() {
- var i = 0, j = 1, rule;
- while (rule = rules[i++]) {
- if (arguments[j]) {
- // if no custom replacement defined do the simple replacement
- if (!rule.replacement) return "<span class=\"" + rule.className + "\">" + arguments[0] + "</span>";
- else {
- // replace $0 with the className then do normal replaces
- var str = rule.replacement.replace("$0", rule.className);
- for (var k = 1; k <= rule.length - 1; k++) str = str.replace("$" + k, arguments[j + k]);
- return str;
- }
- } else j+= rule.length;
- }
- });
- }
-
- function highlightCode(styleSet) {
- // clear rules array
- var parsed, clsRx = new RegExp("(\\s|^)" + styleSet.name + "(\\s|$)");
- rules.length = 0;
-
- // get stylable elements by filtering out all code elements without the correct className
- var stylableEls = codeEls.filter(function(item) { return clsRx.test(item.className) });
-
- // add style rules to parser
- for (var className in styleSet.rules) addRule(className, styleSet.rules[className]);
-
-
- // replace for all elements
- for (var i = 0; i < stylableEls.length; i++) {
- // EVIL hack to fix IE whitespace badness if it's inside a <pre>
- if (/MSIE/.test(navigator.appVersion) && stylableEls[i].parentNode.nodeName == 'PRE') {
- stylableEls[i] = stylableEls[i].parentNode;
-
- parsed = stylableEls[i].innerHTML.replace(/(<code[^>]*>)([^<]*)<\/code>/i, function() {
- return arguments[1] + parse(arguments[2], styleSet.ignoreCase) + "</code>"
- });
- parsed = parsed.replace(/\n( *)/g, function() {
- var spaces = "";
- for (var i = 0; i < arguments[1].length; i++) spaces+= "&nbsp;";
- return "\n" + spaces;
- });
- parsed = parsed.replace(/\t/g, "&nbsp;&nbsp;&nbsp;&nbsp;");
- parsed = parsed.replace(/\n(<\/\w+>)?/g, "<br />$1").replace(/<br \/>[\n\r\s]*<br \/>/g, "<p><br></p>");
-
- } else parsed = parse(stylableEls[i].innerHTML, styleSet.ignoreCase);
-
- stylableEls[i].innerHTML = parsed;
- }
- }
-
- // run highlighter on all stylesets
- for (var i=0; i < this.styleSets.length; i++) {
- highlightCode(this.styleSets[i]);
- }
-}
25 site/code_highlighter/css.js
View
@@ -1,25 +0,0 @@
-CodeHighlighter.addStyle("css", {
- comments : {
- exp : /\/\*[^*]*\*+([^\/][^*]*\*+)*\//
- },
- keywords : {
- exp : /@\w[\w\s]*/
- },
- selectors : {
- exp : "([\\w-:\\[.#\\*][^{};>]*)(?={)"
- },
- properties : {// + values
- exp : "([\\w-]+)(\\s*:\\s*)(.*?)(\\s*;)",
- replacement: '<span class="properties">$1</span>$2<span class="values">$3</span>$4'
- },
-/* units : {
- exp : /([0-9])(em|en|px|%|pt)\b/,
- replacement : "$1<span class=\"$0\">$2</span>"
- },
- urls : {
- exp : /url\([^\)]*\)/
- },*/
- curly : {
- exp : /\{|\}/
- }
- });
25 site/code_highlighter/html.js
View
@@ -1,25 +0,0 @@
-CodeHighlighter.addStyle("html", {
- xml : {
- exp : /^\s*&lt;\?xml .*?\?&gt;/
- },
- doctype : {
- exp: /&lt;!DOCTYPE([^&]|&[^g]|&g[^t])*&gt;/
- },
- comment : {
- exp: /&lt;!\s*(--([^-]|[\r\n]|-[^-])*--\s*)&gt;/
- },
- tag : {
- exp: /(&lt;)(\/?)([a-zA-Z0-9]+\s?)/,
- replacement: "<span class=\"brackets\">$1</span>$2<span class=\"$0\">$3</span>"
- },
- brackets : {
- exp: /&gt;|&lt;/
- },
-/* string : {
- exp : /'[^']*'|"[^"]*"/
- },*/
- attribute : {
- exp: /\b([a-zA-Z-:]+)(=)('[^']*'|"[^"]*")/,
- replacement: "<span class=\"attribute\">$1</span><span class=\"separator\">$2</span><span class=\"value\">$3</span>"
- }
-});
10 site/code_highlighter/irb.js
View
@@ -1,10 +0,0 @@
-CodeHighlighter.addStyle("irb",{
- input : {
- exp : /([\r\n]+|^)(.*?&gt;&gt;)(.*?)(?=[\r\n]+|$)/,
- replacement : '$1<span class="input prompt">$2</span><span class="input code">$3</span>'
- },
- output : {
- exp : /([\r\n]+|^)(.*?=&gt;)(.*?)(?=[\r\n]+|$)/,
- replacement : '$1<span class="output prompt">$2</span><span class="output code">$3</span>'
- }
-});
17 site/code_highlighter/javascript.js
View
@@ -1,17 +0,0 @@
-CodeHighlighter.addStyle("javascript",{
- comment : {
- exp : /(\/\/[^\n]*(\n|$))|(\/\*[^*]*\*+([^\/][^*]*\*+)*\/)/
- },
- brackets : {
- exp : /\(|\)/
- },
- string : {
- exp : /'[^']*'|"[^"]*"/
- },
- keywords : {
- exp : /\b(arguments|break|case|continue|default|delete|do|else|false|for|function|if|in|instanceof|new|null|return|switch|this|true|typeof|var|void|while|with)\b/
- },
- global : {
- exp : /\b(toString|valueOf|window|element|prototype|constructor|document|escape|unescape|parseInt|parseFloat|setTimeout|clearTimeout|setInterval|clearInterval|NaN|isNaN|Infinity)\b/
- }
-});
36 site/code_highlighter/ruby.js
View
@@ -1,36 +0,0 @@
-CodeHighlighter.addStyle("ruby",{
- comment : {
- exp : /#[^\n]+/
- },
- parens : {
- exp : /\(|\)/
- },
- brackets : {
- exp : /\[|\]/
- },
- curly : {
- exp : /\{|\}/
- },
- string : {
- exp : /'[^']*'|"[^"]*"/
- },
- keywords : {
- exp : /\b(do|end|self|class|def|if|module|yield|then|else|for|until|unless|while|elsif|case|when|break|retry|redo|rescue|require|raise)\b/
- },
- /* Added by Shelly Fisher (shelly@agileevolved.com) */
- symbol : {
- exp : /:[A-Za-z0-9_!?]+/
- },
- instance : {
- exp : /[^@]@[a-zA-Z0-9_]+/
- },
- 'class' : {
- exp : /@@[a-zA-Z0-9_]+/
- },
- numbers : {
- exp : /[0-9][0-9\._]*/
- },
- constants : {
- exp : /(:{0,2}[A-Z][a-zA-Z]*)+/
- }
-});
BIN  site/ean13.png
View
Deleted file not rendered
BIN  site/ean8.png
View
Deleted file not rendered
64 site/howto.html
View
@@ -1,64 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html lang="en" xmlns="http://www.w3.org/1999/xhtml">
- <head>
- <title>Barby</title>
- <meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
- <link href="style.css" media="screen" rel="stylesheet" type="text/css" />
- <!--
- <link href="syntax.css" media="screen" rel="stylesheet" type="text/css" />
- <script type="text/javascript" src="code_highlighter/all.js"></script>
- -->
- </head>
- <body>
-
- <h1 id="header">Barby</h1>
- <p id="header-copy">
- <strong>Bar</strong>codes for Ru<strong>by</strong>
- </p>
- <img src="code128b_header.png" alt="Code 128 B" id="header-barcode" class="barcode" />
-
- <ul id="menu">
- <li><a href="index.html">Home</a></li>
- <li class="current"><a href="howto.html">Howto</a></li>
- <li><a href="rdoc">RDoc</a></li>
- <li><a href="barcodes.html">Barcodes</a></li>
- <li><a href="outputters.html">Outputters</a></li>
- </ul>
-
- <h2>Quick howto</h2>
-
- <p>
- When using Barby you probably want to do two things; create a barcode object
- and render it to an image or some other graphical representation.
- </p>
-
- <p>
- First, you need to require "barby". If you haven't already, you also need to
- require "rubygems" first if you're using the gem. This will require all the different
- types of barcodes but no outputters will be required by default, so you'll need to
- require the ourputter you want to use.
- </p>
-
- <p>
- Let's say you want to create a Code128 barcode and render a PNG image from it:
- </p>
-
- <pre><code class="ruby">require 'rubygems'
-require 'barby'
-require 'barby/outputter/png_outputter'
-
-barcode = Barby::Code128B.new('huwawa')
-print barcode.to_png</code></pre>
-
- <p>
- The above will print the PNG to stdout, so you could for example invoke it like this:
- </p>
-
- <pre><code>ruby make_barcode.rb &gt; barcode.png</code></pre>
-
- <p id="footer">
- <a href="http://tore.darell.no/">I</a> made this.
- </p>
-
- </body>
-</html>
1  site/index.html
View
@@ -3,6 +3,7 @@
<head>
<title>Barby</title>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
+ <meta content="0;url=http://toretore.github.com/barby" http-equiv="refresh"/>
<link href="style.css" media="screen" rel="stylesheet" type="text/css" />
<!--
<link href="syntax.css" media="screen" rel="stylesheet" type="text/css" />
118 site/outputters.html
View
@@ -1,118 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html lang="en" xmlns="http://www.w3.org/1999/xhtml">
- <head>
- <title>Barby</title>
- <meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
- <link href="style.css" media="screen" rel="stylesheet" type="text/css" />
- <!--
- <link href="syntax.css" media="screen" rel="stylesheet" type="text/css" />
- <script type="text/javascript" src="code_highlighter/all.js"></script>
- -->
- </head>
- <body>
-
- <h1 id="header">Barby</h1>
- <p id="header-copy">
- <strong>Bar</strong>codes for Ru<strong>by</strong>
- </p>
- <img src="code128b_header.png" alt="Code 128 B" id="header-barcode" class="barcode" />
-
- <ul id="menu">
- <li><a href="index.html">Home</a></li>
- <li><a href="howto.html">Howto</a></li>
- <li><a href="rdoc">RDoc</a></li>
- <li><a href="barcodes.html">Barcodes</a></li>
- <li class="current"><a href="outputters.html">Outputters</a></li>
- </ul>
-
- <p>
- An <strong>Outputter</strong> is responsible for taking a barcode object and doing
- something with it. The "something" part is usually to create a graphical representation
- of the barcode in the form of an image or some sort of vector graphic. For example,
- there are already outputters that use <a href="http://rmagick.rubyforge.org/">RMagick</a>
- and <a href="http://www.cairographics.org/">Cairo</a> to create PNG, GIF, PDF, SVG and more.
- </p>
-
- <h2>How to write your own outputter</h2>
-
- <p>
- Writing an outputter is quite easy and unbureaucratic. Just create a class that
- inherits from <code>Barby::Outputter</code>. The <code>initialize</code> method
- should ideally take a barcode object as its only parameter. This object will be
- available through the <code>barcode</code> getter method. Then you create a
- method that does something with it and optionally returns something useful. This
- method can then be registered to be easily accessible through the barcode object
- itself.
- </p>
-
- <p>
- This is probably easier explained with an example. Let's say you want to create
- an outputter that creates an HTML <code>canvas</code> element. You could create
- a <code>CanvasOutputter</code> class with a <code>to_canvas</code> method
- returning the HTML string. This method would then be <code>register</code>ed
- to make it accessible to barcode objects.
- </p>
-
- <pre><code class="ruby">require 'barby/outputter'
-require 'some_helper_lib'
-
-module Barby
- class CanvasOutputter &lt; Outputter
-
- register :to_canvas
-
- def to_canvas
- create_canvas_from(barcode.encoding)
- end
-
- end
-end</code></pre>
-
- <p>
- Then you could require this class and use it with your barcodes:
- </p>
- <pre><code class="ruby">require 'barby/outputter/canvas_outputter'
-barcode = Barby::Code128B.new('In the morning I will let loaves of bread shower down')
-canvas = barcode.to_canvas</code></pre>
-
- <p>
- When used like this, the registered method will receive all the arguments
- passed to it through the barcode's proxy method.
- </p>
-
- <h3>2D barcodes</h3>
-
- <p>
- 2D barcodes are considered 1D barcodes stacked on top of each other. Their
- <code>encoding</code> method returns an array of strings instead of just
- a single string. If you want your outputter to support 2D barcodes, you
- will have to take this into account. Barcode classes inherited from
- <code>Barcode</code> have a <code>two_dimensional?</code> method which
- can be used to distinguish a 2D barcode from a 1D barcode.
- </p>
-
- <pre><code class="ruby">require 'barby/outputter'
-require 'some_helper_lib'
-
-module Barby
- class CanvasOutputter &lt; Outputter
-
- register :to_canvas
-
- def to_canvas
- if barcode.two_dimensional?
- create_2d_canvas_from(encoding)
- else
- create_1d_canvas_from(encoding)
- end
- end
-
- end
-end</code></pre>
-
- <p id="footer">
- <a href="http://tore.darell.no/">I</a> made this.
- </p>
-
- </body>
-</html>
BIN  site/qrcode.png
View
Deleted file not rendered
104 site/style.css
View
@@ -1,104 +0,0 @@
-* {
- margin: 0;
- padding: 0;
-}
-
-html {
-
-}
-
-body {
- width: 541px;
- padding: 10px;
- margin: 1em auto;
- font-family: Verdana, Arial, sans-serif;
- font-size: 90%;
-}
-
-h1 {
- text-align: center;
- font-size: 300%;
- font-weight: 100;
-}
-
-h1, h2, h3 {
- font-family: Georgia, serif;
-}
-
-h2, h3 {
- margin: 1em 0 0.5em 0;
-}
-
-#header-copy {
- margin: 1em 0 0 0;
- text-align: center;
- font-size: 90%;
-}
-
-img#header-barcode {
- margin: 0.5em 0 0 0;
-}
-
-#menu {
- list-style-type: none;
- overflow: hidden;
- margin: 0 0 3em 0;
- padding: 2px 0 0 0;
- font-size: 90%;
-}
-
- #menu li {
- float: left;
- margin-right: 2px;
- }
-
- #menu li a {
- display: block;
- background: #000;
- color: #fff;
- text-decoration: none;
- padding: 0 0.25em;
- }
-
- #menu li a:hover, #menu li a:focus {
- text-decoration: underline;
- }
-
- #menu li.current a {
- font-weight: bold;
- }
-
-p {
- margin: 1em 0;
-}
-
-pre {
- margin: 1em;
-}
-
- pre code {
- background: #f0f0f0;
- display: block;
- padding: 0.5em;
- line-height: 1.5em;
- }
-
-img.barcode {
- display: block;
- margin: 1em auto;
-}
-
-ul {
- padding-left: 1em;
-}
-
-#footer {
- font-size: 80%;
- color: #999;
- margin-top: 5em;
- text-align: center;
-}
-
- #footer a {
- color: #999;
- }
180 site/syntax.css
View
@@ -1,180 +0,0 @@
-/* Syntax highlighting */
-
-pre {
- background: #000;
- color: #fff;
- font-size: 110%;
- font-family: monospace;
- text-align: left;
- margin: 1em;
- overflow: auto;
-}
-
- pre code {
- display: block;
- padding: 1em;
- }
-
-code.ruby {
-
-}
-
- code.ruby .comment {
- color: #93B6FF;
- }
-
- code.ruby .parens {
- color: #8EFFBE;
- }
-
- code.ruby .brackets {
- color: #8EFFBE;
- }
-
- code.ruby .curly {
- color: #8EFFBE;
- }
-
- code.ruby .string {
- color: #FF8E6C;
- }
-
- code.ruby .keywords {
- color: #B1FF6C;
- }
-
- code.ruby .symbol {
- color: #FF6C9B;
- }
-
- code.ruby .instance {
- color: #C77DFF;
- }
-
- code.ruby .class {
- color: #C77DFF;
- }
-
- code.ruby .numbers {
- color: #737EFF;
- }
-
- code.ruby .constants {
- color: #FFF570;
- }
-
-
-code.css {
-
-}
-
- code.css .selectors {
- color: #C2FF7F;
- }
-
- code.css .properties {
- color: #FF7F91;
- }
-
- code.css .values {
- color: #7FA8FF;
- }
-
- code.css .comments {
- color: #999;
- }
-
- code.css .curly {
- color: #E1FFC0;
- }
-
- code.css .keywords {
- color: #FF6CA3;
- }
-
-
-code.html {
-
-}
-
- code.html .tag {
- color: #5E88FF;
- }
-
- code.html .attribute {
- color: #FF665E;
- }
-
- code.html .value {
- color: #FFA35E;
- }
-
- code.html .comment {
- color: #7E92C0;
- }
-
- code.html .brackets {
- color: #A5C969;
- }
-
- code.html .doctype {
- color: #7E92C0;
- }
-
- code.html .xml {
- color: #7E92C0;
- }
-
-
-code.javascript {
-
-}
-
- code.javascript .keywords {
- color: #E7EA78;
- }
-
- code.javascript .string {
- color: #EA8178;
- }
-
- code.javascript .global {
- color: #A1EA78;
- }
-
- code.javascript .brackets {
- color: #D3B1E2;
- }
-
- code.javascript .comment {
- color: #89A9CC;
- }
-
-
-code.irb {
-
-}
-
- code.irb .input {
-
- }
-
- code.irb .input.prompt {
- color: #3A8838;
- }
-
- code.irb .input.code {
- color: #75B474;
- }
-
- code.irb .output {
-
- }
-
- code.irb .output.prompt {
- color: #385F88;
- }
-
- code.irb .output.code {
- color: #6A98C8;
- }
Please sign in to comment.
Something went wrong with that request. Please try again.