-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgenpro.pseudo
1418 lines (1171 loc) · 42.5 KB
/
genpro.pseudo
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
let ProjectInformation be a record with 26 fields:
AnnotatedBibliography → a boolean. ; Flag for creating an annotated
; bibliography.
Apl → a boolean. ; Flag for creating GNU APL Code scaffolding and
; output.
Author → a string. ; The user's full name.
Authority → a string. ; The professor, tech lead, or advisor.
Bibliography → a string. ; The biblatex file to reference.
CitationStyle → a string. ; The citation style to use, for
; future-proofing against non-APA7
; requirements.
Content → a boolean. ; Flag for whether the content.tex file should be
; included in the final project's compilation.
C → a boolean. ; Flag for creating C Code scaffolding and output.
Cpp → a boolean. ; Flag for creating C++ Code scaffolding and output.
Date → a datetime. ; The due date or publishing date.
Figures → a boolean. ; Flag for whether the figures.tex file should be
; included in the final compilation.
FontCode → a string. ; The filename of the font to use for code
; listings.
FontMain → a string. ; The filename of the font to use for prose.
Gemini → a boolean. ; Flag for creating the Gemtext output for the
; project.
GenproVersion → a string. ; The version of genpro this metadata
; expects.
Guile → a boolean. ; Flag for creating GNU Guile Code scaffolding and
; output.
HTML → a boolean. ; Flag for creating the HTML Output.
Institution → a string. ; The school or supporting body.
Java → a boolean. ; Flag for creating Java Code scaffolding and
; output.
JavaLocalLibraries → a list of strings. ; Directories or filenames to
; include as libraries, under
; the /lib directory of the
; project.
LocalBib → a boolean. ; Flag for creating a project-local copy of all
; references used.
Metapost → a boolean. ; Flag for creating and compiling the Metapost
; Component.
OCaml → a boolean. ; Flag for creating OCaml Code scaffolding and
; output.
ProjectTitle → a string. ; The project title.
Prolog → a boolean. ; Flag for creating Prolog Code scaffolding and
; output.
References → a boolean. ; Flag for whether the references section
; should be included in the final projects
; compilation.
SQL → a boolean. ; Flag for creating an SQL script to store this
; project in a Postgres Database.
Section → a string. ; The class or laboratory.
Text → a boolean. ; Flag for creating the plaintext output for the
; project.
Zig → a boolean. ; Flag for creating Zig Code scaffolding and output.
end let.
let CleanFilesCommand be the string:
"find . -maxdepth 2 -not -path *assignment* -not -path ./lib/* -not -path ./lib -not -path ./src -exec rm -fv {} \;".
end let.
let MetainfoTemplate be the string:
";;; -*- scheme -*-
;;;
;;; This is the metadata file for genpro projects.
;;;
;;; Replace the default values with the ones appropriate for Your
;;; project.
(define genpro-metadata
(build-genpro-metadata
#:annotated-bibliography? #false
#:apl? #false
#:author "Christopher Rodriguez"
#:authority "Dr. Some Professor"
#:bibliography "~/Documents/biblio/main.bib"
#:citation-style 'apa7
#:content? #true
#:c? #false
#:cpp? #false
#:date (date->string (current-date))
#:figures? #true
#:font-code "unifont.otf"
#:font-main "texgyretermes-regular.otf"
#:gemini? #false
#:genpro-version "1.0.0"
#:guile? #false
#:html? #true
#:institution "Colorado State University Global"
#:java? #false
#:java-local-libraries '()
#:local-bibliography? #false
#:metapost? #true
#:ocaml? #false
#:project-title "Title of Paper"
#:prolog? #false
#:references? #true
#:sql? #false
#:section "23FA-XXX000-1: The Title of the Class"
#:text? #true
#:zig? #false))
;; Local Variables:
;; mode: scheme
;; mode: scheme
;; End:".
end let.
let PreambleTemplatePrefix be the string:
"\usepackage{lwarp}
\CSSFilename{https://cdr255.com/css/lwarp-cdr255.css}
\usepackage{geometry}
\geometry{
letterpaper,
left=1in,
right=1in,
top=1in,
bottom=1in}
\usepackage{etoolbox}
\usepackage{fancyhdr}
\pagestyle{fancy}
\lhead{}
\chead{}
\rhead{\thepage}
\lfoot{}
\cfoot{}
\rfoot{}
\renewcommand{\headrulewidth}{0pt}
\usepackage[american]{babel}
\usepackage{xpatch}
\usepackage[backend=biber,style=".
end let.
let PreambleTemplateInfix be the string:
"loadfiles=true]{biblatex}
\usepackage[]{setspace}
\usepackage{indentfirst}
\usepackage{fontspec}
\setmainfont{TeXGyreTermes}.
"
end let.
let PreambleTemplatePostfix be the string:
"\appto{\bibsetup}{\raggedright}
\bibliography{\localbibliography}
\DeclareLanguageMapping{american}{american-apa}
\setlength{\parindent}{4em}
\usepackage{titlesec}
\titleformat{\section}
{\centering\normalfont\normalsize\bfseries}{\thesection.}{1em}{}
\titleformat{\subsection}
{\normalfont\normalsize\itshape}{\thesubsection.}{1em}{}
\titleformat{\subsubsection}
{\normalfont\normalsize\itshape}{\thesubsubsection.}{1em}{}
\usepackage{graphicx}
\graphicspath{ {./images/} }
\usepackage{caption}
\input{colors}
\usepackage{hyperref}
\hypersetup{colorlinks = true, % Swap these two if You
%hidelinks = false, % Don't want links to be obvious.
linkcolor = href-link,
filecolor = href-file,
urlcolor = href-url,
anchorcolor = href-anchor,
citecolor = href-cite,
menucolor = href-menu,
runcolor = href-run,
linktoc = all,
pdftitle = \localtitle,
pdfauthor = \localauthor,
%pdfsubject = key topic, % Metadata not supported by
%pdfkeywords = key words, % Genpro yet.
}
\usepackage[noabbrev]{cleveref}
\usepackage{fancyvrb}
\input{listings}
\usepackage{minted}
\usepackage{datetime2}
\usepackage{luamplib}
\mplibtextextlabel{enable}
\everymplib{input metauml;}
\mplibforcehmode
\usepackage{mflogo}
\usepackage{csquotes}
\renewcommand\labelitemi{\bullet}
\renewcommand\labelitemii{\cdot}
\renewcommand\labelitemiii{\circ}
\AtBeginEnvironment{appendices}{\crefalias{section}{appendix}}
\newcommand{\hlabel}{\phantomsection\label}
\newcommand{\noteheader}{ \\ \frenchspacing{}\textit{Note.}\nonfrenchspacing{}\doublespacing{} }
\newcommand{\figuretitle}[1]{\caption[]{ \\~\\ \textit{#1}}}
\doublespacing
\DeclareCaptionLabelSeparator*{spaced}{\\[2ex]}
\captionsetup[table]{labelsep=none,labelfont=bf,justification=raggedright,
singlelinecheck=false}
\captionsetup[figure]{labelsep=none,labelfont=bf,justification=raggedright,
singlelinecheck=false}
% Genpro version 2.".
end let.
let ListingsTemplate be the string:
"\usepackage[procnames]{listings}
\makeatletter
\lst@InputCatcodes
\def\lst@DefEC{%
\lst@CCECUse \lst@ProcessLetter
^^80^^81^^82^^83^^84^^85^^86^^87^^88^^89^^8a^^8b^^8c^^8d^^8e^^8f%
^^90^^91^^92^^93^^94^^95^^96^^97^^98^^99^^9a^^9b^^9c^^9d^^9e^^9f%
^^a0^^a1^^a2^^a3^^a4^^a5^^a6^^a7^^a8^^a9^^aa^^ab^^ac^^ad^^ae^^af%
^^b0^^b1^^b2^^b3^^b4^^b5^^b6^^b7^^b8^^b9^^ba^^bb^^bc^^bd^^be^^bf%
^^c0^^c1^^c2^^c3^^c4^^c5^^c6^^c7^^c8^^c9^^ca^^cb^^cc^^cd^^ce^^cf%
^^d0^^d1^^d2^^d3^^d4^^d5^^d6^^d7^^d8^^d9^^da^^db^^dc^^dd^^de^^df%
^^e0^^e1^^e2^^e3^^e4^^e5^^e6^^e7^^e8^^e9^^ea^^eb^^ec^^ed^^ee^^ef%
^^f0^^f1^^f2^^f3^^f4^^f5^^f6^^f7^^f8^^f9^^fa^^fb^^fc^^fd^^fe^^ff%
^^^^20ac^^^^0153^^^^0152%
^^^^20a7^^^^2190^^^^2191^^^^2192^^^^2193^^^^2206^^^^2207^^^^220a%
^^^^2218^^^^2228^^^^2229^^^^222a^^^^2235^^^^223c^^^^2260^^^^2261%
^^^^2262^^^^2264^^^^2265^^^^2282^^^^2283^^^^2296^^^^22a2^^^^22a3%
^^^^22a4^^^^22a5^^^^22c4^^^^2308^^^^230a^^^^2336^^^^2337^^^^2339%
^^^^233b^^^^233d^^^^233f^^^^2340^^^^2342^^^^2347^^^^2348^^^^2349%
^^^^234b^^^^234e^^^^2350^^^^2352^^^^2355^^^^2357^^^^2359^^^^235d%
^^^^235e^^^^235f^^^^2361^^^^2362^^^^2363^^^^2364^^^^2365^^^^2368%
^^^^236a^^^^236b^^^^236c^^^^2371^^^^2372^^^^2373^^^^2374^^^^2375%
^^^^2377^^^^2378^^^^237a^^^^2395^^^^25af^^^^25ca^^^^25cb%
^^00}
\lst@RestoreCatcodes
\makeatother
\lstdefinelanguage{apl}
{
extendedchars=true,
sensitive=True,
breakatwhitespace=false,
otherkeywords={},
morekeywords= [2]{', (, ), +, \,, -, ., /, :, ;, <, =, >, ?, [, ],
\\, _, ¨, ¯, ×, ÷, ←, ↑, →, ↓, ∆, ∇, ∘, ∣, ∧, ∨,
∩, ∪, ∼, ≠, ≤, ≥, ≬, ⊂, ⊃, ⌈, ⌊, ⊤, ⊥, ⋆, ⌶, ⌷,
⌸, ⌹, ⌺, ⌻, ⌼, ⌽, ⌾, ⌿, ⍀, ⍁, ⍂, ⍃, ⍄, ⍅, ⍆, ⍇,
⍈, ⍉, ⍊, ⍋, ⍌, ⍍, ⍎, ⍏, ⍐, ⍑, ⍒, ⍓, ⍔, ⍕, ⍖, ⍗,
⍘, ⍙, ⍚, ⍛, ⍜, ⍞, ⍟, ⍠, ⍡, ⍢, ⍣, ⍤, ⍥, ⍦, ⍧,
⍨, ⍩, ⍪, ⍫, ⍬, ⍭, ⍮, ⍯, ⍰, ⍱, ⍲, ⍳, ⍴, ⍵, ⍶, ⍷,
⍸, ⍹, ⍺, ⎕, ○, *},
alsoletter={/,-,*,|,\\,\,},
morecomment=[l]{⍝},
morecomment=[l]{\#},
morestring=[b]\",
morestring=[b]',
moreprocnamekeys={∇}
}[keywords, comments, strings, procnames]
\lstset{%
basicstyle=\freemono\small,
keywordstyle=[2]\color{code-keyword},
procnamestyle=\color{code-variable},
% identifierstyle=,
commentstyle=\slshape\color{code-comment}, % no slanted shape in APL385
stringstyle=\ttfamily\color{code-string},
showstringspaces=false,
% frame=single,
% framesep=1pt,
% framerule=0.8pt,
breaklines=true, % break long code lines
breakindent=0pt
}
".
end let.
let ColorsTemplate be the string:
"\usepackage[html]{xcolor}
% CDR Colors
\definecolor{cdr-black}{HTML}{2d3743}
\definecolor{cdr-cyan}{HTML}{34cae2}
\definecolor{cdr-orange}{HTML}{e67128}
\definecolor{cdr-green}{HTML}{338f86}
\definecolor{cdr-magenta}{HTML}{ee7ae7}
\definecolor{cdr-red}{HTML}{ff4242}
\definecolor{cdr-white}{HTML}{e1e1e0}
\definecolor{cdr-yellow}{HTML}{ffad29}
% HrefColors
\definecolor{href-link}{HTML}{03872d}
\definecolor{href-file}{HTML}{032d87}
\definecolor{href-url}{HTML}{032d87}
\definecolor{href-cite}{HTML}{2d0387}
\definecolor{href-anchor}{HTML}{87032d}
\definecolor{href-menu}{HTML}{03872d}
\definecolor{href-run}{HTML}{87032d}
% CodeColors
% Pygments Xcode Theme:
% =====================
% Keywords A90D91
% Comments 177500
% Variable 3F6E75
% String C41A16
% Constant 1C01CE
\definecolor{code-comment}{HTML}{177500}
\definecolor{code-keyword}{HTML}{a90d91}
\definecolor{code-variable}{HTML}{3f6e75}
\definecolor{code-string}{HTML}{c41a16}
\definecolor{code-constant}{HTML}{1c01ce}
".
end let.
let MainTemplatePrefix be the string:
"% This is main.tex
\documentclass[12pt, american]{report}
\input{meta}
\input{preamble}
\begin{document}
\pagenumbering{arabic}
\setlength{\headheight}{14.49998pt}
\addtolength{\topmargin}{-2.49998pt}
\input{title-page}
\newpage
\section*{\localtitle{}}
".
end let.
let TitleTemplate be the string:
"\begin{center}
\vspace*{5cm}
\textbf{\localtitle}\\
\vspace{\baselineskip}
\localauthor\\
\localschool\\
\localsection\\
\localprofessor\\
\localduedate
\end{center}
".
end let.
let JavaTemplate be the string:
"package assignment;
import java.util.Scanner;
import java.lang.StringBuilder;
import java.lang.RuntimeException;
/**
* <p>A One-Line Description of the Purpose of this Class in Active
* Voice.</p>
*
* <p>A Longer Description of the thought process behind this code.</p>
*
*/
public class Implementation {
/**
* <p>Default, empty constructor.</p>
*
* <p>This is a <strong>CALCULATION</strong>.
*
* <p><strong>Impurities:</strong> None.</p>
*
*/
Implementation() {
}
// Personal Exception Type for bad Strings gained from User Input.
/**
* <p>An exception for when user input is impermissable.</p>
*
* <p>Basically a <code>RuntimeException</code>, but named differently
* for more readable code.</p>
*
*/
private static class InvalidInputException extends RuntimeException {
/**
* <p>Creates an error specifying invalid input from the user.</p>
*
* <p>This is a <strong>CALCULATION</strong>.
* <p><em>Impurities:</em> None.</p>
* @param errorMessage the message to display to the user.
* @param error the actual throwable error object, for root cause
* investigation.
*/
private InvalidInputException(String errorMessage, Throwable error) {
super(errorMessage, error);
}
}
/**
* <p>The message we'll use to indicate that empty input was
* received.</p>
*/
private static String emptyInputMessage =
\"Please Enter Something, Input Input is not Allowed.\";
/**
* <p>A pre-built, generic InvalidInputException meant for when empty
* user input is supplied.</p>
*/
private static InvalidInputException emptyInput =
new InvalidInputException(emptyInputMessage, null);
/**
* <p>Gets input from the supplied <code>Scanner</code>, ensuring it is
* not empty.</p>
*
* <p>This is an <strong>ACTION</strong>.
*
* <p><em>Impurities:</em> IO.</p>
*
* @param scanner what to use for getting the input.
* @return The supplied input, once it is not empty.
* @throws InvalidInputException if empty input is supplied.
*
*/
private static String getRawInput(Scanner scanner)
throws InvalidInputException {
String result = \"\";
while (result == \"\") {
try {
result = scanner.next();
if (result.equals(\"\")) {
throw emptyInput;
}
} catch (InvalidInputException e) {
System.out.println(\"ERROR: \" + e.getMessage());
}
}
return result;
}
/**
* <p>A pre-defined <code>Scanner</code> object for use in main, which
* accepts input up to a newline as <code>next()</code>.</p>
*/
private static Scanner scanner = new Scanner(System.in)
.useDelimiter(\"\\n\");
/**
* <p>A pre-defined <code>StringBuilder</code> object for use in
* main.</p>
*/
private static StringBuilder stringBuilder = new StringBuilder();
/**
* <p>Runs the Actual Assignment.</p>
*
* <p>This is an <strong>ACTION</strong>.
*
* <p><strong>Impurities:</strong> IO.</p>
*
* @param args arguments from the CLI.
*/
public static void main(String args[]) {
stringBuilder.append(getRawInput(scanner));
System.out.println(stringBuilder.toString());
}
}\n".
end let.
let MetapostTemplate be the string:
"prologues := 3;
outputtemplate := \"%j-%c.mps\";
string metauml_defaultFont;
string metauml_defaultFontOblique;
string metauml_defaultFontBold;
string metauml_defaultFontBoldOblique;
metauml_defaultFont := \"texnansi-qtmr\";
metauml_defaultFontOblique := \"texnansi-qtmri\";
metauml_defaultFontBold := \"texnansi-qtmb\";
metauml_defaultFontBoldOblique := \"texnansi-qtmbi\";
input metauml;
def U primary s = if string s: decode(s) fi enddef;
vardef decode(expr given) =
save a, i, s, out; string s, out; numeric a, i;
out = \"\"; i=0;
forever:
s := substring (i, incr i) of given;
a := ASCII s;
if a < 128:
elseif a = 194:
s := substring (i, incr i) of given;
elseif a = 195:
s := char (64 + ASCII substring (i, incr i) of given);
else:
s := \"?\";
fi
out := out & s;
exitif i >= length given;
endfor
out
enddef;
beginfig(1);
Activity.A(U\"«Create» <>\");
drawObjects(A);
endfig;
end.
".
end let.
let JavaPkgInfoTemplate be the string:
"/**
* This package is meant to implement Assignment 00 of CSC00.
*
* <p>The original Assignment Given was:</p>
*
* <pre>Your first assignment is to get to know the team of learners with
* whom you will be working. Please introduce yourself in this discussion
* forum. Focus your introduction on areas you feel are relevant to your work
* in the course but, give your introduction a personal touch as well.
*
* Also, share your location, your career aspirations, and any personal
* experiences or knowledge that relates to this course. You may also post a
* picture of yourself.
*
* What experience and interest do you have in computer programming? How
* might the knowledge and skills associated with this course support your
* career goals or life aspirations?</pre>
*
* @since 15.0
* @author yewscion
* @version 1.0
*/
package assignment;".
end let.
begin [BuildFileName].
expect Info as an argument,
expecting a ProjectInformation record.
let Result be a string.
let SectionCode be the pick 0 of the result of calling [SplitString]
on Info -> Section and ":".
append Info -> Date
append "."
append SectionCode
append "."
append Info -> Project
if Info -> AnnotatedBibliography then:
append "-annotated-bibliography"
end if.
return the result of calling [DowncaseString]
on the result of calling [SanitizeString]
on Result.
end [BuildFileName].
begin [BuildLatexCommand].
expect CommandName and Value as arguments,
expecting a string and a string.
let Result be a string.
append "\newcommand{\\"
append CommandName
append "}{\\string"
append Value
append "}"
append newline
return Result.
end [BuildLatexCommand].
begin [BuildMetaFileContent].
expect Info as an argument,
expecting a ProjectInformation record.
let Result be a string.
append the result of calling [BuildLatexCommand]
on "localbibliography" and Info -> Bibliography
append the result of calling [BuildLatexCommand]
on "localtitle" and Info -> Project
append the result of calling [BuildLatexCommand]
on "localauthor" and Info -> Author
append the result of calling [BuildLatexCommand]
on "localschool" and Info -> Institution
append the result of calling [BuildLatexCommand]
on "localsection" and Info -> Section
append the result of calling [BuildLatexCommand]
on "localprofessor" and Info -> Authority
append the result of calling [BuildLatexCommand]
on "localduedate" and Info -> Date
append newline
append "% Genpro version 1."
return Result.
end [BuildMetaFileContent].
begin [BuildPreambleFileContent].
expect Info as an argument,
expecting a ProjectInformation record.
let Result be a string.
append PreambleTemplatePrefix
if Info -> CitationStyle is "APA7" then
append "apa,"
else
append "apa," ;; Same either way for now, default for
;; future use.
end if.
if Info -> AnnotatedBibliography then
append "annotation=true,"
else
append "annotation=false,"
end if.
append PreambleTemplateInfix
append "\newfontfamily{\freemono}{FreeMono.otf}[Path = "
append the result of calling [ShellCommandToString]
on the result of calling [FindFontCommand]
on "FreeMono.otf"
append "]
\newfontfamily{\unifont}{unifont.ttf}[Path = \""
append the result of calling [ShellCommandToString]
on the result of calling [FindFontCommand]
on "unifont.ttf"
append "]
"
append PreambleTemplatePostfix
return Result.
end [BuildPreambleFileContent].
begin [BuildListingsFileContent].
expect Info as an argument,
expecting a ProjectInformation record.
return ListingsTemplate as a string.
end [BuildListingsFileContent].
begin [BuildColorsFileContent].
expect Info as an argument,
expecting a ProjectInformation record.
return ColorsTemplate as a string.
end [BuildColorsFileContent].
begin [BuildMainFileContent].
expect Info as an argument,
expecting a ProjectInformation record.
let Result be a string.
append MainTemplatePrefix
if Info -> Content then
append "\input{content}
\newpage
"
end if.
if Info -> References then
append "\section*{References}
\printbibliography[heading=none]
\newpage
"
end if.
if Info -> Figures then
append "\input{figures}"
end if.
append "\end{document}"
return Result.
end [BuildMainFileContent].
begin [BuildTitleFileContent].
expect Info as an argument,
expecting a ProjectInformation record.
return TitleTemplate as a string.
end [BuildTitleFileContent].
begin [BuildJavaFileContent].
expect Info as an argument,
expecting a ProjectInformation record.
return JavaTemplate as a string.
end [BuildJavaFileContent].
begin [FindFontCommand].
expect FontName as an argument,
expecting a string.
let Result be a string.
append "fc-list | grep "
append FontName
append " | sed 's/:.*//g;s/\/[A-z.]*$/\//;1q'"
return Result.
end [FindFontCommand].
begin [BuildJavaPkginfoFileContent].
expect Info as an argument,
expecting a ProjectInformation record.
return JavaPkginfoTemplate as a string.
end [BuildJavaPkginfoFileContent].
begin [BuildMetapostFileContent].
expect Info as an argument,
expecting a ProjectInformation record.
return MetapostTemplate as a string.
end [BuildMetapostFileContent].
begin [DumpToFile].
expect Info, FileName, and BuildProcedure as arguments,
expecting a ProjectInformation record, a string, and
a {ProjectInformation record → string} procedure.
let OutputFile be the file at FileName.
let Contents be the result of calling BuildProcedure on Info.
dump Contents to OutputFile.
end [DumpToFile].
begin [MakeProject].
expect Info as an argument,
expecting a ProjectInformation record.
let ProjectName be the result of calling [BuildFileName] on Info.
let Java? be equal to Info -> Java?.
let PDFFileName be the result of appending the strings
"./", ProjectName, and ".pdf".
let HTMLFileName be the result of appending the strings
"./", ProjectName, and ".html".
let PDFLinkName be the result of appending the strings
"./src/", ProjectName,
and ".html".
let HTMLLinkName be the result of appending the strings
"./src/", ProjectName,
and ".html".
if "./src/" is not a directory, create "./src/" as a directory.
call DumpToFile on Info, "./src/main.tex",
and [BuildMainFileContent].
call DumpToFile on Info, "./src/meta.tex",
and [BuildMetaFileContent].
call DumpToFile on Info, "./src/preamble.tex",
and [BuildPreambleContent].
call DumpToFile on Info, "./src/title-page.tex",
and [BuildTitlePageContent].
call DumpToFile on Info, "./src/listings.tex",
and [BuildListingsContent].
call DumpToFile on Info, "./src/colors.tex",
and [BuildColorsContent].
call DumpToFile on Info, "./src/metapost.mp",
and [BuildMetapostContent].
if Java? then:
call [CreateJavaFiles] on Info.
end if.
create "content.tex" as a file.
create "figures.tex" as a file.
create ".assignment" as a file.
create "./src/.genpro-metadata" as a symlink to "./.genpro-metadata".
create "./src/content.tex" as a symlink to "./content.tex".
create "./src/figures.tex" as a symlink to "./figures.tex".
call [Chdir] on "src/"
call [RunLuaLatex] on Name.
system call "lwarpmk html".
call [MoveFile] on PDFFilename and "../".
call [MoveFile] on HTMLFilename and "../".
call [Chdir] on "../".
create PDFLinkName as a symlink to PDFFileName.
create HTMLLinkName as a symlink to HTMLFileName.
end [MakeProject].
begin [BuildMetadataFileContent].
expect Info as an argument,
expecting a ProjectInformation record.
let Result be a string.
append MetadataTemplate
append " (date \""
append the date
append "\")\n"
return Result as a string.
end [BuildMetadataFileContent].
begin [BuildProjectileFileContent].
expect Info as an argument,
expecting a ProjectInformation record.
return ";;; Generated with Genpro v2.".
end [BuildProjectileFileContent].
begin [InitializeProject].
call [DumpToFile] on nothing, ".genpro-metadata",
and [BuildMetadataFileContent].
call [DumpToFile] on nothing, ".projectile",
and [BuildProjectileFileContent].
end [InitializeProject].
begin [BuildLualatexCommand].
expect Info as an argument,
expecting a ProjectInformation record.
let Name be equal to Info → ProjectTitle.
let Result be a string.
append "lualatex --output-format pdf --jobname="
append Name
append " --shell-escape main.tex"
return Result.
end [BuildLualatexCommand].
begin [ShowLualatexCommand].
expect Info as an argument,
expecting a ProjectInformation record.
call [Bluebird] on display, [BuildLualatexCommand], and Info.
end [ShowLualatexCommand].
begin [RunLualatexCommand].
expect Info as an argument,
expecting a ProjectInformation record.
call [Bluebird] on system call, [BuildLualatexCommand], and Info.
end [RunLualatexCommand].
begin [BuildLynxCommand].
expect Info as an argument,
expecting a ProjectInformation record.
let Name be equal to Info → ProjectTitle.
let Result be a string.
append "lynx --dump "
append Name
append ".html > "
append Name
append ".txt"
return Result.
end [BuildLynxCommand].
begin [ShowLynxCommand].
expect Info as an argument,
expecting a ProjectInformation record.
call [Bluebird] on display, [BuildLynxCommand], and Info.
end [ShowLynxCommand].
begin [RunLynxCommand].
expect Info as an argument,
expecting a ProjectInformation record.
call [Bluebird] on system call, [BuildLynxCommand], and Info.
end [RunLynxCommand].
begin [DumpStringToFileIfBound].
expect String and File as arguments,
expecting a string and a string.
if String is not null:
call [DumpStringToFile] on File and String.
end if.
end [DumpStringToFileIfBound].
begin [BuildJavaClasspathIncludes].
expect Info as an argument,
expecting a ProjectInformation record.
let Libs be a list of strings equal to Info → JavaLocalLibraries.
let Result be a string.
if the tally of Libs is greater than 0:
map append "../../lib/" to item over Libs.
let Result be the result of joining over Libs with ":" infixed.
else:
let Result be ".".
return Result.
end [BuildJavaClasspathIncludes].
begin [BuildJavaZipfileCommand].
expect Info as an argument,
expecting a ProjectInformation record.
let ZipPrefix be " zip -9 -r -v ".
let Name be equal to Info → ProjectTitle.
let Files be the result of calling [BuildJavaZipfileFiles] on Info.
let TmpDir be a string.
let ZipName be a string.
let WipName be a string.
let Result be a string.
append " ", Name, and ".java/ " to TmpDir.
append " ", Name, and ".java.zip " to ZipName.
append Name and "-wip.zip " to WipName.
let Result be equal to joining over this with " && " infixed:
append ZipPrefix, WipName, and Files.
append " mkdir -pv " and TmpDir.
append " cd " and TmpDir.
append " unzip ../" and Wipname.
append " cd .. ".
append " rm " and ZipName.
append ZipPrefix, ZipName, and TmpDir.
append " rm -rf ", WipName, and TmpDir.
end let.
return Result.
end [BuildJavaZipfileCommand]
begin [BuildJavaZipfileFiles].
expect Info as an argument,
expecting a ProjectInformation record.
let Libs be a list of strings equal to Info → JavaLocalLibraries.
let Result be a string.
append " assignment/*.java " to Result.
append Info → ProjectTitle to Result.
append ".jar doc/ " to Result.
if the tally of Libs is greater than 0:
map append "../lib/" to item over Libs.
append the result of joining over Libs with " " infixed to Result.
end if.
return Result.
end [BuildJavaZipfileFiles].
begin [ShowJavaZipfileCommand].
expect Info as an argument,
expecting a ProjectInformation record.
call [Bluebird] on display, [BuildJavaZipfileCommand], and Info.
end [ShowJavaZipfileCommand].
begin [RunJavaZipfileCommand].
expect Info as an argument,
expecting a ProjectInformation record.
call [Bluebird] on system call, [BuildJavaZipfileCommand], and Info.
end [RunJavaZipfileCommand].
begin [BuildRunJarfileCommand].
expect Info as an argument,
expecting a ProjectInformation record.
let Name be equal to Info → ProjectTitle.
let Classpath be the result of
calling [BuildJavaClasspathIncludes] on Info.
let JarfileName be the result of appending "src/", Name, and ".jar".
let Result be a string.
append "java -cp " to Result.
append Classpath to Result.
append " -jar " to Result.
append JarfileName to Result.
return Result.
end [BuildRunJarfileCommand].
begin [ShowRunJarfileCommand].
expect Info as an argument,
expecting a ProjectInformation record.
call [Bluebird] on display, [BuildRunJarfileCommand], and Info.
end [ShowRunJarfileCommand].
begin [RunRunJarfileCommand].
expect Info as an argument,
expecting a ProjectInformation record.
call [Bluebird] on system call, [BuildRunJarfileCommand], and Info.
end [RunRunJarfileCommand].
begin [BuildJavadocCommand].
expect Info as an argument,
expecting a ProjectInformation record.
let Classpath be the result of
joining "..:" and
the result of
calling [BuildJavaClasspathIncludes] on Info.
let Result be a string.
append "javadoc -private -cp " to Result.
append Classpath to Result.
append " assignment" to Result.
return Result.
end [BuildJavadocCommand].
begin [ShowJavadocCommand].
expect Info as an argument,
expecting a ProjectInformation record.
call [Bluebird] on display, [BuildJavadocCommand], and Info.
end [ShowJavadocCommand].
begin [RunJavadocCommand].
expect Info as an argument,
expecting a ProjectInformation record.