Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
chunker
Manage
Activity
Members
Labels
Plan
Wiki
Custom issue tracker
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
project
chunker
Commits
0c7c5a87
Commit
0c7c5a87
authored
9 months ago
by
Eric Smith
Browse files
Options
Downloads
Plain Diff
Merge branch '3473697-add--.gitlab-ci.yml' into '2.x'
Issue
#3473697
: Add .gitlab-ci.yml file from template See merge request
!2
parents
2ce706a4
be141051
No related branches found
No related tags found
No related merge requests found
Pipeline
#280505
passed with warnings
9 months ago
Stage: build
Stage: validate
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
.gitlab-ci.yml
+32
-0
32 additions, 0 deletions
.gitlab-ci.yml
src/Plugin/Field/FieldFormatter/ChunkerFormatter.php
+5
-5
5 additions, 5 deletions
src/Plugin/Field/FieldFormatter/ChunkerFormatter.php
with
37 additions
and
5 deletions
.gitlab-ci.yml
0 → 100644
+
32
−
0
View file @
0c7c5a87
################
# GitLabCI template for Drupal projects.
#
# This template is designed to give any Contrib maintainer everything they need to test, without requiring modification.
# It is also designed to keep up to date with Core Development automatically through the use of include files that can be centrally maintained.
# As long as you include the project, ref and three files below, any future updates added by the Drupal Association will be used in your
# pipelines automatically. However, you can modify this template if you have additional needs for your project.
# The full documentation is on https://project.pages.drupalcode.org/gitlab_templates/
################
# For information on alternative values for 'ref' see https://project.pages.drupalcode.org/gitlab_templates/info/templates-version/
# To test a Drupal 7 project, change the first include filename from .main.yml to .main-d7.yml
include
:
-
project
:
$_GITLAB_TEMPLATES_REPO
ref
:
$_GITLAB_TEMPLATES_REF
file
:
-
"
/includes/include.drupalci.main.yml"
-
"
/includes/include.drupalci.variables.yml"
-
"
/includes/include.drupalci.workflows.yml"
################
# Pipeline configuration variables are defined with default values and descriptions in the file
# https://git.drupalcode.org/project/gitlab_templates/-/blob/main/includes/include.drupalci.variables.yml
# Uncomment the lines below if you want to override any of the variables. The following is just an example.
################
# variables:
# SKIP_ESLINT: '1'
# OPT_IN_TEST_NEXT_MAJOR: '1'
# _CURL_TEMPLATES_REF: 'main'
variables
:
_CSPELL_WORDS
:
'
dman,
Multipage'
This diff is collapsed.
Click to expand it.
src/Plugin/Field/FieldFormatter/ChunkerFormatter.php
+
5
−
5
View file @
0c7c5a87
...
@@ -2,10 +2,10 @@
...
@@ -2,10 +2,10 @@
namespace
Drupal\chunker\Plugin\Field\FieldFormatter
;
namespace
Drupal\chunker\Plugin\Field\FieldFormatter
;
use
Drupal\Component\Utility\Html
;
use
Drupal\Core\Field\FormatterBase
;
use
Drupal\Core\Field\FormatterBase
;
use
Drupal\Core\Field\FieldItemListInterface
;
use
Drupal\Core\Field\FieldItemListInterface
;
use
Drupal\Core\Form\FormStateInterface
;
use
Drupal\Core\Form\FormStateInterface
;
use
Drupal\Component\Utility\Html
;
/**
/**
* Plugin implementation of the 'Chunker' formatter.
* Plugin implementation of the 'Chunker' formatter.
...
@@ -145,7 +145,7 @@ class ChunkerFormatter extends FormatterBase {
...
@@ -145,7 +145,7 @@ class ChunkerFormatter extends FormatterBase {
$dom
=
Html
::
load
(
$text
);
$dom
=
Html
::
load
(
$text
);
// Html load wraps text in <body>, so lets pull out the body element.
// Html load wraps text in <body>, so lets pull out the body element.
$bodies
=
$dom
->
getElementsByTagName
(
'body'
);
$bodies
=
$dom
->
getElementsByTagName
(
'body'
);
/* @var
$scope
DOMElement */
/*
*
@var
\
DOMElement
$scope
*/
$scope
=
$bodies
->
item
(
0
);
$scope
=
$bodies
->
item
(
0
);
// To get it all sorted, recursively re-run the process for several depths.
// To get it all sorted, recursively re-run the process for several depths.
...
@@ -158,7 +158,7 @@ class ChunkerFormatter extends FormatterBase {
...
@@ -158,7 +158,7 @@ class ChunkerFormatter extends FormatterBase {
}
}
/**
/**
* Create
div-based
sections around document contents based on headings, e.g. h2s.
* Create sections around document contents based on headings, e.g. h2s.
*/
*/
public
function
enwrap
(
$scope
,
$start_level
,
array
$settings
)
{
public
function
enwrap
(
$scope
,
$start_level
,
array
$settings
)
{
...
@@ -179,7 +179,7 @@ class ChunkerFormatter extends FormatterBase {
...
@@ -179,7 +179,7 @@ class ChunkerFormatter extends FormatterBase {
$current_section_content
=
$scope
;
$current_section_content
=
$scope
;
// Jiggling the domnodelist in realtime confuses PHP tragically.
// Jiggling the domnodelist in realtime confuses PHP tragically.
// Enumerate the childnodes into a simpler array before moving them around
;
.
// Enumerate the child
nodes into a simpler array before moving them around.
$child_nodes
=
[];
$child_nodes
=
[];
foreach
(
$scope
->
childNodes
as
$item
)
{
foreach
(
$scope
->
childNodes
as
$item
)
{
$child_nodes
[]
=
$item
;
$child_nodes
[]
=
$item
;
...
@@ -238,7 +238,7 @@ class ChunkerFormatter extends FormatterBase {
...
@@ -238,7 +238,7 @@ class ChunkerFormatter extends FormatterBase {
if
(
!
empty
(
$settings
[
'heading_class'
]))
{
if
(
!
empty
(
$settings
[
'heading_class'
]))
{
$heading_class
=
implode
(
' '
,
[
$heading_class
=
implode
(
' '
,
[
$settings
[
'heading_class'
],
$settings
[
'heading_class'
],
$item
->
getAttribute
(
'class'
)
$item
->
getAttribute
(
'class'
)
,
]);
]);
$item
->
setAttribute
(
'class'
,
$heading_class
);
$item
->
setAttribute
(
'class'
,
$heading_class
);
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment