whitespace

package
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 21, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Copyright © 2022 david amick git@davidamick.com

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright © 2022 david amick git@davidamick.com

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PreserveComments

func PreserveComments(oldContent, newContent []byte) ([]byte, error)

PreserveComments attempts to preserve the spacing before all comments walk matching nodes, and for each that has (Head|Line|Foot)Comment != "",

overwrite the newContent spacing and comment with the oldContent spacing and comment.

func PreserveEmptyLines

func PreserveEmptyLines(oldContent, newContent []byte) ([]byte, error)

PreserveEmptyLines attempts to re-add to newContent any empty lines

that were there in oldContent.

current algorithm simply associates each empty line with the yaml node on the line below it if there is one. it then re-adds them to newContent above the matching yaml node. it also re-adds empty line(s) at the end of the file if there were any. this may not always have the desired effect, but should in many cases.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL