Skip to content

Commit

Permalink
Merge branch 'master' of github.com:perl6/doc
Browse files Browse the repository at this point in the history
Conflicts:
	util/update-and-sync

Conflits resolved successfully
  • Loading branch information
Paul Cochrane committed Feb 21, 2015
2 parents 1266647 + cb7856f commit 38dfcf2
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 8 deletions.
26 changes: 19 additions & 7 deletions htmlify.p6
Original file line number Diff line number Diff line change
Expand Up @@ -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 ...';

Expand Down Expand Up @@ -106,6 +117,7 @@ sub MAIN(
Bool :$disambiguation = True,
Bool :$search-file = True,
Bool :$no-highlight = False,
Bool :$no-inline-python = False,
) {
$*DEBUG = $debug;

Expand All @@ -124,7 +136,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;
Expand Down Expand Up @@ -681,7 +693,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+ {
Expand All @@ -697,7 +709,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{
Expand All @@ -711,7 +723,7 @@ def p6format(code):
});
$py;
}
if defined $py {
if $py {
say "Using syntax hilight using Inline::Python";
}

Expand All @@ -722,7 +734,7 @@ def p6format(code):
return default($node);
}
}
if defined $py {
if $py {
return $py.call('__main__', 'p6format', $node.contents.join);
}
else {
Expand Down
2 changes: 1 addition & 1 deletion util/update-and-sync
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ 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
time ./htmlify.p6 --no-inline-python || ./util/sync-build-log
./util/sync
fi

Expand Down

0 comments on commit 38dfcf2

Please sign in to comment.