add Ruby syntax highlighting to user guide generator

This commit is contained in:
Josh Holtrop 2019-06-08 22:56:26 -04:00
parent 5f1ad78e8c
commit 5b3e10ff72
2 changed files with 19 additions and 2 deletions

View File

@ -5,6 +5,23 @@
body {
max-width: 140ex;
}
.ruby_code .normal {}
.ruby_code .comment { color: #005; font-style: italic; }
.ruby_code .keyword { color: #A00; font-weight: bold; }
.ruby_code .method { color: #077; }
.ruby_code .class { color: #074; }
.ruby_code .module { color: #050; }
.ruby_code .punct { color: #447; font-weight: bold; }
.ruby_code .symbol { color: #099; }
.ruby_code .string { color: #090; }
.ruby_code .char { color: #F07; }
.ruby_code .ident { color: #004; }
.ruby_code .constant { color: #07F; }
.ruby_code .regex { color: #B66; }
.ruby_code .number { color: #D55; }
.ruby_code .attribute { color: #377; }
.ruby_code .global { color: #3B7; }
.ruby_code .expr { color: #227; }
</style>
</head>
<body>

View File

@ -63,9 +63,9 @@ class Generator
end
if syntax != ""
convertor = Syntax::Convertors::HTML.for_syntax(syntax)
convertor.convert(code)
%[<div class="#{syntax}_code">\n#{convertor.convert(code)}\n</div>\n]
else
"<pre>#{code}</pre>"
%[<div class="code">\n#{code}\n</div>\n]
end
end
end