From 054885336ea9c84808f32648fd4acee368615d98 Mon Sep 17 00:00:00 2001 From: Moritz Lenz Date: Sat, 21 Feb 2015 13:58:38 +0100 Subject: [PATCH 1/4] htmlify: option for disabling Inline::Python --- htmlify.p6 | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/htmlify.p6 b/htmlify.p6 index 6783d043c..85d264369 100755 --- a/htmlify.p6 +++ b/htmlify.p6 @@ -106,6 +106,7 @@ sub MAIN( Bool :$disambiguation = True, Bool :$search-file = True, Bool :$no-highlight = False, + Bool :$no-inline-python = False, ) { $*DEBUG = $debug; @@ -124,7 +125,7 @@ sub MAIN( process-pod-dir 'Language', :$sparse; process-pod-dir 'Type', :sorted-by{ %h{.key} // -1 }, :$sparse; - highlight-code-blocks unless $no-highlight; + highlight-code-blocks(:use-inline-python(!$no-inline-python)) unless $no-highlight; say 'Composing doc registry ...'; $*DR.compose; @@ -681,7 +682,7 @@ sub write-qualified-method-call(:$name!, :$pod!, :$type!) { spurt "html/routine/{$type}.{$name}.html", p2h($p, 'routine'); } -sub highlight-code-blocks { +sub highlight-code-blocks(:$use-inline-python = True) { my $pyg-version = try qx/pygmentize -V/; if $pyg-version && $pyg-version ~~ /^'Pygments version ' (\d\S+)/ { if Version.new(~$0) ~~ v2.0+ { @@ -697,7 +698,7 @@ sub highlight-code-blocks { return; } - my $py = try { + my $py = $use-inline-python && try { require Inline::Python; my $py = ::('Inline::Python').new(); $py.run(q{ @@ -711,7 +712,7 @@ def p6format(code): }); $py; } - if defined $py { + if $py { say "Using syntax hilight using Inline::Python"; } @@ -722,7 +723,7 @@ def p6format(code): return default($node); } } - if defined $py { + if $py { return $py.call('__main__', 'p6format', $node.contents.join); } else { From 12cfc6ae5f0938329b8bc3a5f6729bd7b583aa89 Mon Sep 17 00:00:00 2001 From: Moritz Lenz Date: Sat, 21 Feb 2015 14:01:10 +0100 Subject: [PATCH 2/4] Restore hilighting, though without Inline::Python --- util/update-and-sync | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/util/update-and-sync b/util/update-and-sync index ee0643cdc..aa1b84071 100755 --- a/util/update-and-sync +++ b/util/update-and-sync @@ -21,6 +21,6 @@ else exec >$LOGFILE 2>&1 # if the htmilfy fails, sync the build log. # since sync-build-log returns false, not the whole thing is synced - ./htmlify.p6 --no-highlight || ./util/sync-build-log + ./htmlify.p6 --no-inline-python || ./util/sync-build-log ./util/sync fi From 96d4af2ccc58fa4800be8363a8076dfcdd73a8b2 Mon Sep 17 00:00:00 2001 From: Moritz Lenz Date: Sat, 21 Feb 2015 14:05:58 +0100 Subject: [PATCH 3/4] record htmlify time --- util/update-and-sync | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/util/update-and-sync b/util/update-and-sync index aa1b84071..72165314e 100755 --- a/util/update-and-sync +++ b/util/update-and-sync @@ -21,6 +21,6 @@ else exec >$LOGFILE 2>&1 # if the htmilfy fails, sync the build log. # since sync-build-log returns false, not the whole thing is synced - ./htmlify.p6 --no-inline-python || ./util/sync-build-log + time ./htmlify.p6 --no-inline-python || ./util/sync-build-log ./util/sync fi From cb7856f661d2c7b5273ca93f643c61492c8b0b3f Mon Sep 17 00:00:00 2001 From: Moritz Lenz Date: Sat, 21 Feb 2015 14:14:58 +0100 Subject: [PATCH 4/4] htmlify: document the build process in the comments --- htmlify.p6 | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/htmlify.p6 b/htmlify.p6 index 85d264369..2dbe926ba 100755 --- a/htmlify.p6 +++ b/htmlify.p6 @@ -4,8 +4,19 @@ use v6; # This script isn't in bin/ because it's not meant to be installed. # For syntax highlighting, needs pygmentize version 2.0 or newer installed # -# Build logs of this script for docs.perl6.org can be found here: -# http://doc.perl6.org/build-log/ +# for doc.perl6.org, the build process goes like this: +# * a cron job on hack.p6c.org as user 'doc.perl6.org' triggers the rebuild. +# It looks like this: +# +# */5 * * * * flock -n ~/update.lock -c ./doc/util/update-and-sync > update.log 2>&1 +# +# util/update-and-sync is under version control in the perl6/doc repo (same as +# this file), and it first updtes the git repository. If something changed, it +# run htmlify, captures the output, and on success, syncs both the generated +# files and the logs. In case of failure, only the logs are synchronized. +# +# The build logs are available at http://doc.perl6.org/build-log/ +# BEGIN say 'Initializing ...';