Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M3P2 HTML Generator
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
12
Issues
12
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
M3P2
M3P2 HTML Generator
Commits
79e9b1d5
Commit
79e9b1d5
authored
Sep 30, 2020
by
Administrator
💬
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
chore: review lessons
parent
94e01286
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
13 deletions
+12
-13
m3-p2.php
user/plugins/m3-p2/m3-p2.php
+9
-11
README.md
user/plugins/m3-p2/pages/README.md
+3
-2
No files found.
user/plugins/m3-p2/m3-p2.php
View file @
79e9b1d5
...
...
@@ -10,6 +10,7 @@ use Symfony\Component\EventDispatcher\Event;
/**
* Features:
* - /sync Cheap git-sync (did not knew about it at the time)
* - /lessons/<lesson-slug>
*
* Class M3P2Plugin
* @package Grav\Plugin
...
...
@@ -168,10 +169,6 @@ class M3P2Plugin extends Plugin
$translation
=
new
Page
();
$translation
->
init
(
new
\SplFileInfo
(
$translation_path
),
$language
.
'.md'
);
// var_dump($route);
// die(var_dump($route));
// die(var_dump($translation));
if
(
$language
==
$current_language
)
{
array_unshift
(
$translations
,
$translation
);
}
else
{
...
...
@@ -179,8 +176,6 @@ class M3P2Plugin extends Plugin
}
}
// die(var_dump($translations));
return
$translations
;
}
...
...
@@ -238,15 +233,18 @@ class M3P2Plugin extends Plugin
$lesson_slug
=
$uri
->
paths
(
1
);
// VERY inefficient : TODO: cache this
// $target_pages = $pages->all()->filter(function ($p) use ($lesson_slug) {
$target_pages
=
array_filter
(
$pages
->
instances
(),
function
(
Page
$p
)
use
(
$lesson_slug
)
{
$
h
=
$p
->
header
();
if
(
!
isset
(
$
h
->
pedagogic_paths
)
||
empty
(
$h
->
pedagogic_path
s
))
{
$
page_config
=
$p
->
header
();
if
(
!
isset
(
$
page_config
->
lessons
)
||
empty
(
$page_config
->
lesson
s
))
{
return
false
;
}
foreach
(
$h
->
pedagogic_paths
as
$lesson
)
{
foreach
(
$page_config
->
lessons
as
$lesson
)
{
// print("Checking lesson $lesson"."<br>\n");
// if ($lesson_slug == $lesson) {
if
(
$lesson_slug
==
$lesson
[
'slug'
])
{
return
true
;
// yay, this page is part of the lesson
}
...
...
@@ -267,8 +265,8 @@ class M3P2Plugin extends Plugin
};
// We're assuming the config exists (it should)
$ma
=
array_filter
(
$ha
->
pedagogic_path
s
,
$fdp
)[
0
];
$mb
=
array_filter
(
$hb
->
pedagogic_path
s
,
$fdp
)[
0
];
$ma
=
array_filter
(
$ha
->
lesson
s
,
$fdp
)[
0
];
$mb
=
array_filter
(
$hb
->
lesson
s
,
$fdp
)[
0
];
if
(
isset
(
$ma
[
'level'
]))
{
$la
=
floor
(
$ma
[
'level'
]);
...
...
user/plugins/m3-p2/pages/README.md
View file @
79e9b1d5
> Looks like useless empty files in here!
We
do use them, though! See
`
m3-p2.php`
.
We
actually use them! See
`../
m3-p2.php`
.
They're a convenient way of leveraging Grav's page system
to make our custom pages.
\ No newline at end of file
to make our custom pages.
We might override some Twig blocks in there, later on.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment