"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "tpl/strings/strings.go" between
hugo-0.80.0.tar.gz and hugo-0.81.0.tar.gz

About: Hugo is a static site generator that takes a source directory of Markdown files and templates and uses these as input to create a complete website (written in Go).

strings.go  (hugo-0.80.0):strings.go  (hugo-0.81.0)
skipping to change at line 19 skipping to change at line 19
// distributed under the License is distributed on an "AS IS" BASIS, // distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
// Package strings provides template functions for manipulating strings. // Package strings provides template functions for manipulating strings.
package strings package strings
import ( import (
"errors" "errors"
"fmt"
"html/template" "html/template"
"strings" "strings"
"unicode/utf8" "unicode/utf8"
"github.com/gohugoio/hugo/deps" "github.com/gohugoio/hugo/deps"
"github.com/gohugoio/hugo/helpers" "github.com/gohugoio/hugo/helpers"
_errors "github.com/pkg/errors" _errors "github.com/pkg/errors"
"github.com/spf13/cast" "github.com/spf13/cast"
) )
skipping to change at line 325 skipping to change at line 324
if start < 0 { if start < 0 {
start += rlen start += rlen
} }
// start was originally negative beyond rlen // start was originally negative beyond rlen
if start < 0 { if start < 0 {
start = 0 start = 0
} }
if start > rlen-1 { if start > rlen-1 {
return "", fmt.Errorf("start position out of bounds for %d-byte s tring", rlen) return "", nil
} }
end := rlen end := rlen
switch { switch {
case length == 0: case length == 0:
return "", nil return "", nil
case length < 0: case length < 0:
end += length end += length
case length > 0: case length > 0:
end = start + length end = start + length
} }
if start >= end { if start >= end {
return "", fmt.Errorf("calculated start position greater than end position: %d > %d", start, end) return "", nil
} }
if end < 0 { if end < 0 {
return "", nil return "", nil
} }
if end > rlen { if end > rlen {
end = rlen end = rlen
} }
 End of changes. 3 change blocks. 
3 lines changed or deleted 2 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)