mirror of
https://github.com/gohugoio/hugo.git
synced 2026-08-24 23:38:53 +00:00
c4fb61d9df
When running `hugo convert` with `--output`, copy the content tree first so non-content bundle resources are kept in the destination, then overwrite converted content files. Also avoid recursive self-copy when the output path points inside the content tree by skipping output directories during copy. Fixes #4621
59 lines
1.3 KiB
Plaintext
59 lines
1.3 KiB
Plaintext
# Test the convert commands.
|
|
|
|
hugo convert -h
|
|
stdout 'Convert front matter to another format'
|
|
hugo convert toJSON -h
|
|
stdout 'to use JSON for the front matter'
|
|
hugo convert toTOML -h
|
|
stdout 'to use TOML for the front matter'
|
|
hugo convert toYAML -h
|
|
stdout 'to use YAML for the front matter'
|
|
|
|
hugo convert toJSON -o myjsoncontent
|
|
stdout 'processing 4 content files'
|
|
grep '^{' myjsoncontent/content/mytoml.md
|
|
grep '^{' myjsoncontent/content/myjson.md
|
|
grep '^{' myjsoncontent/content/myyaml.md
|
|
grep '^{' myjsoncontent/content/bundle/index.md
|
|
exists myjsoncontent/content/bundle/data.txt
|
|
exists myjsoncontent/content/bundle/nested/asset.dat
|
|
hugo convert toYAML -o myyamlcontent
|
|
stdout 'processing 4 content files'
|
|
exists myyamlcontent/content/bundle/data.txt
|
|
exists myyamlcontent/content/bundle/nested/asset.dat
|
|
hugo convert toTOML -o mytomlcontent
|
|
stdout 'processing 4 content files'
|
|
exists mytomlcontent/content/bundle/data.txt
|
|
exists mytomlcontent/content/bundle/nested/asset.dat
|
|
|
|
|
|
|
|
|
|
|
|
-- hugo.toml --
|
|
baseURL = "http://example.org/"
|
|
-- content/mytoml.md --
|
|
+++
|
|
title = "TOML"
|
|
+++
|
|
TOML content
|
|
-- content/myjson.md --
|
|
{
|
|
"title": "JSON"
|
|
}
|
|
JSON content
|
|
-- content/myyaml.md --
|
|
---
|
|
title: YAML
|
|
---
|
|
YAML content
|
|
-- content/bundle/index.md --
|
|
---
|
|
title: Bundle
|
|
---
|
|
Bundle content
|
|
-- content/bundle/data.txt --
|
|
bundle resource
|
|
-- content/bundle/nested/asset.dat --
|
|
nested resource
|