From ff120df8f59f85a26e0673c1a2a3cab03bd0bf8c Mon Sep 17 00:00:00 2001 From: SheetJS Date: Thu, 22 Sep 2016 15:25:25 -0400 Subject: [PATCH] syntax highlighting in README [ci skip] closes #13 (h/t @amilajack) --- README.md | 37 +++++++++++++++++++++++++------------ misc/README.md.ascii | 33 ++++++++++++++++++++++----------- misc/README.md.utf16be | Bin 37686 -> 37926 bytes misc/README.md.utf16le | Bin 37686 -> 37926 bytes misc/README.md.utf32be | Bin 75368 -> 75848 bytes misc/README.md.utf32le | Bin 75368 -> 75848 bytes misc/README.md.utf7 | 33 ++++++++++++++++++++++----------- misc/README.md.utf8 | 33 ++++++++++++++++++++++----------- 8 files changed, 91 insertions(+), 45 deletions(-) diff --git a/README.md b/README.md index a94e544..3a83bdd 100644 --- a/README.md +++ b/README.md @@ -13,16 +13,22 @@ which codepages are used. In node: - var cptable = require('codepage'); +```js +var cptable = require('codepage'); +``` In the browser: - - +```html + + +``` Alternatively, use the full version in the dist folder: - +```html + +``` The complete set of codepages is large due to some Double Byte Character Set encodings. A much smaller file that just includes SBCS codepages is provided in @@ -32,12 +38,14 @@ If you know which codepages you need, you can include individual scripts for each codepage. The individual files are provided in the `bits/` directory. For example, to include only the Mac codepages: - - - - - - +```html + + + + + + +``` All of the browser scripts define and append to the `cptable` object. To rename the object, edit the `JSVAR` shell variable in `make.sh` and run the script. @@ -76,6 +84,9 @@ and returns a representation controlled by `ofmt`: - If `ofmt == 'str'`, return a String where `o.charCodeAt(i)` is the `i`-th byte - If `ofmt == 'arr'`, return an Array of bytes +`cptable.utils.decode(CP, data)` accepts a byte String or Array of numbers or +Buffer and returns a JS string. + ## Known Excel Codepages A much smaller script, including only the codepages known to be used in Excel, @@ -96,7 +107,7 @@ The `make.sh` script in the repo can take a manifest and generate JS source. Usage: ```bash -bash make.sh path_to_manifest output_file_name JSVAR +$ bash make.sh path_to_manifest output_file_name JSVAR ``` where @@ -107,7 +118,9 @@ where The manifest file is expected to be a CSV with 3 columns: - ,, +``` +,, +``` If a source is specified, it will try to download the specified file and parse. The file format is expected to follow the format from the unicode.org site. diff --git a/misc/README.md.ascii b/misc/README.md.ascii index f5493f4..5e98d97 100644 --- a/misc/README.md.ascii +++ b/misc/README.md.ascii @@ -13,16 +13,22 @@ which codepages are used. In node: - var cptable = require('codepage'); +```js +var cptable = require('codepage'); +``` In the browser: - - +```html + + +``` Alternatively, use the full version in the dist folder: - +```html + +``` The complete set of codepages is large due to some Double Byte Character Set encodings. A much smaller file that just includes SBCS codepages is provided in @@ -32,12 +38,14 @@ If you know which codepages you need, you can include individual scripts for each codepage. The individual files are provided in the `bits/` directory. For example, to include only the Mac codepages: - - - - - - +```html + + + + + + +``` All of the browser scripts define and append to the `cptable` object. To rename the object, edit the `JSVAR` shell variable in `make.sh` and run the script. @@ -76,6 +84,9 @@ and returns a representation controlled by `ofmt`: - If `ofmt == 'str'`, return a String where `o.charCodeAt(i)` is the `i`-th byte - If `ofmt == 'arr'`, return an Array of bytes +`cptable.utils.decode(CP, data)` accepts a byte String or Array of numbers or +Buffer and returns a JS string. + ## Known Excel Codepages A much smaller script, including only the codepages known to be used in Excel, @@ -96,7 +107,7 @@ The `make.sh` script in the repo can take a manifest and generate JS source. Usage: ```bash -bash make.sh path_to_manifest output_file_name JSVAR +$ bash make.sh path_to_manifest output_file_name JSVAR ``` where diff --git a/misc/README.md.utf16be b/misc/README.md.utf16be index 81b034713c6c391cee409f1576e830faafa93041..94a42d366acd8f9759d241fadbf55801923ddeb4 100644 GIT binary patch delta 299 zcmdnCjA_{lrVXkrlT*dLc-0v+8LSz&7!p8masi7vKbXak!BE1G%aFssHMxLOdh$*d zoymoqQj^(Pbyy)P4Oq*usyxYR22rv34{I(n7A3wwgLEc; z(p1f3CrAxKAbF(XN6Pd?76gu)l*LgmM!@O@F#en*khp6tx6v^kgi0_SE~u@%glPfEsC0RX^4 BD(L_K diff --git a/misc/README.md.utf16le b/misc/README.md.utf16le index af535c05515d8e85c85d9de093ca1a134c769ace..471d1854b17b94bd94034f837c74df1ea577a647 100644 GIT binary patch delta 271 zcmdnCjA_{lrVT1AlT*aKCSMX4nq0!7#Gk+bf*A}Y47m(B3|y1*Ii)A>V9}Xez$rDE zja7#gEI(PFwH&L;6Rc)X6^)AWo2A(Nn6W7H1sbL^`2(i{n0Da;(OQ$IaVbqcz~uvG z+i@#FjM*H^eVLOnVe(x8?aAAO1SVe+l44I{s06w$b@EFgP1QVxQlLAN7*ZLE7>XGb z81jL%0s|L=6Hq)22tncslhuV~g}oSpfilHFoka|p40#Oc40@ZjMb|Pjt1u{RzAh18 F1ps(pMa}>K delta 213 zcmZ3sf@#|_rVT1A>?eR3U(3Y@=@#T|()KUs`bW3n4-36hxhVDf(zk;$()TqeuQ@(5-yFffz=aV`+& z05R9(2SVnP`MEfNIszs?7BT^{BPNT>iA>JsdO|?QZ0;1GN{Pw*&IX&!dFHU;R6ZMM zaKz-t!VZ&-MP>lmA(Qn*T_!h+LfG|UE+7jx9~YY;JXu)PX7YDMnaSCz3X>PBnoLe# zCNlZDs?X%((h|DGK=&#DaXt_iLD^hD+6jnDfjA9{Q-O5RBwO*x@oE~pUO-MT5Gw$2 c@#Hu1(vv^4i)_x;a$#px0SRwjW4PxF0O!t9-v9sr delta 208 zcmX?cf#t;+mJQwvakc1whO|uF+`##9~MDVH%SyzS@`7lqAqBf4a8<| YzAZLKc=B&{p3TlWF6^88jdy+l00Oi)3IG5A diff --git a/misc/README.md.utf32le b/misc/README.md.utf32le index ec50875c705eeb99c4e726162728bf97a6b51a5c..bbda127b3e010b731b5236140a94daa21cafa1fc 100644 GIT binary patch delta 265 zcmaEHhULTsmJJ>plN%H@Ccn|knS6yqVDbiik;!xPcqa2m3QYbWCNo)qlLsizGd)Cs zQGk(a@?9bG$pxGdlOG6~0BMfNB3uEJMdU;#XK+11S2lq=2Ph>m`GP6WW&xf9Y^d_H zfkpt05q6ktATk5U4wN2@O6vD0%a{(E<`H0vI;mKP}R3=|gl9+r$mS>WZz~l^7 zg~_s+bXt}Vns(@5(UTL`h3jp}GRplV?~6Og^El)!Q?v}0+au6cmTyjCTDPVKxvD~I$QyhZ;0_s zp22koEH;CC&SVZFk;w-fH8wZ!%wU5mG?<(toPxwwnXDn=0O!vUL6%dPoU@2ya*U`A hT>gwGs(g!>%jO$mbA%_`Nb_uV&~ahk++)1w3jnRiM6v(? diff --git a/misc/README.md.utf7 b/misc/README.md.utf7 index fe6c549..82d2bff 100644 --- a/misc/README.md.utf7 +++ b/misc/README.md.utf7 @@ -13,16 +13,22 @@ which codepages are used. In node: - var cptable +AD0 require('codepage')+ADs ++AGAAYABg-js +var cptable +AD0 require('codepage')+ADs ++AGAAYABg In the browser: - +ADw-script src+AD0AIg-cptable.js+ACIAPgA8-/script+AD4 - +ADw-script src+AD0AIg-cputils.js+ACIAPgA8-/script+AD4 ++AGAAYABg-html ++ADw-script src+AD0AIg-cptable.js+ACIAPgA8-/script+AD4 ++ADw-script src+AD0AIg-cputils.js+ACIAPgA8-/script+AD4 ++AGAAYABg Alternatively, use the full version in the dist folder: - +ADw-script src+AD0AIg-cptable.full.js+ACIAPgA8-/script+AD4 ++AGAAYABg-html ++ADw-script src+AD0AIg-cptable.full.js+ACIAPgA8-/script+AD4 ++AGAAYABg The complete set of codepages is large due to some Double Byte Character Set encodings. A much smaller file that just includes SBCS codepages is provided in @@ -32,12 +38,14 @@ If you know which codepages you need, you can include individual scripts for each codepage. The individual files are provided in the +AGA-bits/+AGA directory. For example, to include only the Mac codepages: - +ADw-script src+AD0AIg-bits/10000.js+ACIAPgA8-/script+AD4 - +ADw-script src+AD0AIg-bits/10006.js+ACIAPgA8-/script+AD4 - +ADw-script src+AD0AIg-bits/10007.js+ACIAPgA8-/script+AD4 - +ADw-script src+AD0AIg-bits/10029.js+ACIAPgA8-/script+AD4 - +ADw-script src+AD0AIg-bits/10079.js+ACIAPgA8-/script+AD4 - +ADw-script src+AD0AIg-bits/10081.js+ACIAPgA8-/script+AD4 ++AGAAYABg-html ++ADw-script src+AD0AIg-bits/10000.js+ACIAPgA8-/script+AD4 ++ADw-script src+AD0AIg-bits/10006.js+ACIAPgA8-/script+AD4 ++ADw-script src+AD0AIg-bits/10007.js+ACIAPgA8-/script+AD4 ++ADw-script src+AD0AIg-bits/10029.js+ACIAPgA8-/script+AD4 ++ADw-script src+AD0AIg-bits/10079.js+ACIAPgA8-/script+AD4 ++ADw-script src+AD0AIg-bits/10081.js+ACIAPgA8-/script+AD4 ++AGAAYABg All of the browser scripts define and append to the +AGA-cptable+AGA object. To rename the object, edit the +AGA-JSVAR+AGA shell variable in +AGA-make.sh+AGA and run the script. @@ -76,6 +84,9 @@ and returns a representation controlled by +AGA-ofmt+AGA: - If +AGA-ofmt +AD0APQ 'str'+AGA, return a String where +AGA-o.charCodeAt(i)+AGA is the +AGA-i+AGA--th byte - If +AGA-ofmt +AD0APQ 'arr'+AGA, return an Array of bytes ++AGA-cptable.utils.decode(CP, data)+AGA accepts a byte String or Array of numbers or +Buffer and returns a JS string. + +ACMAIw Known Excel Codepages A much smaller script, including only the codepages known to be used in Excel, @@ -96,7 +107,7 @@ The +AGA-make.sh+AGA script in the repo can take a manifest and generate JS sour Usage: +AGAAYABg-bash -bash make.sh path+AF8-to+AF8-manifest output+AF8-file+AF8-name JSVAR ++ACQ bash make.sh path+AF8-to+AF8-manifest output+AF8-file+AF8-name JSVAR +AGAAYABg where diff --git a/misc/README.md.utf8 b/misc/README.md.utf8 index a94e544..34021f5 100644 --- a/misc/README.md.utf8 +++ b/misc/README.md.utf8 @@ -13,16 +13,22 @@ which codepages are used. In node: - var cptable = require('codepage'); +```js +var cptable = require('codepage'); +``` In the browser: - - +```html + + +``` Alternatively, use the full version in the dist folder: - +```html + +``` The complete set of codepages is large due to some Double Byte Character Set encodings. A much smaller file that just includes SBCS codepages is provided in @@ -32,12 +38,14 @@ If you know which codepages you need, you can include individual scripts for each codepage. The individual files are provided in the `bits/` directory. For example, to include only the Mac codepages: - - - - - - +```html + + + + + + +``` All of the browser scripts define and append to the `cptable` object. To rename the object, edit the `JSVAR` shell variable in `make.sh` and run the script. @@ -76,6 +84,9 @@ and returns a representation controlled by `ofmt`: - If `ofmt == 'str'`, return a String where `o.charCodeAt(i)` is the `i`-th byte - If `ofmt == 'arr'`, return an Array of bytes +`cptable.utils.decode(CP, data)` accepts a byte String or Array of numbers or +Buffer and returns a JS string. + ## Known Excel Codepages A much smaller script, including only the codepages known to be used in Excel, @@ -96,7 +107,7 @@ The `make.sh` script in the repo can take a manifest and generate JS source. Usage: ```bash -bash make.sh path_to_manifest output_file_name JSVAR +$ bash make.sh path_to_manifest output_file_name JSVAR ``` where