-
Notifications
You must be signed in to change notification settings - Fork 0
new script to create some content #15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
andywis
wants to merge
1
commit into
master
Choose a base branch
from
create-default-content
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,105 @@ | ||
|
|
||
|
|
||
| THEME_NAME="simpletheme" | ||
|
|
||
| # Create a minimal config file. | ||
| if [ ! -f config.json ]; then | ||
| echo "CREATING config.json" | ||
| cat <<EOF > config.json | ||
| { | ||
| "theme": "$THEME_NAME" | ||
| } | ||
| EOF | ||
| fi | ||
|
|
||
| # Create a minimal content file, if ./content is empty. | ||
| if [ -z "$(ls content)" ] ; then | ||
| echo "CREATING an example content file: content/example_content.html" | ||
| creation_date=$(date +'%Y-%m-%d %H:%M') | ||
| cat << EOF > content/example_content.html | ||
| <html> | ||
| <head> | ||
| <title>A title</title> | ||
| <meta name="date" content="${creation_date}" /> | ||
| </head> | ||
| <body> | ||
| <p>this is example content</p> | ||
| <p> | ||
| The source material used to create whole web pages is | ||
| stored in the "content/" folder, just like this page. | ||
| </p> | ||
| <p> | ||
| A page must have a <title> tag. Other page metadata | ||
| can be specified using <meta> tags. See the source | ||
| of this page for examples. Valid metadata tags are: | ||
| date, summary, tags, categories and template (to specify | ||
| an alternative template) | ||
| </p> | ||
| <p> | ||
| Note There must be at least one HTML tag inside the <body> | ||
| section. A trailing <br> will be enough. | ||
| </p> | ||
| <p> | ||
| "pages" in the "content/" folder (and "generated pages" | ||
| in "_meta"/) are then merged with the appropriate theme | ||
| template to generate the resultant HTML pages, which are | ||
| saved to the "output/" folder. The default theme is | ||
| specified in the 'config.json' file. | ||
| </p> | ||
| <p> | ||
| </p> | ||
| For more information, see the | ||
| <a href="https://github.com/andywis/static-content-generator" | ||
| target="_blank">documentation in the GitHub Repository.</a> | ||
| </body> | ||
| </html> | ||
| EOF | ||
| fi | ||
|
|
||
|
|
||
| # Make the folder structure for the theme | ||
| mkdir -p themes/$THEME_NAME/static | ||
| mkdir -p themes/$THEME_NAME/templates | ||
|
|
||
|
|
||
| if [ ! -f themes/$THEME_NAME/static/style.css ]; then | ||
| echo "CREATING default CSS file in themes/$THEME_NAME/templates/" | ||
| cat <<EOF > themes/$THEME_NAME/static/style.css | ||
| html { | ||
| font-family: Arial, Helvetica, sans-serif; | ||
| } | ||
| EOF | ||
| fi | ||
|
|
||
| if [ ! -f themes/$THEME_NAME/templates/common.thtml ]; then | ||
| echo "CREATING default theme files in themes/$THEME_NAME/templates/" | ||
| cat <<EOF > themes/$THEME_NAME/templates/common.thtml | ||
| <DOCTYPE HTML> | ||
| <html> | ||
| <head> | ||
| <title>{{ title }}</title> | ||
| <link rel="stylesheet" href="{{ theme_path }}style.css" media="all"> | ||
| </head> | ||
| <body> | ||
| {{ article }} | ||
|
|
||
| <hr> | ||
| <div> | ||
| <a href="{{ back_path }}">Link back to the homepage</a> | ||
| </div> | ||
| <div> | ||
| Tags: {{ tags_html }} | ||
| </div> | ||
| <div> | ||
| Categories {{ categories_html }} | ||
| </div> | ||
| </body> | ||
| </html> | ||
| EOF | ||
| fi | ||
|
|
||
| if [ ! -f themes/$THEME_NAME/templates/navigation.thtml ]; then | ||
| echo "COPYING common.thtml to create navigation.thtml theme file." | ||
| cp themes/$THEME_NAME/templates/common.thtml themes/$THEME_NAME/templates/navigation.thtml | ||
| fi | ||
|
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This script duplicates the script at create_sample_content.sh. We don't want 2 that do the same thing. Merge them
/!\ No shebang line. blank lines at top of file.