@rip-lang/print 0.1.1 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/print.rip +6 -4
package/package.json
CHANGED
package/print.rip
CHANGED
|
@@ -216,10 +216,12 @@ for file in allFiles
|
|
|
216
216
|
code = stripTopComments(code) if bypass
|
|
217
217
|
lang = getLang file
|
|
218
218
|
lineCount = code.split('\n').length
|
|
219
|
+
mtime = statSync(file).mtime
|
|
220
|
+
timestamp = mtime.toLocaleDateString('en-US', { year: 'numeric', month: 'short', day: 'numeric' }) + ' at ' + mtime.toLocaleTimeString('en-US', { hour: 'numeric', minute: '2-digit' }).toLowerCase()
|
|
219
221
|
console.log " #{file} (#{lineCount} lines) [#{lang}]"
|
|
220
222
|
highlighted = highlightCode code, lang
|
|
221
223
|
html = "<pre><code class=\"hljs\">#{highlighted}</code></pre>"
|
|
222
|
-
sections.push { file, lineCount, lang, html }
|
|
224
|
+
sections.push { file, lineCount, lang, timestamp, html }
|
|
223
225
|
|
|
224
226
|
# ============================================================================
|
|
225
227
|
# HTML template
|
|
@@ -258,7 +260,7 @@ for section, i in sections
|
|
|
258
260
|
fileSections += """
|
|
259
261
|
<div class="file-section">
|
|
260
262
|
<div class="file-header" id="#{section.file}">
|
|
261
|
-
<span>#{section.file} <span class="meta">(#{section.lineCount} lines) [#{section.lang}]</span></span>
|
|
263
|
+
<span>#{section.file} <span class="meta">(#{section.lineCount} lines) [#{section.lang}] on #{section.timestamp}</span></span>
|
|
262
264
|
<span class="nav">#{nav}</span>
|
|
263
265
|
</div>
|
|
264
266
|
<div class="code-container">
|
|
@@ -306,8 +308,8 @@ html = """
|
|
|
306
308
|
|
|
307
309
|
.code-container { overflow-x: auto; }
|
|
308
310
|
.code-container pre { margin: 0; border-radius: 0; }
|
|
309
|
-
.code-container code { font-size: 13px; line-height: 1.5; padding:
|
|
310
|
-
.line-num { color: #aaa; user-select: none; display: inline-block; min-width: 2em; text-align: right; }
|
|
311
|
+
.code-container code { font-size: 13px; line-height: 1.5; padding: 0 !important; display: block; }
|
|
312
|
+
.line-num { color: #aaa; background: #{if dark then '#161b22' else '#f4f4f4'}; user-select: none; display: inline-block; min-width: 2em; text-align: right; padding: 0 0.7em; margin-right: 0.7em; border-left: 1px solid #{borderColor}; border-right: 1px solid #{borderColor}; }
|
|
311
313
|
|
|
312
314
|
@media print {
|
|
313
315
|
.toc { page-break-after: always; }
|