Skip to content

Commit 567e623

Browse files
committed
Merge branch 'doc-reorg'
2 parents 11d081b + c0e339b commit 567e623

File tree

5 files changed

+138
-118
lines changed

5 files changed

+138
-118
lines changed

Makefile

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,16 @@ SELINUX_OPT := $(shell [ $(DOCKER_SELINUX_LABEL) -eq 1 ] && echo "$(COL
99
.PHONY: html init-highlights html-nohighlight sparse assets webdev-build \
1010
bigpage test xtest ctest help run clean-html clean-images \
1111
clean-search clean test-links push \
12+
gen-pod6-source clean-build \
1213
docker-image docker-htmlify docker-test docker-xtest docker-ctest docker-testall docker-run
1314

14-
html: bigpage htmlify
15+
html: gen-pod6-source bigpage htmlify
1516

16-
htmlify: init-highlights assets gen-pod6-source
17+
htmlify: init-highlights assets
1718
perl6 htmlify.p6
1819

1920
gen-pod6-source:
20-
perl6 manage-page-order.p6 update
21+
perl6 util/manage-page-order.p6 update
2122

2223
init-highlights:
2324
ATOMDIR="./highlights/atom-language-perl6"; \
@@ -38,7 +39,7 @@ webdev-build:
3839
perl6 htmlify.p6 --no-highlight --sparse=200
3940

4041
bigpage:
41-
pod2onepage --html -v --source-path=./doc --exclude=404.pod6 > html/perl6.html
42+
pod2onepage --html -v --source-path=./build --exclude=404.pod6 > html/perl6.html
4243

4344
# Common tests that are run by travis with every commit
4445
test:
@@ -75,6 +76,8 @@ help:
7576
@echo "docker-testall: run all tests (in container)"
7677
@echo "docker-run: run the development webserver (in container)"
7778

79+
start: run
80+
7881
run:
7982
@echo "Starting local server…"
8083
./app-start
@@ -121,6 +124,9 @@ clean-images:
121124
clean-search:
122125
rm -f html/js/search.js
123126

127+
clean-build:
128+
find build -name "*.pod6" -exec rm -f {} \;
129+
124130
clean: clean-html clean-images clean-search
125131

126132
distclean: clean

doc/Language/0-html-source/README

Lines changed: 0 additions & 1 deletion
This file was deleted.

htmlify.p6

Lines changed: 18 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -195,9 +195,9 @@ sub MAIN(
195195
my %h = $type-graph.sorted.kv.flat.reverse;
196196
write-type-graph-images(:force($typegraph), :$parallel);
197197

198-
process-pod-dir 'Programs', :$sparse, :$parallel;
199-
process-pod-dir 'Language', :$sparse, :$parallel;
200-
process-pod-dir 'Type', :sorted-by{ %h{.key} // -1 }, :$sparse, :$parallel;
198+
process-pod-dir :topdir('build'), :dir('Programs'), :$sparse, :$parallel;
199+
process-pod-dir :topdir('build'), :dir('Language'), :$sparse, :$parallel;
200+
process-pod-dir :topdir('build'), :dir('Type'), :sorted-by{ %h{.key} // -1 }, :$sparse, :$parallel;
201201

202202
highlight-code-blocks unless $no-highlight;
203203

@@ -236,8 +236,9 @@ sub MAIN(
236236
spurt('links.txt', $url-log.URLS.sort.unique.join("\n"));
237237
}
238238

239-
sub process-pod-dir($dir, :&sorted-by = &[cmp], :$sparse, :$parallel) {
240-
say "Reading doc/$dir ...";
239+
sub process-pod-dir(:$topdir, :$dir, :&sorted-by = &[cmp], :$sparse, :$parallel) {
240+
#say "Reading doc/$dir ...";
241+
say "Reading $topdir/$dir ...";
241242

242243
# What does this array look like?
243244
#
@@ -251,35 +252,27 @@ sub process-pod-dir($dir, :&sorted-by = &[cmp], :$sparse, :$parallel) {
251252
# value: filename relative to the "doc/$dir" directory
252253
my @pod-sources;
253254

254-
if $dir eq 'Language' {
255-
# uses a special sort order by :page-order<id> as a %config hash entry
256-
# TODO treat the Programs directory the same way
257-
# use the target files auto-generated:
258-
@pod-sources = get-pod6-page-order(:dir("$dir/0-html-source"));
259-
}
260-
else {
261-
# default sort is by name {%hash{.key} => file basename w/o extension
262-
@pod-sources =
263-
recursive-dir("doc/$dir/")
264-
.grep({.path ~~ / '.pod6' $/})
265-
.map({
266-
.path.subst("doc/$dir/", '')
267-
.subst(rx{\.pod6$}, '')
268-
.subst(:g, '/', '::')
269-
=> $_
255+
# default sort is by name {%hash{.key} => file basename w/o extension
256+
@pod-sources =
257+
recursive-dir("$topdir/$dir/")
258+
.grep({.path ~~ / '.pod6' $/})
259+
.map({
260+
.path.subst("$topdir/$dir/", '')
261+
.subst(rx{\.pod6$}, '')
262+
.subst(:g, '/', '::')
263+
=> $_
270264
}).sort(&sorted-by);
271-
}
272265

273266
=begin comment
274267
# PLEASE LEAVE THIS DEBUG CODE IN UNTIL WE'RE HAPPY
275268
# WITH LANGUAGE PAGE SORTING AND DISPLAY
276-
if 0 && $dir eq 'Language' {
269+
#if 1 && $dir eq 'Language' {
277270
#if 1 && $dir eq 'Programs' {
278271
say "\@pod-sources:";
279272
for @pod-sources.kv -> $num, (:key($filename), :value($file)) {
280273
say "num: $num; key: |$filename|; value : |$file|";
281274
}
282-
#die "debug exit";
275+
die "debug exit";
283276
}
284277
=end comment
285278

@@ -288,7 +281,7 @@ sub process-pod-dir($dir, :&sorted-by = &[cmp], :$sparse, :$parallel) {
288281
@pod-sources = @pod-sources[^(@pod-sources / $sparse).ceiling];
289282
}
290283

291-
say "Processing $dir Pod files ...";
284+
say "Processing $topdir/$dir Pod files ...";
292285
my $total = +@pod-sources;
293286
my $kind = $dir.lc;
294287
for @pod-sources.kv -> $num, (:key($filename), :value($file)) {

lib/Pod/Htmlify.pm6

Lines changed: 0 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -127,56 +127,4 @@ sub get-page-order-value($fname) is export {
127127
return $sortid;
128128
}
129129

130-
#| Return an array of pod6 page file name data sorted by :page-order value
131-
sub get-pod6-page-order(:$dir) is export {
132-
# caller: process-pod-dir
133-
#
134-
# Return the .pod6 files found in $dir with :page-order values
135-
# as an array of pairs of file basename (stripped of 'pod6')
136-
# as key, and file names (relative to 'doc') as values.
137-
# The array of such pairs is sorted in :page-order value
138-
# alphabetical order.
139-
#
140-
# Note any .pod6 not having a :page-order entry is not
141-
# included in the outout array.
142-
#
143-
# An exception is thrown if a duplicate :page-order key is found.
144-
#
145-
146-
my $d = "doc/$dir";
147-
die "FATAL: '$d' is NOT a known directory'" if !$d.IO.d;
148-
149-
my %h;
150-
for (dir $d) -> $f {
151-
next if !$f.IO.f;
152-
next if $f !~~ /'.pod6' $/;
153-
154-
my $sortid = get-page-order-value $f;
155-
next if !$sortid;
156-
157-
# the sortid must be unique for each file in this directory
158-
die "FATAL: Duplicate :page-order key '$sortid' in file '$f'"
159-
if %h{$sortid};
160-
161-
my $key = $f.basename;
162-
# remove the pod6 extension
163-
$key ~~ s/'.pod6'//;
164-
my $value = $f;
165-
# pack it all up
166-
%h{$sortid} = ($key, $value);
167-
}
168-
169-
# turn the hash into a sorted array
170-
my @keys = %h.keys.sort;
171-
my @arr;
172-
# TODO below can be improved after all else is satisfactory
173-
for @keys -> $k {
174-
my @a = @(%h{$k});
175-
my $hk = @a.shift;
176-
my $hv = @a.shift;
177-
push @arr, ($hk => $hv);
178-
}
179-
return @arr;
180-
}
181-
182130
# vim: expandtab shiftwidth=4 ft=perl6

0 commit comments

Comments
 (0)