Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge branch 'master' of https://github.com/petdance/perl101

Conflicts:
	crank
  • Loading branch information...
commit 0acbfe83995129b667facd6bf51fe09d6201133f 2 parents 87b70b8 + 5075c87
@shlomif shlomif authored
View
7 Makefile
@@ -7,13 +7,12 @@ SOURCE=s
default: crank
-crank: clean
- mkdir -p $(BUILD)/ || true > /dev/null 2>&1
- perl crank --podpath=$(SOURCE) --buildpath=$(BUILD)
+crank:
+ podium clean build
cp -R static/* $(BUILD)/
clean:
- rm -fr $(BUILD)
+ podium clean
test: crank
prove t/html.t
View
40 config.yaml
@@ -0,0 +1,40 @@
+podpath: s
+buildpath: build
+templatepath: tt
+
+pages:
+ - Index
+ - How to get Perl
+ - Terms
+ - Documentation
+ - Strings
+ - Numbers
+ - Arrays
+ - Hashes
+ - Regexes
+ - Flow Control
+ - Files
+ - Subroutines
+ - POD
+ - Debugging
+ - Modules
+ - 'Modules: Making your own'
+ - External programs
+ - CPAN
+ - Constructs
+ - References
+ - Objects
+ - Special Variables
+ - Command-line Switches
+ - Advanced Functions
+ - Style
+ - Performance
+ - Traps
+ - Email
+ - How do I...?
+ - Developer Tools
+ - Websites
+ - Publications
+ - Community
+ - Random
+ - TODO
View
194 crank
@@ -1,194 +0,0 @@
-#!/usr/bin/perl -w
-
-use strict;
-use warnings;
-
-use Carp::Always;
-use Getopt::Long;
-use File::Slurp;
-use Pod::Simple 3.13;
-
-use Template ();
-use Template::Constants qw( :debug :chomp );
-
-my $podpath = 's';
-my $buildpath = 'build';
-
-GetOptions(
- 'podpath:s' => \$podpath,
- 'buildpath:s' => \$buildpath,
-) or exit;
-
-if ( ! -d $buildpath || ! -w $buildpath ) {
- die "Buildpath ($buildpath) doesn't exist or is not writable";
-}
-
-my %defaults = (
-<<<<<<< HEAD
- INCLUDE_PATH => [ qw( tt ) ],
- OUTPUT_PATH => $ENV{'PERL101_OUT_PATH'} || '/srv/p101/',
- DEBUG => DEBUG_UNDEF,
- TRIM => CHOMP_ALL,
- PRE_CHOMP => 1,
- POST_CHOMP => 1,
-=======
- INCLUDE_PATH => [ qw( tt ) ],
- OUTPUT_PATH => $buildpath,
- DEBUG => DEBUG_UNDEF,
- TRIM => CHOMP_ALL,
- PRE_CHOMP => 1,
- POST_CHOMP => 1,
->>>>>>> remotes/petdance/master
-);
-
-my $tt = Template->new( \%defaults );
-my $vars = {};
-
-my @podfiles;
-my @sidelinks;
-
-for ( get_sections( $podpath ) ) {
- my ($sectionfile, $sectiontext) = @{$_};
-
- my $podfile = "$podpath/$sectionfile.pod";
- my $htmlfile = "$sectionfile.html";
- push( @sidelinks, {
- filename => $htmlfile,
- text => $sectiontext,
- } );
- push( @podfiles, {
- section => $sectiontext,
- podfile => $podfile,
- htmlfile => $htmlfile,
- } );
-}
-
-for my $vars ( @podfiles ) {
- $vars->{content} = pod2html( $vars->{podfile} );
- $vars->{sidelinks} = \@sidelinks;
- $tt->process( 'page.ttml', $vars, $vars->{htmlfile} ) || die $tt->error;
-}
-
-sub get_sections {
- my $sourcedir = shift;
-
- opendir my $dh, $sourcedir or die "Can't open $sourcedir";
- my %pod = map { ($_,1) } grep { /\.pod$/ && -f "$sourcedir/$_" } readdir $dh;
-
- my @ordered_sections;
- for my $section ( <DATA> ) {
- chomp $section;
- my $filename = make_filename( $section );
- delete $pod{"$filename.pod"} or die "$filename is in the section list but not in the source";
- push( @ordered_sections, [ $filename, $section ] );
- }
- if ( keys %pod ) {
- die "The following pod files still exist: ", join( ', ', sort keys %pod );
- }
-
- return @ordered_sections;
-}
-
-sub make_filename {
- my $name = lc shift;
-
- $name =~ s/[^-a-z]+/-/g;
- $name =~ s/^-//;
- $name =~ s/-$//;
-
- return $name;
-}
-
-sub pod2html {
- my $podfile = shift;
-
- my $html;
-
- my $parser = Pod::Simple::Perl101->new;
- $parser->html_header_before_title( '' );
- $parser->html_header_after_title( '' );
- $parser->html_footer( '' );
-
- # Manually adjust the stuff we passed thru earlier
- my $podtext = read_file( $podfile );
-
- $podtext =~ s{P<(.+?)>}{L<$1|http://perldoc.perl.org/$1.html>}g;
- $podtext =~ s{M<(.+?)>}{L<$1|http://search.cpan.org/perldoc?$1>}g;
-
- $parser->complain_stderr( 1 );
- $parser->output_string( \$html );
- $parser->parse_string_document( $podtext );
-
-
- return $html;
-}
-
-# Subclassing Pod::Simple::HTML:
-# http://search.cpan.org/~arandal/Pod-Simple-3.05/lib/Pod/Simple/Subclassing.pod
-package Pod::Simple::Perl101;
-
-#use Pod::Simple::Debug(5);
-use base 'Pod::Simple::HTML';
-
-sub VERSION { '0.01' };
-
-sub new {
- my $self = shift->SUPER::new(@_);
-
- my @passthru = qw( P M ); # P = Perldoc, M = Module
- $self->accept_codes( @passthru );
-
- my $tagmap = $self->{Tagmap};
-
- for my $code ( @passthru ) {
- $tagmap->{$code} = "$code<";
- $tagmap->{"/$code"} = ">";
- }
-
- $tagmap->{'VerbatimFormatted'} =
- qq{\n<pre class="prettyprint lang-perl">\n};
-
- return $self;
-}
-
-
-1;
-
-package main;
-
-__DATA__
-Index
-How to get Perl
-Terms
-Documentation
-Strings
-Numbers
-Arrays
-Hashes
-Regexes
-Flow Control
-Files
-Subroutines
-POD
-Debugging
-Modules
-Modules: Making your own
-External programs
-CPAN
-Constructs
-References
-Objects
-Special Variables
-Command-line Switches
-Advanced Functions
-Style
-Performance
-Traps
-Email
-How do I...?
-Developer Tools
-Websites
-Publications
-Community
-Random
-TODO
View
10 s/documentation.pod
@@ -55,7 +55,7 @@ L<http://search.cpan.org>.
=head2 Online documentation
-There are some websites that HTMLify the Perl documentation. Thw
+There are some websites that HTMLify the Perl documentation. The
two biggest ones:
=over
@@ -65,3 +65,11 @@ two biggest ones:
=item * L<http://search.cpan.org/> for modules
=back
+
+=head2 Writing your own documentation
+
+Perl has a strong culture of documenting everything, and you are
+encouraged to get into this habit early on. You'll write your
+documentation using a format called POD, which is discussed <a
+href="pod.html">in its own page</a>.
+
View
2  s/files.pod
@@ -61,7 +61,7 @@ or
my $file_as_string = join '', <FILE>;
Of those two, choose the former. The second one reads all the lines
-into an array, and the glomps together a big string. The first one
+into an array, and then glomps together a big string. The first one
just reads into a string, without creating the intervening list of lines.
The best way yet is like so:
View
1  s/index.pod
@@ -17,6 +17,7 @@ to this site, drop Andy Lester a note at andy [at] perl.org.
=head1 Thanks
Thanks to the following folks for their contributions:
+Rich Bowen,
Drew Stephens,
Usman Jan,
Adam SjE<oslash>gren,
View
6 s/todo.pod
@@ -1,5 +1,11 @@
=head1 Things to do here at perl101.org
+=head2 Handle Perl 6
+
+Ultimately I'd like to have perl101 show both the Perl 6 and Perl
+5 ways of doing things. This way we show new people to Perl 6 how
+to do things, and can also act as a Perl 5-to-Perl 6 phrasebook.
+
=head1 Site functionality
=head2 Include the FAQ
View
21 tt/footer.tt
@@ -1,11 +1,18 @@
<div id="footer">
+ <p>&copy; 2007-2010 Andy Lester</p>
</div>
<script type="text/javascript">
-var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
-document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
+
+ var _gaq = _gaq || [];
+ _gaq.push(['_setAccount', 'UA-631706-2']);
+ _gaq.push(['_trackPageview']);
+
+ (function() {
+ var ga = document.createElement('script');
+ ga.src = ('https:' == document.location.protocol ? 'https://ssl' :
+ 'http://www') + '.google-analytics.com/ga.js';
+ ga.setAttribute('async', 'true');
+ document.documentElement.firstChild.appendChild(ga);
+ })();
+
</script>
-<script type="text/javascript">
-try {
- var pageTracker = _gat._getTracker("UA-631706-2");
- pageTracker._trackPageview();
-} catch(err) {}</script>
View
4 tt/page.ttml
@@ -83,10 +83,6 @@
<!-- Start content -->
[% content %]
[% INCLUDE 'feedback.tt' %]
- <div id="footer">
- <!-- Start Footer -->
- <p>&copy; 2007-2010 Andy Lester</p>
- </div><!-- End Footer -->
</div><!-- End content -->
</div><!-- End main content wrapper -->
</div><!-- End container -->
Please sign in to comment.
Something went wrong with that request. Please try again.