Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Commit a now working version using highlights
  • Loading branch information
samcv committed Dec 19, 2016
1 parent 3e36b58 commit 67a1505
Show file tree
Hide file tree
Showing 7 changed files with 337 additions and 71 deletions.
8 changes: 8 additions & 0 deletions Makefile
Expand Up @@ -3,6 +3,14 @@
html: bigpage
perl6 htmlify.p6 --parallel=1

html-highlights: bigpage
perl6 htmlify.p6 --parallel=1 --use-highlights

init-highlights:
git clone https://github.com/atom/highlights.git ./highlights/highlights
git clone https://github.com/perl6/atom-language-perl6 ./highlights/atom-language-perl6
cd highlights/highlights; npm install .

html-nohighlight:
perl6 htmlify.p6 --no-highlight

Expand Down
19 changes: 19 additions & 0 deletions highlights/highlight-file.coffee
@@ -0,0 +1,19 @@
#!highlights/node_modules/coffee-script/bin/coffee

Highlights = require 'highlights'
fs = require 'fs'
path = require 'path'
highlighter = new Highlights()
highlighter.requireGrammarsSync
modulePath: require.resolve('./atom-language-perl6/package.json')

file_to_hl = path.resolve(process.argv[2])
console.error "Highlights is reading #{file_to_hl}"
foo = ->
fs.readFileSync file_to_hl, 'utf8'

html = highlighter.highlightSync
fileContents: foo()
scopeName: 'source.perl6fe'

console.log html
27 changes: 27 additions & 0 deletions highlights/highlight-filename-from-stdin.coffee
@@ -0,0 +1,27 @@
#!highlights/node_modules/coffee-script/bin/coffee

Highlights = require 'highlights'
fs = require 'fs'
path = require 'path'
split = require 'split'
highlighter = new Highlights()
highlighter.requireGrammarsSync
modulePath: require.resolve('./atom-language-perl6/package.json')


stdin = process.openStdin()
stdin.setEncoding 'utf8'

stdin.on 'data', (input) ->
name = input.trim()
process.exit() if name == 'exit'
file_to_hl = path.resolve(name)
console.error "Highlights is reading #{file_to_hl}"
foo = ->
fs.readFileSync file_to_hl, 'utf8'

html = highlighter.highlightSync
fileContents: foo()
scopeName: 'source.perl6fe'

