Skip to content
This repository has been archived by the owner on Jul 28, 2023. It is now read-only.

Commit

Permalink
Rename helpers
Browse files Browse the repository at this point in the history
  • Loading branch information
ockham committed Mar 2, 2023
1 parent acaefa2 commit 2d886ff
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions src/directives/attributes/wp-show.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@

function process_wp_show( $tags, $context ) {
if ( ! $tags->is_tag_closer() ) { // TODO: Exclude void and self-closing!
set_bookmark_for_tag( $tags, 'wp-show' );
set_bookmark_for_directive( $tags, 'wp-show' );
return;
}

$end = 'wp-show-closer';
$tags->set_bookmark( 'wp-show-closer' );
$start = seek_bookmark_for_tag( $tags, 'wp-show' );
$start = seek_bookmark_for_directive( $tags, 'wp-show' );

$value = $tags->get_attribute( 'wp-show' );
if ( null !== $value ) {
Expand Down
16 changes: 8 additions & 8 deletions src/directives/utils.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,24 +50,24 @@ function set_style( $style, $name, $value ) {
return implode( ';', $style_assignments );
}

function count_bookmarks_for_tag( $tags, $tag ) {
function count_bookmarks_for_directive( $tags, $directive ) {
$i = 0;
while ( $tags->has_bookmark( $tag . '-' . $i ) ) {
while ( $tags->has_bookmark( $directive . '-' . $i ) ) {
++$i;
}
return $i;
}

function set_bookmark_for_tag( $tags, $tag ) {
$i = count_bookmarks_for_tag( $tags, $tag );
$bookmark = $tag . '-' . $i;
function set_bookmark_for_directive( $tags, $directive ) {
$i = count_bookmarks_for_directive( $tags, $directive );
$bookmark = $directive . '-' . $i;
$tags->set_bookmark( $bookmark );
return $bookmark;
}

function seek_bookmark_for_tag( $tags, $tag ) {
$i = count_bookmarks_for_tag( $tags, $tag ) - 1;
$bookmark = $tag . '-' . $i;
function seek_bookmark_for_directive( $tags, $directive ) {
$i = count_bookmarks_for_directive( $tags, $directive ) - 1;
$bookmark = $directive . '-' . $i;
$tags->seek( $bookmark );
return $bookmark;
}

0 comments on commit 2d886ff

Please sign in to comment.