Skip to content

Commit

Permalink
fixed site images and meta description
Browse files Browse the repository at this point in the history
  • Loading branch information
markolalovic committed Jun 6, 2024
1 parent b7139df commit d648788
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 11 deletions.
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

## responsesR: simulate Likert item responses in R <img src="./man/figures/logo.png" align="right" height="160" style="float:right; height:160px;"/>
## responsesR: simulate Likert item responses in R <img src="./man/figures/logo.png" alt="Package logo" align="right" height="160" style="float:right; height:160px;"/>

<!-- badges: start -->

Expand Down Expand Up @@ -110,7 +110,7 @@ p
<p>
</p>

<img src="./man/figures/articles/courses_grouped_bar_chart.svg" width="100%" alt="Courses grouped bar chart" />
<img src="./man/figures/articles/courses_grouped_bar_chart.svg" alt="Courses grouped bar chart" width="100%" />

For a pre- and post comparison, suppose that the participants completed
the survey both before and after taking the course. And suppose that
Expand Down Expand Up @@ -213,7 +213,7 @@ p
<p>
</p>

<img src="./man/figures/articles/courses_stacked_bar_chart.svg" width="100%" alt="Courses stacked bar chart" />
<img src="./man/figures/articles/courses_stacked_bar_chart.svg" alt="Courses stacked bar chart" width="100%" />

### Replicating survey data

Expand Down Expand Up @@ -475,7 +475,7 @@ new_items_F <- get_responses(n = nrow(items_F),
To compare the results, we can plot the correlation matrix with bar
charts on the diagonal:

<img src="./man/figures/articles/agree_items_correlations_comparison.svg" width="100%" alt="Agreeableness items correlations comparison" />
<img src="./man/figures/articles/agree_items_correlations_comparison.svg" alt="Agreeableness items correlations comparison" width="100%" />

The next step would be to create agreeableness scale scores for both
groups of participants, by taking the average of these 5 items and
Expand Down Expand Up @@ -520,7 +520,7 @@ plot_grid(p1, p2, nrow = 2)
<p>
</p>

<img src="./man/figures/articles/agreeableness_grouped_boxplot.svg" width="100%" alt="Agreeableness grouped boxplot" />
<img src="./man/figures/articles/agreeableness_grouped_boxplot.svg" alt="Agreeableness items grouped boxplot" width="100%" />

## Dependency statement

Expand Down
10 changes: 5 additions & 5 deletions docs/index.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion docs/pkgdown.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ articles:
replicating_survey_data: replicating_survey_data.html
responsesR: responsesR.html
simulating_survey_data: simulating_survey_data.html
last_built: 2024-06-06T09:53Z
last_built: 2024-06-06T10:37Z
urls:
reference: https://markolalovic.github.io/responsesR/reference
article: https://markolalovic.github.io/responsesR/articles
Expand Down
19 changes: 19 additions & 0 deletions fix_site.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
- Fixes paths in html docs files generated by pkgdown.
- Adds alt text to images in README.md file.
- Adds `/docs/.nojekyll` for githubpages.
- Adds meta description to index.html
'''

import os
Expand All @@ -18,6 +19,22 @@ def replace(str_wrong, str_right, pathfilename):
for i, line in enumerate(fileinput.input(pathfilename, inplace=1)):
sys.stdout.write(line.replace(str_wrong, str_right))

def add_meta():
filename = './docs/index.html'
meta_line = '<meta name="description" content="Generate Likert-scale responses in R. responsesR provides an easy framework to simulate survey data, specifically Likert items." />'

with open(filename, 'r') as f:
in_file = f.readlines()

out_file = []
for line in in_file:
out_file.append(line)
if '</title>' in line:
out_file.append(meta_line)

with open(filename, 'w') as f:
f.writelines(out_file)

if __name__ == '__main__':
replace('"../../reference', '"../reference', './docs/articles/introduction_to_responsesR.html')
replace('<img src="reference', '<img src="../reference', './docs/articles/replicating_survey_data.html')
Expand All @@ -43,4 +60,6 @@ def replace(str_wrong, str_right, pathfilename):
# add .nojekyll to docs for githubpages
os.system("touch ./docs/.nojekyll")

add_meta()

print("Done.")

0 comments on commit d648788

Please sign in to comment.