console.log html
16 changes: 16 additions & 0 deletions highlights/package.json
@@ -0,0 +1,16 @@
{
"name": "perl6-highlights",
"version": "1.0.0",
"description": "Perl 6 Highlighter using Highlights",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "Samantha McVey",
"license": "Artistic-2.0",
"homepage": "https://github.com/samcv/perl6-highlights",
"dependencies": {
"highlights": "latest",
"less": "latest",
}
}
245 changes: 177 additions & 68 deletions html/css/pygments.css
@@ -1,68 +1,177 @@
td.linenos { background-color: #f0f0f0; padding-right: 10px; }
span.lineno { background-color: #f0f0f0; padding: 0 5px 0 5px; }
pre { line-height: 125%; }
body .hll { background-color: #ffffcc }
body { background: #f8f8f8; }
body .c { color: #408080; font-style: italic } /* Comment */
body .c-Singleline { color: #408080; font-style: italic } /* Comment */
body .err { border: 1px solid #FF0000 } /* Error */
body .k { color: #008000; font-weight: bold } /* Keyword */
body .o { color: #666666 } /* Operator */
body .cm { color: #408080; font-style: italic } /* Comment.Multiline */
body .cp { color: #BC7A00 } /* Comment.Preproc */
body .c1 { color: #408080; font-style: italic } /* Comment.Single */
body .cs { color: #408080; font-style: italic } /* Comment.Special */
body .gd { color: #A00000 } /* Generic.Deleted */
body .ge { font-style: italic } /* Generic.Emph */
body .gr { color: #FF0000 } /* Generic.Error */
body .gh { color: #000080; font-weight: bold } /* Generic.Heading */
body .gi { color: #00A000 } /* Generic.Inserted */
body .go { color: #888888 } /* Generic.Output */
body .gp { color: #000080; font-weight: bold } /* Generic.Prompt */
body .gs { font-weight: bold } /* Generic.Strong */
body .gu { color: #800080; font-weight: bold } /* Generic.Subheading */
body .gt { color: #0044DD } /* Generic.Traceback */
body .kc { color: #008000; font-weight: bold } /* Keyword.Constant */
body .kd { color: #008000; font-weight: bold } /* Keyword.Declaration */
body .kn { color: #008000; font-weight: bold } /* Keyword.Namespace */
body .kp { color: #008000 } /* Keyword.Pseudo */
body .kr { color: #008000; font-weight: bold } /* Keyword.Reserved */
body .kt { color: #B00040 } /* Keyword.Type */
body .m { color: #666666 } /* Literal.Number */
body .s { color: #BA2121 } /* Literal.String */
body .na { color: #7D9029 } /* Name.Attribute */
body .nb { color: #008000 } /* Name.Builtin */
body .nc { color: #0000FF; font-weight: bold } /* Name.Class */
body .no { color: #880000 } /* Name.Constant */
body .nd { color: #AA22FF } /* Name.Decorator */
body .ni { color: #999999; font-weight: bold } /* Name.Entity */
body .ne { color: #D2413A; font-weight: bold } /* Name.Exception */
body .nf { color: #0000FF } /* Name.Function */
body .nl { color: #A0A000 } /* Name.Label */
body .nn { color: #0000FF; font-weight: bold } /* Name.Namespace */
body .nt { color: #008000; font-weight: bold } /* Name.Tag */
body .nv { color: #19177C } /* Name.Variable */
body .ow { color: #AA22FF; font-weight: bold } /* Operator.Word */
body .w { color: #bbbbbb } /* Text.Whitespace */
body .mb { color: #666666 } /* Literal.Number.Bin */
body .mf { color: #666666 } /* Literal.Number.Float */
body .mh { color: #666666 } /* Literal.Number.Hex */
body .mi { color: #666666 } /* Literal.Number.Integer */
body .mo { color: #666666 } /* Literal.Number.Oct */
body .sb { color: #BA2121 } /* Literal.String.Backtick */
body .sc { color: #BA2121 } /* Literal.String.Char */
body .sd { color: #BA2121; font-style: italic } /* Literal.String.Doc */
body .s2 { color: #BA2121 } /* Literal.String.Double */
body .se { color: #BB6622; font-weight: bold } /* Literal.String.Escape */
body .sh { color: #BA2121 } /* Literal.String.Heredoc */
body .si { color: #BB6688; font-weight: bold } /* Literal.String.Interpol */
body .sx { color: #008000 } /* Literal.String.Other */
body .sr { color: #BB6688 } /* Literal.String.Regex */
body .s1 { color: #BA2121 } /* Literal.String.Single */
body .ss { color: #19177C } /* Literal.String.Symbol */
body .bp { color: #008000 } /* Name.Builtin.Pseudo */
body .vc { color: #19177C } /* Name.Variable.Class */
body .vg { color: #19177C } /* Name.Variable.Global */
body .vi { color: #19177C } /* Name.Variable.Instance */
body .il { color: #666666 } /* Literal.Number.Integer.Long */

atom-text-editor {
background-color: white;
color: #555;
}
atom-text-editor .invisible-character {
color: rgba(85, 85, 85, 0.2);
}
atom-text-editor .indent-guide {
color: rgba(85, 85, 85, 0.2);
}
atom-text-editor .wrap-guide {
background-color: rgba(85, 85, 85, 0.2);
}
atom-text-editor .gutter {
color: #555;
background: white;
}
atom-text-editor .gutter .line-number.folded,
atom-text-editor .gutter .line-number:after,
atom-text-editor .fold-marker:after {
color: #e87b00;
}
atom-text-editor .invisible {
color: #555;
}
atom-text-editor .selection .region {
background-color: #e1e1e1;
}
atom-text-editor .bracket-matcher .region {
background-color: #C9C9C9;
opacity: .7;
border-bottom: 0 none;
}
atom-text-editor.is-focused .cursor {
border-color: black;
}
atom-text-editor.is-focused .selection .region {
background-color: #afc4da;
}
atom-text-editor.is-focused .line-number.cursor-line-no-selection,
atom-text-editor.is-focused .line.cursor-line {
background-color: rgba(255, 255, 134, 0.34);
}
.comment {
color: #999988;
font-style: italic;
}
.string {
color: #D14;
}
.string .source,
.string .meta.embedded.line {
color: #5A5A5A;
}
.string .punctuation.section.embedded {
color: #920B2D;
}
.string .punctuation.section.embedded .source {
color: #920B2D;
}
.constant.numeric {
color: #D14;
}
.constant.language {
color: #606aa1;
}
.constant.character,
.constant.other {
color: #606aa1;
}
.constant.symbol {
color: #990073;
}
.constant.numeric.line-number.find-in-files .match {
color: rgba(143, 190, 0, 0.63);
}
.variable {
color: #008080;
}
.variable.parameter {
color: #606aa1;
}
.keyword {
color: #222;
font-weight: bold;
}
.keyword.unit {
color: #445588;
}
.keyword.special-method {
color: #0086B3;
}
.storage {
color: #222;
}
.storage.type {
color: #222;
}
.entity.name.class {
text-decoration: underline;
color: #606aa1;
}
.entity.other.inherited-class {
text-decoration: underline;
color: #606aa1;
}
.entity.name.function {
color: #900;
}
.entity.name.tag {
color: #008080;
}
.entity.other.attribute-name {
color: #458;
font-weight: bold;
}
.entity.name.filename.find-in-files {
color: #E6DB74;
}
.support.constant,
.support.function,
.support.type {
color: #458;
}
.support.class {
color: #008080;
}
.invalid {
color: #F8F8F0;
background-color: #00A8C6;
}
.invalid.deprecated {
color: #F8F8F0;
background-color: #8FBE00;
}
.meta.structure.dictionary.json > .string.quoted.double.json,
.meta.structure.dictionary.json > .string.quoted.double.json .punctuation.string {
color: #000080;
}
.meta.structure.dictionary.value.json > .string.quoted.double.json {
color: #d14;
}
.meta.diff,
.meta.diff.header {
color: #75715E;
}
.css.support.property-name {
font-weight: bold;
color: #333;
}
.css.constant {
color: #099;
}
.source.gfm {
color: #444;
}
.gfm .markup.heading {
color: #111;
}
.gfm .link {
color: #888;
}
.gfm .variable.list {
color: #888;
}
.markdown .paragraph {
color: #444;
}
.markdown .heading {
color: #111;
}
.markdown .link {
color: #888;
}
.markdown .link .string {
color: #888;
}
68 changes: 68 additions & 0 deletions html/css/pygments.css.bak
@@ -0,0 +1,68 @@
td.linenos { background-color: #f0f0f0; padding-right: 10px; }
span.lineno { background-color: #f0f0f0; padding: 0 5px 0 5px; }
pre { line-height: 125%; }
body .hll { background-color: #ffffcc }
body { background: #f8f8f8; }
body .c { color: #408080; font-style: italic } /* Comment */
body .c-Singleline { color: #408080; font-style: italic } /* Comment */
body .err { border: 1px solid #FF0000 } /* Error */
body .k { color: #008000; font-weight: bold } /* Keyword */
body .o { color: #666666 } /* Operator */
body .cm { color: #408080; font-style: italic } /* Comment.Multiline */
body .cp { color: #BC7A00 } /* Comment.Preproc */
body .c1 { color: #408080; font-style: italic } /* Comment.Single */
body .cs { color: #408080; font-style: italic } /* Comment.Special */
body .gd { color: #A00000 } /* Generic.Deleted */
body .ge { font-style: italic } /* Generic.Emph */
body .gr { color: #FF0000 } /* Generic.Error */
body .gh { color: #000080; font-weight: bold } /* Generic.Heading */
body .gi { color: #00A000 } /* Generic.Inserted */
body .go { color: #888888 } /* Generic.Output */
body .gp { color: #000080; font-weight: bold } /* Generic.Prompt */
body .gs { font-weight: bold } /* Generic.Strong */
body .gu { color: #800080; font-weight: bold } /* Generic.Subheading */
body .gt { color: #0044DD } /* Generic.Traceback */
body .kc { color: #008000; font-weight: bold } /* Keyword.Constant */
body .kd { color: #008000; font-weight: bold } /* Keyword.Declaration */
body .kn { color: #008000; font-weight: bold } /* Keyword.Namespace */
body .kp { color: #008000 } /* Keyword.Pseudo */
body .kr { color: #008000; font-weight: bold } /* Keyword.Reserved */
body .kt { color: #B00040 } /* Keyword.Type */
body .m { color: #666666 } /* Literal.Number */
body .s { color: #BA2121 } /* Literal.String */
body .na { color: #7D9029 } /* Name.Attribute */
body .nb { color: #008000 } /* Name.Builtin */
body .nc { color: #0000FF; font-weight: bold } /* Name.Class */
body .no { color: #880000 } /* Name.Constant */
body .nd { color: #AA22FF } /* Name.Decorator */
body .ni { color: #999999; font-weight: bold } /* Name.Entity */
body .ne { color: #D2413A; font-weight: bold } /* Name.Exception */
body .nf { color: #0000FF } /* Name.Function */
body .nl { color: #A0A000 } /* Name.Label */
body .nn { color: #0000FF; font-weight: bold } /* Name.Namespace */
body .nt { color: #008000; font-weight: bold } /* Name.Tag */
body .nv { color: #19177C } /* Name.Variable */
body .ow { color: #AA22FF; font-weight: bold } /* Operator.Word */
body .w { color: #bbbbbb } /* Text.Whitespace */
body .mb { color: #666666 } /* Literal.Number.Bin */
body .mf { color: #666666 } /* Literal.Number.Float */
body .mh { color: #666666 } /* Literal.Number.Hex */
body .mi { color: #666666 } /* Literal.Number.Integer */
body .mo { color: #666666 } /* Literal.Number.Oct */
body .sb { color: #BA2121 } /* Literal.String.Backtick */
body .sc { color: #BA2121 } /* Literal.String.Char */
body .sd { color: #BA2121; font-style: italic } /* Literal.String.Doc */
body .s2 { color: #BA2121 } /* Literal.String.Double */
body .se { color: #BB6622; font-weight: bold } /* Literal.String.Escape */
body .sh { color: #BA2121 } /* Literal.String.Heredoc */
body .si { color: #BB6688; font-weight: bold } /* Literal.String.Interpol */
body .sx { color: #008000 } /* Literal.String.Other */
body .sr { color: #BB6688 } /* Literal.String.Regex */
body .s1 { color: #BA2121 } /* Literal.String.Single */
body .ss { color: #19177C } /* Literal.String.Symbol */
body .bp { color: #008000 } /* Name.Builtin.Pseudo */
body .vc { color: #19177C } /* Name.Variable.Class */
body .vg { color: #19177C } /* Name.Variable.Global */
body .vi { color: #19177C } /* Name.Variable.Instance */
body .il { color: #666666 } /* Literal.Number.Integer.Long */

0 comments on commit 67a1505

Please sign in to comment.