-
-
Notifications
You must be signed in to change notification settings - Fork 76
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1074 from openwebwork/PG-2.19
PG 2.19 Release Candidate
- Loading branch information
Showing
267 changed files
with
18,522 additions
and
11,325 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
root = true | ||
|
||
[*] | ||
charset = utf-8 | ||
end_of_line = lf | ||
insert_final_newline = true | ||
max_line_length = 120 | ||
trim_trailing_whitespace = true | ||
indent_style = tab | ||
indent_size = 4 | ||
|
||
[*.yml] | ||
indent_style = space | ||
indent_size = 2 | ||
|
||
[*.pg] | ||
trim_trailing_whitespace = false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
--- | ||
name: Check Formatting of Code Base | ||
|
||
defaults: | ||
run: | ||
shell: bash | ||
|
||
on: | ||
push: | ||
branches-ignore: [main, develop] | ||
pull_request: | ||
|
||
jobs: | ||
perltidy: | ||
name: Check Perl file formatting with perltidy | ||
runs-on: ubuntu-22.04 | ||
container: | ||
image: perl:5.34 | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
- name: Install dependencies | ||
run: cpanm -n Perl::Tidy@20220613 | ||
- name: Run perltidy | ||
shell: bash | ||
run: | | ||
git config --global --add safe.directory "$GITHUB_WORKSPACE" | ||
shopt -s extglob globstar nullglob | ||
perltidy --pro=./.perltidyrc -b -bext='/' ./**/*.p[lm] ./**/*.t && git diff --exit-code | ||
prettier: | ||
name: Check JavaScript, style, and HTML file formatting with prettier | ||
runs-on: ubuntu-22.04 | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
- name: Install Node | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: '20' | ||
- name: Install Dependencies | ||
run: cd htdocs && npm ci --ignore-scripts | ||
- name: Check formatting with prettier | ||
run: cd htdocs && npm run prettier-check |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,8 @@ | ||
conf/pg_config.yml | ||
*~ | ||
*.swp | ||
*.bak | ||
|
||
conf/pg_config.yml | ||
cover_db/ | ||
|
||
htdocs/node_modules | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"arrowParens": "always", | ||
"bracketSpacing": true, | ||
"printWidth": 120, | ||
"semi": true, | ||
"singleQuote": true, | ||
"trailingComma": "none" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
$PG_VERSION ='2.18'; | ||
$PG_COPYRIGHT_YEARS = '1996-2023'; | ||
$PG_VERSION ='2.19'; | ||
$PG_COPYRIGHT_YEARS = '1996-2024'; | ||
|
||
1; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
#!/usr/bin/env perl | ||
################################################################################ | ||
# WeBWorK Online Homework Delivery System | ||
# Copyright © 2000-2024 The WeBWorK Project, https://github.com/openwebwork | ||
# | ||
# This program is free software; you can redistribute it and/or modify it under | ||
# the terms of either: (a) the GNU General Public License as published by the | ||
# Free Software Foundation; either version 2, or (at your option) any later | ||
# version, or (b) the "Artistic License" which comes with this package. | ||
# | ||
# 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 either the GNU General Public License or the | ||
# Artistic License for more details. | ||
################################################################################ | ||
|
||
=head1 NAME | ||
convert-to-pgml.pl -- Convert pg problem with non-pgml structure to PGML structure. | ||
=head1 SYNOPSIS | ||
convert-to-pgml -b -s pgml file1.pg file2.pg ... | ||
=head1 DESCRIPTION | ||
This converts each pg file to PGML formatting. In particular, text blocks are | ||
converted to their PGML forms. This includes BEGIN_TEXT/END_TEXT, BEGIN_HINT/END_HINT, | ||
BEGIN_SOLUTION/END_SOLUTION. | ||
Within each block, the following are converted: math modes to their PGML version, | ||
$BR and $PAR to line breaks or empty lines, C<$HR> to C<--->, bold and italics pairs, | ||
any variables of the form C<$var> to C<[$var]>, scripts from \{ \} to [@ @], and C<ans_rule> | ||
to the form C<[_]{}> | ||
Many code features that are no longer needed are removed including | ||
C<TEXT(beginproblem())>, C<<Context()->texStrings;>> and C<<Context()->normalStrings;>>. | ||
Any C<ANS> commands are commented out. | ||
The C<loadMacros> command is parsed, the C<PGML.pl> is included and C<MathObjects.pl> | ||
is removed (because it is loaded by C<PGML.pl>) and C<PGcourse.pl> is added to the | ||
end of the list. | ||
Note: many of the features are converted correctly, but often there will be errors | ||
after the conversion. Generally after using this script, the PGML style answers | ||
will need to have their corresponding variable added. | ||
=head2 OPTIONS | ||
The option C<-b> or C<--backup> will create a C<.bak> file with the original code and | ||
replace the current file with the converted code. | ||
The option C<-s xyz> or C<--suffix=xyz> will convert the code and write the results in a file | ||
with the given suffix C<xyz> appended to the file name. If this is not given | ||
C<pgml> is used. If the C<-b> flag is used, this option will be ignored. | ||
=cut | ||
|
||
use strict; | ||
use warnings; | ||
use experimental 'signatures'; | ||
|
||
use Mojo::File qw(curfile); | ||
use Getopt::Long; | ||
|
||
use lib curfile->dirname->dirname . '/lib'; | ||
|
||
use WeBWorK::PG::ConvertToPGML qw(convertToPGML); | ||
|
||
my $backup = 0; | ||
my $verbose = 0; | ||
my $suffix = 'pgml'; | ||
|
||
GetOptions( | ||
"b|backup" => \$backup, | ||
"s|suffix=s" => \$suffix, | ||
"v|verbose" => \$verbose, | ||
); | ||
|
||
die 'arguments must have a list of pg files' unless @ARGV > 0; | ||
convertFile($_) for (grep { $_ =~ /\.pg$/ } @ARGV); | ||
|
||
sub convertFile ($filename) { | ||
my $path = Mojo::File->new($filename); | ||
die "The file: $filename does not exist or is not readable" unless -r $path; | ||
|
||
my $pg_source = $path->slurp; | ||
my $converted_source = convertToPGML($pg_source); | ||
|
||
# copy the original file to a backup and then write the file | ||
my $new_path = $backup ? $path : Mojo::File->new($filename =~ s/\.pg/.$suffix/r); | ||
my $backup_file = $filename =~ s/\.pg$/.pg.bak/r; | ||
$path->copy_to($backup_file) if $backup; | ||
$new_path->spurt($converted_source); | ||
print "Writing converted file to $new_path\n" if $verbose; | ||
print "Backing up original file to $backup_file\n" if $verbose && $backup; | ||
} | ||
|
||
1; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
#!/bin/bash | ||
|
||
function print_help_exit | ||
{ | ||
printf "Usage: %s [options]\n" $(basename $0) >&2 | ||
printf " Update the pg.pot and language .po files with translation strings from the code.\n" >&2 | ||
printf " options:\n" >&2 | ||
printf " -p|--po-update Update po files as well. By default only the pg.pot file is updated.\n" >&2 | ||
printf " -l|--langauge Update the only given language in addition to updating the pg.pot file.\n" >&2 | ||
printf " -h|--help Show this help.\n" >&2 | ||
exit 1 | ||
} | ||
|
||
TEMP=$(getopt -a -o pl:h -l po-update,language:,help -n "$(basename $0)" -- "$@") | ||
|
||
eval set -- "$TEMP" | ||
|
||
UPDATE_PO=false | ||
LANGUAGE="" | ||
|
||
while [ ! "$1" = "--" ] | ||
do | ||
case "$1" in | ||
-p|--po-update) | ||
UPDATE_PO=true | ||
shift 1 | ||
;; | ||
-l|--language) | ||
LANGUAGE=$2 | ||
shift 2 | ||
;; | ||
-h|--help) | ||
print_help_exit | ||
;; | ||
*) | ||
echo "Internal error!" | ||
exit 1 | ||
;; | ||
esac | ||
done | ||
|
||
if [ -z "$PG_ROOT" ]; then | ||
echo >&2 "You need to set the PG_ROOT environment variable. Aborting." | ||
exit 1 | ||
fi | ||
|
||
command -v xgettext.pl >/dev/null 2>&1 || { | ||
echo >&2 "xgettext.pl needs to be installed. It is inlcuded in the perl package Locale::Maketext::Extract. Aborting."; | ||
exit 1; | ||
} | ||
|
||
LOCDIR=$PG_ROOT/lib/WeBWorK/PG/Localize | ||
|
||
cd $LOCDIR | ||
|
||
echo "Updating $LOCDIR/pg.pot" | ||
|
||
xgettext.pl -o pg.pot -D $PG_ROOT/lib -D $PG_ROOT/macros | ||
|
||
if $UPDATE_PO; then | ||
find $LOCDIR -name '*.po' -exec bash -c "echo \"Updating {}\"; msgmerge -qUN {} pg.pot" \; | ||
elif [[ $LANGUAGE != "" && -e "$LANGUAGE.po" ]]; then | ||
echo "Updating $LOCDIR/$LANGUAGE.po" | ||
msgmerge -qUN $LANGUAGE.po pg.pot | ||
fi |
Oops, something went wrong.