From bbed3d7c3f9fe94ee6e609e703386eab311d94d1 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Fri, 23 Aug 2019 22:51:26 +0000 Subject: clojure-pamphlet (24aug19) git-svn-id: svn://tug.org/texlive/trunk@51944 c570f23f-e606-0410-a88d-b1316a301751 --- .../source/texk/texlive/linked_scripts/Makefile.am | 4 +- .../source/texk/texlive/linked_scripts/Makefile.in | 1 + .../linked_scripts/clojure-pamphlet/pamphletangler | 191 ++++++++++++ .../source/texk/texlive/linked_scripts/scripts.lst | 1 + Master/bin/aarch64-linux/pamphletangler | 1 + Master/bin/amd64-freebsd/pamphletangler | 1 + Master/bin/amd64-netbsd/pamphletangler | 1 + Master/bin/armhf-linux/pamphletangler | 1 + Master/bin/i386-cygwin/pamphletangler | 1 + Master/bin/i386-freebsd/pamphletangler | 1 + Master/bin/i386-linux/pamphletangler | 1 + Master/bin/i386-netbsd/pamphletangler | 1 + Master/bin/i386-solaris/pamphletangler | 1 + Master/bin/win32/pamphletangler.exe | Bin 0 -> 1536 bytes Master/bin/x86_64-cygwin/pamphletangler | 1 + Master/bin/x86_64-darwin/pamphletangler | 1 + Master/bin/x86_64-darwinlegacy/pamphletangler | 1 + Master/bin/x86_64-linux/pamphletangler | 1 + Master/bin/x86_64-linuxmusl/pamphletangler | 1 + Master/bin/x86_64-solaris/pamphletangler | 1 + .../texmf-dist/doc/support/clojure-pamphlet/README | 38 +++ .../clojure-pamphlet/clojure-pamphlet_guide.pdf | Bin 0 -> 189258 bytes .../doc/support/clojure-pamphlet/pamphletangler.1 | 204 +++++++++++++ .../scripts/clojure-pamphlet/pamphletangler | 191 ++++++++++++ .../support/clojure-pamphlet/clojure-pamphlet.dtx | 339 +++++++++++++++++++++ .../support/clojure-pamphlet/clojure-pamphlet.ins | 54 ++++ .../latex/clojure-pamphlet/clojure-pamphlet.sty | 98 ++++++ Master/tlpkg/bin/tlpkg-ctan-check | 2 +- Master/tlpkg/libexec/ctan2tds | 10 +- Master/tlpkg/tlpsrc/clojure-pamphlet.tlpsrc | 3 + Master/tlpkg/tlpsrc/collection-binextra.tlpsrc | 1 + 31 files changed, 1148 insertions(+), 4 deletions(-) create mode 100755 Build/source/texk/texlive/linked_scripts/clojure-pamphlet/pamphletangler create mode 120000 Master/bin/aarch64-linux/pamphletangler create mode 120000 Master/bin/amd64-freebsd/pamphletangler create mode 120000 Master/bin/amd64-netbsd/pamphletangler create mode 120000 Master/bin/armhf-linux/pamphletangler create mode 120000 Master/bin/i386-cygwin/pamphletangler create mode 120000 Master/bin/i386-freebsd/pamphletangler create mode 120000 Master/bin/i386-linux/pamphletangler create mode 120000 Master/bin/i386-netbsd/pamphletangler create mode 120000 Master/bin/i386-solaris/pamphletangler create mode 100755 Master/bin/win32/pamphletangler.exe create mode 120000 Master/bin/x86_64-cygwin/pamphletangler create mode 120000 Master/bin/x86_64-darwin/pamphletangler create mode 120000 Master/bin/x86_64-darwinlegacy/pamphletangler create mode 120000 Master/bin/x86_64-linux/pamphletangler create mode 120000 Master/bin/x86_64-linuxmusl/pamphletangler create mode 120000 Master/bin/x86_64-solaris/pamphletangler create mode 100644 Master/texmf-dist/doc/support/clojure-pamphlet/README create mode 100644 Master/texmf-dist/doc/support/clojure-pamphlet/clojure-pamphlet_guide.pdf create mode 100644 Master/texmf-dist/doc/support/clojure-pamphlet/pamphletangler.1 create mode 100755 Master/texmf-dist/scripts/clojure-pamphlet/pamphletangler create mode 100644 Master/texmf-dist/source/support/clojure-pamphlet/clojure-pamphlet.dtx create mode 100644 Master/texmf-dist/source/support/clojure-pamphlet/clojure-pamphlet.ins create mode 100644 Master/texmf-dist/tex/latex/clojure-pamphlet/clojure-pamphlet.sty create mode 100644 Master/tlpkg/tlpsrc/clojure-pamphlet.tlpsrc diff --git a/Build/source/texk/texlive/linked_scripts/Makefile.am b/Build/source/texk/texlive/linked_scripts/Makefile.am index 0577a8b5753..f4108bd218e 100644 --- a/Build/source/texk/texlive/linked_scripts/Makefile.am +++ b/Build/source/texk/texlive/linked_scripts/Makefile.am @@ -1,6 +1,7 @@ +## $Id$ ## Makefile.am for the TeX Live subdirectory texk/texlive/linked_scripts/ ## -## Copyright 2016-2017 Karl Berry +## Copyright 2016-2019 Karl Berry ## Copyright 2009-2015 Peter Breitenlohner ## You may freely use, modify and/or distribute this file. ## @@ -101,6 +102,7 @@ texmf_other_scripts = \ cachepic/cachepic.tlu \ checkcites/checkcites.lua \ cjk-gs-integrate/cjk-gs-integrate.pl \ + clojure-pamphlet/pamphletangler \ cluttex/cluttex.lua \ context/perl/mptopdf.pl \ convbkmk/convbkmk.rb \ diff --git a/Build/source/texk/texlive/linked_scripts/Makefile.in b/Build/source/texk/texlive/linked_scripts/Makefile.in index 6e8781db9a8..d16957f0a18 100644 --- a/Build/source/texk/texlive/linked_scripts/Makefile.in +++ b/Build/source/texk/texlive/linked_scripts/Makefile.in @@ -315,6 +315,7 @@ texmf_other_scripts = \ cachepic/cachepic.tlu \ checkcites/checkcites.lua \ cjk-gs-integrate/cjk-gs-integrate.pl \ + clojure-pamphlet/pamphletangler \ cluttex/cluttex.lua \ context/perl/mptopdf.pl \ convbkmk/convbkmk.rb \ diff --git a/Build/source/texk/texlive/linked_scripts/clojure-pamphlet/pamphletangler b/Build/source/texk/texlive/linked_scripts/clojure-pamphlet/pamphletangler new file mode 100755 index 00000000000..e0054e8da59 --- /dev/null +++ b/Build/source/texk/texlive/linked_scripts/clojure-pamphlet/pamphletangler @@ -0,0 +1,191 @@ +#!/usr/bin/perl -w + +=head1 NAME + +pamphletangler - Extract code bits from LaTeX pamphlet files. + +=cut + +=head1 SYNOPSIS + +B [OPTION...] I I + +=cut + +=head1 DESCRIPTION + +The clojure pamphlet system is a system based on the clojure literate +system. In the clojure's pamphlet system you have your main LaTeX file, which +can be compiled regularly. This file contains documentation and source code +(just like in other forms of literate programming). This code snippets are +wrapped in the 'chunk' environment, hence they can be recognized by the tangler +in order to extract them. Chunks can be included inside each other by the +'getchunk' command (which will be typesetted acordingly). Finally, you run your +LaTeX file through the tangler and get your desired chunk of code. + +=cut + +=head1 OPTIONS + +=over 29 + +=item -L, --line=linetext + +If set, this text will be inserted after jumps of lines, changing the string +inside "changetext" for the line number. This is used so that error report +refers to pamphlet line number instead of output line number + +=item -C, --change=changetext + +Defaults to "{}" this is the text that will be replaced with the line number if +the linetext option is specified + +=item -?, --help + +Give this help list + +=item --usage + +Give a short usage message + +=item --man + +Print manual page + +=item -V, --version + +Print program version + +=back + +=head1 LICENSE + +Copyright (C) 2019 Ernesto Lanchares Sanchez. + + The clojure-pamphlet tagler is free software; you can redistribute + it and/or modify it under the terms of the GNU Lesser General + Public License as published by the Free Software Foundation; + either version 3 of the License, or (at your option) any later + version. + + The clojure-pamphlet tangler is distributed in the hope that it + will be useful, but WITHOUT ANY WARRANTY; without even the implied + warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this program; if not, see + L. + + +=head1 AUTHOR + +Ernesto Lanchares + +=head1 BUGS + +Report bugs to e.lancha98@gmail.com + +=cut + +use strict; +use warnings; +use Getopt::Long; +use Pod::Usage qw(pod2usage); +use vars qw/$VERSION/; + +BEGIN { $VERSION = '1.2' } + +my $linetext = ""; +my $changetext = "{}"; +my $filename; +my $chunkname; + +OPTS: { + GetOptions( + 'usage' => sub { pod2usage( -verbose => 99, -sections => [ qw(SYNOPSIS) ]); }, + 'help|?' => sub { pod2usage( -verbose => 99, -sections => [ qw(SYNOPSIS DESCRIPTION OPTIONS BUGS) ]); }, + 'man' => sub { pod2usage( -verbose => 2) }, + 'version|V' => sub { print "$VERSION\n"; exit; }, + 'line|L=s' => \$linetext, + 'change|C=s' => \$changetext + ); + + +#pod + while ( my ($option, $value, $pretty) = Getopt::Mixed::nextOption() ) { + $linetext = $value if $option eq 'L'; + if( $option eq 'V' ) { + print "$VERSION\n"; + exit; + } + if ($option eq '?') { + pod2usage( -verbose => 99, -sections => [ qw(SYNOPSIS OPTIONS BUGS) ]); + exit; + } + if ($option eq 'man') { + pod2usage( -verbose => 2 ); + exit; + } + $linetext = $value if $option eq 'L'; + $changetext = $value if $option eq 'C'; + } +#cut + + pod2usage( -message => "[ERROR]: Invalid number of arguments." ) + if scalar(@ARGV) != 2; + $filename = shift; + $chunkname = shift; +} + +open(my $file, "<", $filename) or die "Can't open $filename: $!"; + +my $file_contents = do { local $/; <$file> }; +my %codeblocks; + +while ($file_contents =~ /\\begin\{chunk\}\{([\w.]+)\}[\s\h\t]*\n?(.*?)\n?[\s\t\h]*\\end\{chunk\}/sg) { + $codeblocks{$1} = { source => $2, printing => undef }; +} + +open($file, "<", $filename) or die "Can't open $filename: $!"; +my $index = 1; +while (my $line = <$file>) { + while ($line =~ /\\begin\{chunk\}\{([\w.]+)\}/g) { + $codeblocks{$1}{line} = $index+1; + } + $index++; +} + +sub printchunk { + my ($chunk, $indent) = @_; + + die "Chunk $chunk not found." if (!exists($codeblocks{$chunk})); + + die "Cyclic reference found: $chunk" if $codeblocks{$chunk}{printing}; + $codeblocks{$chunk}{printing} = 1; + + my $localines = 1; + print $linetext =~ s/$changetext/$codeblocks{$chunk}{line}/gr, "\n"; + foreach my $line (split(/\n/, $codeblocks{$chunk}{source})) { + if ($line =~ /([\s\t\h]*)\\getchunk\{([\w.]+)\}/) { + eval { + printchunk($2, $1); #$1 contains indent and $2 contains chunkname + print $linetext =~ s/$changetext/@{[$codeblocks{$chunk}{line} + $localines]}/gr, "\n"; + 1; + } or do { + if (rindex($@, "Cyclic reference found:", 0) == 0) { + $@ =~ /(.+?)( at .*)/s; + die "$1 <- $chunk"; + } + die $@; + } + } else { + print $indent, $line, "\n"; + } + $localines++; + } + + $codeblocks{$chunk}{printing} = undef; + return 0; +} +printchunk($chunkname, ""); diff --git a/Build/source/texk/texlive/linked_scripts/scripts.lst b/Build/source/texk/texlive/linked_scripts/scripts.lst index ab738ceb07b..a5f85bda3b5 100644 --- a/Build/source/texk/texlive/linked_scripts/scripts.lst +++ b/Build/source/texk/texlive/linked_scripts/scripts.lst @@ -45,6 +45,7 @@ bundledoc/bundledoc cachepic/cachepic.tlu checkcites/checkcites.lua cjk-gs-integrate/cjk-gs-integrate.pl +clojure-pamphlet/pamphletangler cluttex/cluttex.lua context/perl/mptopdf.pl convbkmk/convbkmk.rb diff --git a/Master/bin/aarch64-linux/pamphletangler b/Master/bin/aarch64-linux/pamphletangler new file mode 120000 index 00000000000..0720a97b599 --- /dev/null +++ b/Master/bin/aarch64-linux/pamphletangler @@ -0,0 +1 @@ +../../texmf-dist/scripts/clojure-pamphlet/pamphletangler \ No newline at end of file diff --git a/Master/bin/amd64-freebsd/pamphletangler b/Master/bin/amd64-freebsd/pamphletangler new file mode 120000 index 00000000000..0720a97b599 --- /dev/null +++ b/Master/bin/amd64-freebsd/pamphletangler @@ -0,0 +1 @@ +../../texmf-dist/scripts/clojure-pamphlet/pamphletangler \ No newline at end of file diff --git a/Master/bin/amd64-netbsd/pamphletangler b/Master/bin/amd64-netbsd/pamphletangler new file mode 120000 index 00000000000..0720a97b599 --- /dev/null +++ b/Master/bin/amd64-netbsd/pamphletangler @@ -0,0 +1 @@ +../../texmf-dist/scripts/clojure-pamphlet/pamphletangler \ No newline at end of file diff --git a/Master/bin/armhf-linux/pamphletangler b/Master/bin/armhf-linux/pamphletangler new file mode 120000 index 00000000000..0720a97b599 --- /dev/null +++ b/Master/bin/armhf-linux/pamphletangler @@ -0,0 +1 @@ +../../texmf-dist/scripts/clojure-pamphlet/pamphletangler \ No newline at end of file diff --git a/Master/bin/i386-cygwin/pamphletangler b/Master/bin/i386-cygwin/pamphletangler new file mode 120000 index 00000000000..0720a97b599 --- /dev/null +++ b/Master/bin/i386-cygwin/pamphletangler @@ -0,0 +1 @@ +../../texmf-dist/scripts/clojure-pamphlet/pamphletangler \ No newline at end of file diff --git a/Master/bin/i386-freebsd/pamphletangler b/Master/bin/i386-freebsd/pamphletangler new file mode 120000 index 00000000000..0720a97b599 --- /dev/null +++ b/Master/bin/i386-freebsd/pamphletangler @@ -0,0 +1 @@ +../../texmf-dist/scripts/clojure-pamphlet/pamphletangler \ No newline at end of file diff --git a/Master/bin/i386-linux/pamphletangler b/Master/bin/i386-linux/pamphletangler new file mode 120000 index 00000000000..0720a97b599 --- /dev/null +++ b/Master/bin/i386-linux/pamphletangler @@ -0,0 +1 @@ +../../texmf-dist/scripts/clojure-pamphlet/pamphletangler \ No newline at end of file diff --git a/Master/bin/i386-netbsd/pamphletangler b/Master/bin/i386-netbsd/pamphletangler new file mode 120000 index 00000000000..0720a97b599 --- /dev/null +++ b/Master/bin/i386-netbsd/pamphletangler @@ -0,0 +1 @@ +../../texmf-dist/scripts/clojure-pamphlet/pamphletangler \ No newline at end of file diff --git a/Master/bin/i386-solaris/pamphletangler b/Master/bin/i386-solaris/pamphletangler new file mode 120000 index 00000000000..0720a97b599 --- /dev/null +++ b/Master/bin/i386-solaris/pamphletangler @@ -0,0 +1 @@ +../../texmf-dist/scripts/clojure-pamphlet/pamphletangler \ No newline at end of file diff --git a/Master/bin/win32/pamphletangler.exe b/Master/bin/win32/pamphletangler.exe new file mode 100755 index 00000000000..5777d90a17a Binary files /dev/null and b/Master/bin/win32/pamphletangler.exe differ diff --git a/Master/bin/x86_64-cygwin/pamphletangler b/Master/bin/x86_64-cygwin/pamphletangler new file mode 120000 index 00000000000..0720a97b599 --- /dev/null +++ b/Master/bin/x86_64-cygwin/pamphletangler @@ -0,0 +1 @@ +../../texmf-dist/scripts/clojure-pamphlet/pamphletangler \ No newline at end of file diff --git a/Master/bin/x86_64-darwin/pamphletangler b/Master/bin/x86_64-darwin/pamphletangler new file mode 120000 index 00000000000..0720a97b599 --- /dev/null +++ b/Master/bin/x86_64-darwin/pamphletangler @@ -0,0 +1 @@ +../../texmf-dist/scripts/clojure-pamphlet/pamphletangler \ No newline at end of file diff --git a/Master/bin/x86_64-darwinlegacy/pamphletangler b/Master/bin/x86_64-darwinlegacy/pamphletangler new file mode 120000 index 00000000000..0720a97b599 --- /dev/null +++ b/Master/bin/x86_64-darwinlegacy/pamphletangler @@ -0,0 +1 @@ +../../texmf-dist/scripts/clojure-pamphlet/pamphletangler \ No newline at end of file diff --git a/Master/bin/x86_64-linux/pamphletangler b/Master/bin/x86_64-linux/pamphletangler new file mode 120000 index 00000000000..0720a97b599 --- /dev/null +++ b/Master/bin/x86_64-linux/pamphletangler @@ -0,0 +1 @@ +../../texmf-dist/scripts/clojure-pamphlet/pamphletangler \ No newline at end of file diff --git a/Master/bin/x86_64-linuxmusl/pamphletangler b/Master/bin/x86_64-linuxmusl/pamphletangler new file mode 120000 index 00000000000..0720a97b599 --- /dev/null +++ b/Master/bin/x86_64-linuxmusl/pamphletangler @@ -0,0 +1 @@ +../../texmf-dist/scripts/clojure-pamphlet/pamphletangler \ No newline at end of file diff --git a/Master/bin/x86_64-solaris/pamphletangler b/Master/bin/x86_64-solaris/pamphletangler new file mode 120000 index 00000000000..0720a97b599 --- /dev/null +++ b/Master/bin/x86_64-solaris/pamphletangler @@ -0,0 +1 @@ +../../texmf-dist/scripts/clojure-pamphlet/pamphletangler \ No newline at end of file diff --git a/Master/texmf-dist/doc/support/clojure-pamphlet/README b/Master/texmf-dist/doc/support/clojure-pamphlet/README new file mode 100644 index 00000000000..00b7603d769 --- /dev/null +++ b/Master/texmf-dist/doc/support/clojure-pamphlet/README @@ -0,0 +1,38 @@ +CLOJURE PAMPHLET SYSTEM +=========== + +The clojure pamphlet system is a system based on the clojure literate +system. In the clojure's pamphlet system you have your main LaTeX +file, which can be compiled regularly. This file contains +documentation and source code (just like in other forms of literate +programming). This code snippets are wrapped in the 'chunk' +environment, hence they can be recognized by the tangler in order to +extract them. Chunks can be included inside each other by the +'getchunk' command (which will be typesetted acordingly). Finally, you +run your LaTeX file through the tangler and get your desired chunk of +code. + +See the INSTALL file for detailed information about how to configure +and install the tangler. + This tangler is a program that takes a pamphlet latex file (A simple +latex file with special commands in it, see the latex clojure-pamphlet +package manual page) and a code section and outputs the specified code +section adding the chunks that are needed (and can be in any other +part of the document). + +----- + +Copyright (C) 2019, Ernesto Lanchares Sanchez. + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 3, or (at your option) +any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . diff --git a/Master/texmf-dist/doc/support/clojure-pamphlet/clojure-pamphlet_guide.pdf b/Master/texmf-dist/doc/support/clojure-pamphlet/clojure-pamphlet_guide.pdf new file mode 100644 index 00000000000..6ffa96f3aaf Binary files /dev/null and b/Master/texmf-dist/doc/support/clojure-pamphlet/clojure-pamphlet_guide.pdf differ diff --git a/Master/texmf-dist/doc/support/clojure-pamphlet/pamphletangler.1 b/Master/texmf-dist/doc/support/clojure-pamphlet/pamphletangler.1 new file mode 100644 index 00000000000..0c33bdba080 --- /dev/null +++ b/Master/texmf-dist/doc/support/clojure-pamphlet/pamphletangler.1 @@ -0,0 +1,204 @@ +.\" Automatically generated by Pod::Man 4.11 (Pod::Simple 3.35) +.\" +.\" Standard preamble: +.\" ======================================================================== +.de Sp \" Vertical space (when we can't use .PP) +.if t .sp .5v +.if n .sp +.. +.de Vb \" Begin verbatim text +.ft CW +.nf +.ne \\$1 +.. +.de Ve \" End verbatim text +.ft R +.fi +.. +.\" Set up some character translations and predefined strings. \*(-- will +.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left +.\" double quote, and \*(R" will give a right double quote. \*(C+ will +.\" give a nicer C++. Capital omega is used to do unbreakable dashes and +.\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, +.\" nothing in troff, for use with C<>. +.tr \(*W- +.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' +.ie n \{\ +. ds -- \(*W- +. ds PI pi +. if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch +. if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch +. ds L" "" +. ds R" "" +. ds C` "" +. ds C' "" +'br\} +.el\{\ +. ds -- \|\(em\| +. ds PI \(*p +. ds L" `` +. ds R" '' +. ds C` +. ds C' +'br\} +.\" +.\" Escape single quotes in literal strings from groff's Unicode transform. +.ie \n(.g .ds Aq \(aq +.el .ds Aq ' +.\" +.\" If the F register is >0, we'll generate index entries on stderr for +.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index +.\" entries marked with X<> in POD. Of course, you'll have to process the +.\" output yourself in some meaningful fashion. +.\" +.\" Avoid warning from groff about undefined register 'F'. +.de IX +.. +.nr rF 0 +.if \n(.g .if rF .nr rF 1 +.if (\n(rF:(\n(.g==0)) \{\ +. if \nF \{\ +. de IX +. tm Index:\\$1\t\\n%\t"\\$2" +.. +. if !\nF==2 \{\ +. nr % 0 +. nr F 2 +. \} +. \} +.\} +.rr rF +.\" +.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). +.\" Fear. Run. Save yourself. No user-serviceable parts. +. \" fudge factors for nroff and troff +.if n \{\ +. ds #H 0 +. ds #V .8m +. ds #F .3m +. ds #[ \f1 +. ds #] \fP +.\} +.if t \{\ +. ds #H ((1u-(\\\\n(.fu%2u))*.13m) +. ds #V .6m +. ds #F 0 +. ds #[ \& +. ds #] \& +.\} +. \" simple accents for nroff and troff +.if n \{\ +. ds ' \& +. ds ` \& +. ds ^ \& +. ds , \& +. ds ~ ~ +. ds / +.\} +.if t \{\ +. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" +. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' +. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' +. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' +. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' +. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' +.\} +. \" troff and (daisy-wheel) nroff accents +.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' +.ds 8 \h'\*(#H'\(*b\h'-\*(#H' +.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] +.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' +.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' +.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] +.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] +.ds ae a\h'-(\w'a'u*4/10)'e +.ds Ae A\h'-(\w'A'u*4/10)'E +. \" corrections for vroff +.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' +.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' +. \" for low resolution devices (crt and lpr) +.if \n(.H>23 .if \n(.V>19 \ +\{\ +. ds : e +. ds 8 ss +. ds o a +. ds d- d\h'-1'\(ga +. ds D- D\h'-1'\(hy +. ds th \o'bp' +. ds Th \o'LP' +. ds ae ae +. ds Ae AE +.\} +.rm #[ #] #H #V #F C +.\" ======================================================================== +.\" +.IX Title "PAMPHLETANGLER 1" +.TH PAMPHLETANGLER 1 "2019-08-23" "clojure-pamphlet" "Ernesto Lanchares" +.\" For nroff, turn off justification. Always turn off hyphenation; it makes +.\" way too many mistakes in technical documents. +.if n .ad l +.nh +.SH "NAME" +pamphletangler \- Extract code bits from LaTeX pamphlet files. +.SH "SYNOPSIS" +.IX Header "SYNOPSIS" +\&\fBpamphletangler\fR [\s-1OPTION...\s0] \fI\s-1FILE\s0\fR \fI\s-1CHUNKNAME\s0\fR +.SH "DESCRIPTION" +.IX Header "DESCRIPTION" +The clojure pamphlet system is a system based on the clojure literate +system. In the clojure's pamphlet system you have your main LaTeX file, which +can be compiled regularly. This file contains documentation and source code +(just like in other forms of literate programming). This code snippets are +wrapped in the 'chunk' environment, hence they can be recognized by the tangler +in order to extract them. Chunks can be included inside each other by the +\&'getchunk' command (which will be typesetted acordingly). Finally, you run your +LaTeX file through the tangler and get your desired chunk of code. +.SH "OPTIONS" +.IX Header "OPTIONS" +.IP "\-L, \-\-line=linetext" 29 +.IX Item "-L, --line=linetext" +If set, this text will be inserted after jumps of lines, changing the string +inside \*(L"changetext\*(R" for the line number. This is used so that error report +refers to pamphlet line number instead of output line number +.IP "\-C, \-\-change=changetext" 29 +.IX Item "-C, --change=changetext" +Defaults to \*(L"{}\*(R" this is the text that will be replaced with the line number if +the linetext option is specified +.IP "\-?, \-\-help" 29 +.IX Item "-?, --help" +Give this help list +.IP "\-\-usage" 29 +.IX Item "--usage" +Give a short usage message +.IP "\-\-man" 29 +.IX Item "--man" +Print manual page +.IP "\-V, \-\-version" 29 +.IX Item "-V, --version" +Print program version +.SH "LICENSE" +.IX Header "LICENSE" +Copyright (C) 2019 Ernesto Lanchares Sanchez. +.PP +.Vb 5 +\& The clojure\-pamphlet tagler is free software; you can redistribute +\& it and/or modify it under the terms of the GNU Lesser General +\& Public License as published by the Free Software Foundation; +\& either version 3 of the License, or (at your option) any later +\& version. +\& +\& The clojure\-pamphlet tangler is distributed in the hope that it +\& will be useful, but WITHOUT ANY WARRANTY; without even the implied +\& warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +\& See the GNU Lesser General Public License for more details. +\& +\& You should have received a copy of the GNU Lesser General Public +\& License along with this program; if not, see +\& L. +.Ve +.SH "AUTHOR" +.IX Header "AUTHOR" +Ernesto Lanchares +.SH "BUGS" +.IX Header "BUGS" +Report bugs to e.lancha98@gmail.com diff --git a/Master/texmf-dist/scripts/clojure-pamphlet/pamphletangler b/Master/texmf-dist/scripts/clojure-pamphlet/pamphletangler new file mode 100755 index 00000000000..e0054e8da59 --- /dev/null +++ b/Master/texmf-dist/scripts/clojure-pamphlet/pamphletangler @@ -0,0 +1,191 @@ +#!/usr/bin/perl -w + +=head1 NAME + +pamphletangler - Extract code bits from LaTeX pamphlet files. + +=cut + +=head1 SYNOPSIS + +B [OPTION...] I I + +=cut + +=head1 DESCRIPTION + +The clojure pamphlet system is a system based on the clojure literate +system. In the clojure's pamphlet system you have your main LaTeX file, which +can be compiled regularly. This file contains documentation and source code +(just like in other forms of literate programming). This code snippets are +wrapped in the 'chunk' environment, hence they can be recognized by the tangler +in order to extract them. Chunks can be included inside each other by the +'getchunk' command (which will be typesetted acordingly). Finally, you run your +LaTeX file through the tangler and get your desired chunk of code. + +=cut + +=head1 OPTIONS + +=over 29 + +=item -L, --line=linetext + +If set, this text will be inserted after jumps of lines, changing the string +inside "changetext" for the line number. This is used so that error report +refers to pamphlet line number instead of output line number + +=item -C, --change=changetext + +Defaults to "{}" this is the text that will be replaced with the line number if +the linetext option is specified + +=item -?, --help + +Give this help list + +=item --usage + +Give a short usage message + +=item --man + +Print manual page + +=item -V, --version + +Print program version + +=back + +=head1 LICENSE + +Copyright (C) 2019 Ernesto Lanchares Sanchez. + + The clojure-pamphlet tagler is free software; you can redistribute + it and/or modify it under the terms of the GNU Lesser General + Public License as published by the Free Software Foundation; + either version 3 of the License, or (at your option) any later + version. + + The clojure-pamphlet tangler is distributed in the hope that it + will be useful, but WITHOUT ANY WARRANTY; without even the implied + warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this program; if not, see + L. + + +=head1 AUTHOR + +Ernesto Lanchares + +=head1 BUGS + +Report bugs to e.lancha98@gmail.com + +=cut + +use strict; +use warnings; +use Getopt::Long; +use Pod::Usage qw(pod2usage); +use vars qw/$VERSION/; + +BEGIN { $VERSION = '1.2' } + +my $linetext = ""; +my $changetext = "{}"; +my $filename; +my $chunkname; + +OPTS: { + GetOptions( + 'usage' => sub { pod2usage( -verbose => 99, -sections => [ qw(SYNOPSIS) ]); }, + 'help|?' => sub { pod2usage( -verbose => 99, -sections => [ qw(SYNOPSIS DESCRIPTION OPTIONS BUGS) ]); }, + 'man' => sub { pod2usage( -verbose => 2) }, + 'version|V' => sub { print "$VERSION\n"; exit; }, + 'line|L=s' => \$linetext, + 'change|C=s' => \$changetext + ); + + +#pod + while ( my ($option, $value, $pretty) = Getopt::Mixed::nextOption() ) { + $linetext = $value if $option eq 'L'; + if( $option eq 'V' ) { + print "$VERSION\n"; + exit; + } + if ($option eq '?') { + pod2usage( -verbose => 99, -sections => [ qw(SYNOPSIS OPTIONS BUGS) ]); + exit; + } + if ($option eq 'man') { + pod2usage( -verbose => 2 ); + exit; + } + $linetext = $value if $option eq 'L'; + $changetext = $value if $option eq 'C'; + } +#cut + + pod2usage( -message => "[ERROR]: Invalid number of arguments." ) + if scalar(@ARGV) != 2; + $filename = shift; + $chunkname = shift; +} + +open(my $file, "<", $filename) or die "Can't open $filename: $!"; + +my $file_contents = do { local $/; <$file> }; +my %codeblocks; + +while ($file_contents =~ /\\begin\{chunk\}\{([\w.]+)\}[\s\h\t]*\n?(.*?)\n?[\s\t\h]*\\end\{chunk\}/sg) { + $codeblocks{$1} = { source => $2, printing => undef }; +} + +open($file, "<", $filename) or die "Can't open $filename: $!"; +my $index = 1; +while (my $line = <$file>) { + while ($line =~ /\\begin\{chunk\}\{([\w.]+)\}/g) { + $codeblocks{$1}{line} = $index+1; + } + $index++; +} + +sub printchunk { + my ($chunk, $indent) = @_; + + die "Chunk $chunk not found." if (!exists($codeblocks{$chunk})); + + die "Cyclic reference found: $chunk" if $codeblocks{$chunk}{printing}; + $codeblocks{$chunk}{printing} = 1; + + my $localines = 1; + print $linetext =~ s/$changetext/$codeblocks{$chunk}{line}/gr, "\n"; + foreach my $line (split(/\n/, $codeblocks{$chunk}{source})) { + if ($line =~ /([\s\t\h]*)\\getchunk\{([\w.]+)\}/) { + eval { + printchunk($2, $1); #$1 contains indent and $2 contains chunkname + print $linetext =~ s/$changetext/@{[$codeblocks{$chunk}{line} + $localines]}/gr, "\n"; + 1; + } or do { + if (rindex($@, "Cyclic reference found:", 0) == 0) { + $@ =~ /(.+?)( at .*)/s; + die "$1 <- $chunk"; + } + die $@; + } + } else { + print $indent, $line, "\n"; + } + $localines++; + } + + $codeblocks{$chunk}{printing} = undef; + return 0; +} +printchunk($chunkname, ""); diff --git a/Master/texmf-dist/source/support/clojure-pamphlet/clojure-pamphlet.dtx b/Master/texmf-dist/source/support/clojure-pamphlet/clojure-pamphlet.dtx new file mode 100644 index 00000000000..e0cb5b2f022 --- /dev/null +++ b/Master/texmf-dist/source/support/clojure-pamphlet/clojure-pamphlet.dtx @@ -0,0 +1,339 @@ +% \iffalse meta-comment +% +% Copyright (C) 2019 by Lanchares Sanchez, Ernesto +% +% This file may be distributed and/or modified under the +% conditions of the GNU General Public License as published by +% the Free Software Foundation; either version 3, or (at your option) +% any later version. +% +% This program is distributed in the hope that it will be useful, +% but WITHOUT ANY WARRANTY; without even the implied warranty of +% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +% GNU General Public License for more details. +% +% You should have received a copy of the GNU General Public License +% along with this program. If not, see . +% +% \fi +% +% \iffalse +%\NeedsTeXFormat{LaTeX2e}[2005/12/01] +%\ProvidesPackage{clojure-pamphlet}[2019/07/08 v1.o .dtx clojure pamphlet file] +% +%<*driver> +\documentclass{ltxdoc} +\usepackage{clojure-pamphlet} +\usepackage{hyperref} +\usepackage{csquotes} +\EnableCrossrefs +\CodelineIndex +\RecordChanges +\begin{document} + \DocInput{clojure-pamphlet.dtx} +\end{document} +% +% \fi +% +% \CheckSum{175} +% +% \CharacterTable +% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z +% Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z +% Digits \0\1\2\3\4\5\6\7\8\9 +% Exclamation \! Double quote \" Hash (number) \# +% Dollar \$ Percent \% Ampersand \& +% Acute accent \' Left paren \( Right paren \) +% Asterisk \* Plus \+ Comma \, +% Minus \- Point \. Solidus \/ +% Colon \: Semicolon \; Less than \< +% Equals \= Greater than \> Question mark \? +% Commercial at \@ Left bracket \[ Backslash \\ +% Right bracket \] Circumflex \^ Underscore \_ +% Grave accent \` Left brace \{ Vertical bar \| +% Right brace \} Tilde \~} +% +% \changes{v1.0}{2019/07/14}{Initial version} +% +% \GetFileInfo{clojure-pamphlet.sty} +% +% \DoNotIndex{\bgroup,\egoup,\ ,\advance,\begin,\bf,\big,\closeout,\csname} +% \DoNotIndex{\def,\do,\edef,\else,\end,\endcsname,\endinput,\expandafter} +% \DoNotIndex{\fi,\global,\hbox,\hskip,\hyperlink,\hypertarget,\if,\ifcsname} +% \DoNotIndex{\ifdefined,\iffalse,\iftrue,\immediate,\it,\jobname,\label,\let} +% \DoNotIndex{\lstnewenvironment,\lstset,\nameref,\newcommand,\newenvironment} +% \DoNotIndex{\newline,\newwrite,\next,\noindent,\openout,\relax,\string,\the} +% \DoNotIndex{\unexpanded,\write,\xdef,\\,\{,\},\@for,\@input,\@empty} +% \DoNotIndex{\@currentlabelname} +% +% \title{The \textsf{clojure-pamphlet} package\thanks{This document +% corresponds to \textsf{clojure-pamphlet}~\fileversion, +% dated~\filedate.}} +% \author{Ernesto Lanchares Sanchez\\ \texttt{e.lancha98@gmail.com}} +% +% \maketitle +% +% \begin{abstract} +% A package to make beautiful literate programming documents. The system is +% based on clojure's pamphelt files. +% \end{abstract} +% +% \section{Introduction} +% +% \href{http://www.literateprogramming.com/}{Literate Programming} is a +% programming paradigm that changes the goal of the program: +% \begin{displayquote} +% Let us change our traditional attitude to the construction of programs: +% Instead of imagining that our main task is to instruct a computer what to do, +% let us concentrate rather on explaining to human beings what we want a +% computer to do. +% \end{displayquote} +% +% Since it's creation, many systems have been created to accomplish this goal, +% systems like \texttt{WEB}, \texttt{CWEB}, \texttt{noweb}, \ldots This systems +% all share the same structure: There is one source file and two programs +% needed, one that extracts the code to be compiled and other that extracts the +% literature (usually a \TeX/\LaTeX file) to be compiled. +% +% This is the reason that we preffer clojure's system where there is one \LaTeX +% source file that can be compiled and one program to extract the code to be +% compiled. Although the clojure system is fine as it is, we think the resulting +% documentation can be a bit prettier hence this package. The difference in +% using this package or the clojure system as a developer is non-existent, +% however we think the documentation with our system is a bit more readable. It +% also automaticly adds hyperlinks to the output in order to make it easier to +% navigate when viewing in a computer. +% +% \section{Usage} +% +% The \texttt{clojure-pamphlet} system is designed to be as simple as possible, +% so this package only provides one environment and one command. The system is +% based arround code chunks. This chunks are the part of the documents that +% contain code and can be extracted. The chunks also contain a name so that they +% can be referenced in the document and in other chunk blocks. The name is also +% needed for the tangler to extract the chunk. +% +% \subsection{\texttt{chunk} environment} +% \DescribeEnv{chunk} +% The chunk environment is used to define code blocks. This code blocks have a +% name and are what the tangler will actually output. It is based on the +% \href{https://www.ctan.org/pkg/listings}{listings} package, so all style +% formats that yo can apply to \texttt{lstlisting} environments, you can also +% apply to chunk environments by simply using the command \texttt{lstset}. +% +% Here's an example of a code usage and it's output +% \begin{verbatim} +% \begin{chunk}{main} +% int main(int argc, char* argv[]) { +% printf("Hello World.\n"); +% } +% \end{chunk} +% \end{verbatim} +% +% \iffalse +%<*test> +% \fi +\begin{chunk}{main} + int main(int argc, char* argv[]) { + printf("Hello World.\n"); + } +\end{chunk} +% \iffalse +% +% \fi +% +% \DescribeMacro{\getchunk} +% Also, inside the \texttt{chunk} environment, you can use the \verb|\getchunk| +% command, which includes the referenced chunk at that exact same spot. The \verb|\getchunk| +% command requires to be in it's own separate line. Let's +% illustrate this with an example: +% +% \begin{verbatim} +% \begin{chunk}{onechunk} +% CHUNK ONE +% \end{chunk} +% \begin{chunk}{otherchunk} +% PREVIOUS +% \getchunk{onechunk} +% POST +% \end{chunk} +% \end{verbatim} +% +% \iffalse +%<*test> +% \fi +\begin{chunk}{print} +printf("Hello World"); +\end{chunk} +\begin{chunk}{main} +int main(int argc, char* argv[]) { + \getchunk{print} +} +\end{chunk} +% \iffalse +% +% \fi +% +% \subsection{The tangler} +% The tangler is designed to be as simple to use as possible. You just need +% to provide it with a \LaTeX \texttt{clojure-pamphlet} file and a code chunk to +% extract. Then the tangler will output the code to be compiled in the standard +% output. For example in order to extract the main chunk of code we will need to +% run +% \begin{verbatim} +% pamphletangler [filename.tex] main +% \end{verbatim} +% +% And the output will be +% \begin{verbatim} +% int main(int argc, char* argv[]) { +% printf("Hello World"); +% } +% \end{verbatim} +% +% \StopEventually{\PrintIndex} +% +% \section{Implementation} +% +% We need to import the listings package to create the code blocks +% and the hyperref package to create the clickable links +% \begin{macrocode} +\RequirePackage{listings} +\RequirePackage{hyperref} +% \end{macrocode} +% +% We need to import the referecences, a.k.a. the ``used by'' text +% below the code +% \begin{macrocode} +\@input{\jobname.pam} +% \end{macrocode} +% +% We initialize a counter, needed to define a unique csname in each +% \verb|getchunk| call. +% \begin{macrocode} +\newcount\pam@references +% \end{macrocode} +% +% We define commands to write and compare the \{ and \} characters +% Solution from \url{https://tex.stackexchange.com/a/47453} +% \begin{macrocode} +\edef\wbgroup{\iftrue\string{\else}\fi} +\edef\wegroup{\iffalse{\else\string}\fi} +% \end{macrocode} +% \begin{macro}{\pam@storetext} +% This macro is used inside getchunkenv. This will consume tokens +% and store them inside \verb|pam@tex| macro until it reads a ``\}'' macro +% (defined by lst), then it calls the \verb|\getchunk| command on the stored +% text. Finally, calls the ``\}'' macro needed by lst to finish processing the +% code block. +% \begin{macrocode} +\def\pam@storetext#1{% + \expandafter\if\string#1\wegroup% + \getchunk{\pam@text}% + #1% + \else% + \edef\pam@text{\pam@text#1}% + \expandafter\pam@storetext% This expandafter is so the input of + % \pam@storetext is not \fi + \fi% +} +% \end{macrocode} +% \end{macro} +% \begin{environment}{pam@getchunkenv} +% This environment is not ment to be used outside this document and it's only +% purpose it's to wrap the \verb|pam@storetext| macro inside an environment. +% \begin{macrocode} +\newenvironment{pam@getchunkenv}{\def\pam@text{}% +\expandafter\pam@storetext}{} +% \end{macrocode} +% \end{environment} +% +% \begin{environment}{chunk} +% Here is the main environment. +% \begin{macrocode} +\lstnewenvironment{chunk}[1]{% + \hypertarget{#1}% + {\ }\newline\noindent% + \hbox{\hskip 2.0cm}{\bf --- #1 ---}% + \edef\@currentlabelname{#1}% + \lstset{alsodigit={.-},alsoletter={\\}}% + \lstset{escapebegin=\begin{pam@getchunkenv}}% + \lstset{escapeend=\end{pam@getchunkenv}}% + \lstset{escapeinside={\\getchunk\{}{\}}}% +}{ + {\ }\newline\noindent% + \hbox{\hskip 2.0cm}% + {\it ---\csname referenced#1\endcsname---}% +} +% \end{macrocode} +% \end{environment} +% \begin{macro}{\getchunk} +% We run into the most complicated command. First, we preparate the label so it +% can be referenced and place the text. +% \begin{macrocode} +\newcommand{\getchunk}[1]{% + {\big<}\hyperlink{#1}{#1}{\big>}% + \edef\pam@label{reference-\the\pam@references}% + \label{\pam@label}% + \ifcsname used#1\endcsname\else% + \expandafter\def\csname used#1\endcsname{Used by}% + \fi% +% \end{macrocode} +% Here we expand the Used by command two times, this is so we fully expand +% the \verb|\csname| and the command but we don't expand the refs +% \begin{macrocode} + \edef\pam@tmp{\unexpanded\expandafter\expandafter% + \expandafter{\csname used#1\endcsname}}% +% \end{macrocode} +% We add to the used by command, adding a space and the new reference. Also, we +% increase the global counter and mark the chunk as referenced. +% \begin{macrocode} +\expandafter\xdef\csname used#1\expandafter\endcsname\expandafter{% + \expandafter\unexpanded\expandafter{\pam@tmp},% + \ \unexpanded\expandafter{\expandafter\nameref\expandafter{\pam@label}}% +}% +\global\advance\pam@references 1\relax% +\ifdefined\pam@chunks% + \xdef\pam@chunks{\pam@chunks,#1}% +\else% + \xdef\pam@chunks{#1}% +\fi% +} +% \end{macrocode} +% \end{macro} +% Here we will write the used by commands and references. This will only be +% done if there are chunks referenced. +% \begin{macrocode} +\AtEndDocument{% + \ifdefined\pam@chunks% + \newwrite\@pamfile% + \immediate\openout\@pamfile=\jobname.pam% +% \end{macrocode} +% Then, we loop through the list and write out the used by commands +% but the list may contain duplicates so we need to account for it. +% loop based on \url{https://tex.stackexchange.com/a/16695} +% \begin{macrocode} +\@for\next:=\pam@chunks\do{% + \ifcsname lstel@\next\endcsname% + \else% + \expandafter\let\csname lstel@\next\endcsname\@empty% + \immediate\write\@pamfile{% + \unexpanded{\expandafter\def\csname }% + referenced\next\unexpanded{\endcsname}% + \wbgroup% + \unexpanded\expandafter\expandafter\expandafter% + {\csname used\next\endcsname}% + \wegroup% + }% + \fi% +}% +% \end{macrocode} +% Finally, we close the auxiliary file +% \begin{macrocode} + \immediate\closeout\@pamfile% + \fi% +} +\endinput +% \end{macrocode} +% \Finale +\endinput diff --git a/Master/texmf-dist/source/support/clojure-pamphlet/clojure-pamphlet.ins b/Master/texmf-dist/source/support/clojure-pamphlet/clojure-pamphlet.ins new file mode 100644 index 00000000000..97cb9794848 --- /dev/null +++ b/Master/texmf-dist/source/support/clojure-pamphlet/clojure-pamphlet.ins @@ -0,0 +1,54 @@ +%% +%% Copyright (C) 2019 by Lanchares Sanchez, Ernesto +%% +%% This file may be distributed and/or modified under the +%% conditions of the GNU General Public License as published by +%% the Free Software Foundation; either version 3, or (at your option) +%% any later version. +%% +%% This program is distributed in the hope that it will be useful, +%% but WITHOUT ANY WARRANTY; without even the implied warranty of +%% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +%% GNU General Public License for more details. +%% +%% You should have received a copy of the GNU General Public License +%% along with this program. If not, see . + +\input docstrip.tex +\keepsilent +\usedir{/tex/latex/pam} + +\preamble +This is a generated file. + +Copyright (C) 2019 by Lanchares Sanchez, Ernesto + +This file may be distributed and/or modified under the +conditions of the LaTeX Project Public License, either +version 1.3 of this license or (at your option) any later +version. The latest version of this license is in: + + http://www.latex-project.org/lppl.txt + +and version 1.3 or later is part of all distributions of +LaTeX version 2005/12/01 or later. +\endpreamble + +\generate{\file{clojure-pamphlet.sty}{\from{clojure-pamphlet.dtx}{package}}} + +\obeyspaces +\Msg{****************************************************} +\Msg{* *} +\Msg{* To finish the installation you have to move the *} +\Msg{* following file into a directory searched by TeX: *} +\Msg{* *} +\Msg{* clojure-pamphlet.sty *} +\Msg{* *} +\Msg{* To produce the documentation run the file *} +\Msg{* clojure-pamphelt.dtx through LaTeX. *} +\Msg{* *} +\Msg{* Happy TeXing! *} +\Msg{* *} +\Msg{****************************************************} + +\endbatchfile diff --git a/Master/texmf-dist/tex/latex/clojure-pamphlet/clojure-pamphlet.sty b/Master/texmf-dist/tex/latex/clojure-pamphlet/clojure-pamphlet.sty new file mode 100644 index 00000000000..9355c50b9f0 --- /dev/null +++ b/Master/texmf-dist/tex/latex/clojure-pamphlet/clojure-pamphlet.sty @@ -0,0 +1,98 @@ +%% +%% This is file `clojure-pamphlet.sty', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% clojure-pamphlet.dtx (with options: `package') +%% This is a generated file. +%% +%% Copyright (C) 2019 by Lanchares Sanchez, Ernesto +%% +%% This file may be distributed and/or modified under the +%% conditions of the LaTeX Project Public License, either +%% version 1.3 of this license or (at your option) any later +%% version. The latest version of this license is in: +%% +%% http://www.latex-project.org/lppl.txt +%% +%% and version 1.3 or later is part of all distributions of +%% LaTeX version 2005/12/01 or later. +\NeedsTeXFormat{LaTeX2e}[2005/12/01] +\ProvidesPackage{clojure-pamphlet}[2019/07/08 v1.o .dtx clojure pamphlet file] +\RequirePackage{listings} +\RequirePackage{hyperref} +\@input{\jobname.pam} +\newcount\pam@references +\edef\wbgroup{\iftrue\string{\else}\fi} +\edef\wegroup{\iffalse{\else\string}\fi} +\def\pam@storetext#1{% + \expandafter\if\string#1\wegroup% + \getchunk{\pam@text}% + #1% + \else% + \edef\pam@text{\pam@text#1}% + \expandafter\pam@storetext% This expandafter is so the input of + % \pam@storetext is not \fi + \fi% +} +\newenvironment{pam@getchunkenv}{\def\pam@text{}% +\expandafter\pam@storetext}{} +\lstnewenvironment{chunk}[1]{% + \hypertarget{#1}% + {\ }\newline\noindent% + \hbox{\hskip 2.0cm}{\bf --- #1 ---}% + \edef\@currentlabelname{#1}% + \lstset{alsodigit={.-},alsoletter={\\}}% + \lstset{escapebegin=\begin{pam@getchunkenv}}% + \lstset{escapeend=\end{pam@getchunkenv}}% + \lstset{escapeinside={\\getchunk\{}{\}}}% +}{ + {\ }\newline\noindent% + \hbox{\hskip 2.0cm}% + {\it ---\csname referenced#1\endcsname---}% +} +\newcommand{\getchunk}[1]{% + {\big<}\hyperlink{#1}{#1}{\big>}% + \edef\pam@label{reference-\the\pam@references}% + \label{\pam@label}% + \ifcsname used#1\endcsname\else% + \expandafter\def\csname used#1\endcsname{Used by}% + \fi% + \edef\pam@tmp{\unexpanded\expandafter\expandafter% + \expandafter{\csname used#1\endcsname}}% +\expandafter\xdef\csname used#1\expandafter\endcsname\expandafter{% + \expandafter\unexpanded\expandafter{\pam@tmp},% + \ \unexpanded\expandafter{\expandafter\nameref\expandafter{\pam@label}}% +}% +\global\advance\pam@references 1\relax% +\ifdefined\pam@chunks% + \xdef\pam@chunks{\pam@chunks,#1}% +\else% + \xdef\pam@chunks{#1}% +\fi% +} +\AtEndDocument{% + \ifdefined\pam@chunks% + \newwrite\@pamfile% + \immediate\openout\@pamfile=\jobname.pam% +\@for\next:=\pam@chunks\do{% + \ifcsname lstel@\next\endcsname% + \else% + \expandafter\let\csname lstel@\next\endcsname\@empty% + \immediate\write\@pamfile{% + \unexpanded{\expandafter\def\csname }% + referenced\next\unexpanded{\endcsname}% + \wbgroup% + \unexpanded\expandafter\expandafter\expandafter% + {\csname used\next\endcsname}% + \wegroup% + }% + \fi% +}% + \immediate\closeout\@pamfile% + \fi% +} +\endinput +%% +%% End of file `clojure-pamphlet.sty'. diff --git a/Master/tlpkg/bin/tlpkg-ctan-check b/Master/tlpkg/bin/tlpkg-ctan-check index 4eb079b3486..6cd89e22f9c 100755 --- a/Master/tlpkg/bin/tlpkg-ctan-check +++ b/Master/tlpkg/bin/tlpkg-ctan-check @@ -161,7 +161,7 @@ my @TLP_working = qw( cite citeall citeref cje cjhebrew cjk cjk-gs-integrate cjk-ko cjkpunct classics classpack classicthesis cleanthesis clearsans clefval cleveref clipboard - clock cloze clrdblpg clrscode clrscode3e clrstrip cluttex + clock clojure-pamphlet cloze clrdblpg clrscode clrscode3e clrstrip cluttex cm cm-lgc cm-mf-extra-bold cm-super cm-unicode cmap cmarrows cmbright cmcyr cmdstring cmdtrack cmexb cmextra cmll cmpica cmpj cmsd cmsrb cmtiup diff --git a/Master/tlpkg/libexec/ctan2tds b/Master/tlpkg/libexec/ctan2tds index 6e28d1572ff..3eb2575d1ab 100755 --- a/Master/tlpkg/libexec/ctan2tds +++ b/Master/tlpkg/libexec/ctan2tds @@ -263,7 +263,6 @@ chomp (my $ctan_root = `tlpkginfo --ctan-root`); 'clarendo', "die 'skipping, nonfree font'", 'classico', "die 'skipping, nonfree font'", 'clock', "&MAKEflatten", - 'clojure-pamphlet', "die 'skipping, compilation'", 'cm', "die 'skipping, frozen'", 'cm-lgc', "&MAKEcmlgc", 'cm-super', "&MAKEflatten", @@ -1363,6 +1362,7 @@ chomp (my $ctan_root = `tlpkginfo --ctan-root`); 'apa6' => '&PREHOOK_apa6', 'cals' => '&PREHOOK_cals', 'chess' => '&PREHOOK_chess', + 'clojure-pamphlet' => '&PREHOOK_clojure_pamphlet', 'cluttex' => '&PREHOOK_cluttex', 'cm' => '&PREHOOK_cm', 'cm-super' => '&PREHOOK_cm_super', @@ -3039,6 +3039,7 @@ $standardttf = '\.ttf|\.TTC'; 'checkcites' => '\.lua$', 'checklistings' => '\.sh$', 'cjk-gs-integrate' => '\.pl$', + 'clojure-pamphlet' => 'pamphletangler$', 'cluttex' => 'cluttex\.lua$', # moved by prehook. 'convbkmk' => '\.rb$', 'crossrefware' => '\.pl$', @@ -3423,7 +3424,7 @@ sub set_dir_defaults { $standarddocfmt = $standardsourcefmt = $standardfmt = "xelatex"; $guess = "$standarddocfmt for fmt/docfmt/srcfmt"; - } elsif ($ctan_dir =~ m!/(CTAN|tex-archive)/support/!) { + } elsif ($ctan_dir =~ m!/(CTAN|tex-archive)/(support|web)/!) { $standarddocfmt = $standardsourcefmt = "support"; $guess = "$standarddocfmt for docfmt/srcfmt"; @@ -5446,6 +5447,11 @@ sub PREHOOK_chess { &SYSTEM ("$RM -rf inputs pkfonts.zip"); } +sub PREHOOK_clojure_pamphlet { + print "PREHOOK_$package - make .1 with pod2man\n"; + &prehook_pod2man ("Ernesto Lanchares", "pamphletangler"); +} + sub PREHOOK_cluttex { print "PREHOOK_$package - mv */cluttex for specialscripts\n"; &SYSTEM ("$MV bin/cluttex cluttex.lua"); diff --git a/Master/tlpkg/tlpsrc/clojure-pamphlet.tlpsrc b/Master/tlpkg/tlpsrc/clojure-pamphlet.tlpsrc new file mode 100644 index 00000000000..742564014db --- /dev/null +++ b/Master/tlpkg/tlpsrc/clojure-pamphlet.tlpsrc @@ -0,0 +1,3 @@ +runpattern d texmf-dist/tex/latex/${PKGNAME} +runpattern f texmf-dist/scripts/${PKGNAME}/pamphletangler +binpattern f bin/${ARCH}/pamphletangler diff --git a/Master/tlpkg/tlpsrc/collection-binextra.tlpsrc b/Master/tlpkg/tlpsrc/collection-binextra.tlpsrc index 78f51e74d17..9d6efa9b82f 100644 --- a/Master/tlpkg/tlpsrc/collection-binextra.tlpsrc +++ b/Master/tlpkg/tlpsrc/collection-binextra.tlpsrc @@ -15,6 +15,7 @@ depend bibtexu depend bundledoc depend checklistings depend chktex +depend clojure-pamphlet depend cluttex depend ctan-o-mat depend ctan_chk -- cgit v1.2.3