Easy way to cite academic references in the README.md of a github-repo - github

I was just wondering if there is any easy way that I can use a .bib-file to create academic references in the README of a github site.
In rmarkdown I'm used to just do the following in the text:
#test2010
and if I have specified the correct bibtex-file in the yaml-header it works perfectly.
Is there anything similar in "normal" github markdown?

Bibliographies are not supported in GitHub Flavored Markdown(GFM). The workaround is producing GFM from R Markdown.
Step: create README.Rmd and bibliography.bib and knit README.Rmd.
README.Rmd:
---
output:
md_document:
variant: markdown_github
bibliography: bibliography.bib
---
[#xie2018]
bibliography.bib:
#Book{xie2018,
title = {R Markdown: The Definitive Guide},
author = {Yihui Xie and J.J. Allaire and Garrett Grolemund},
publisher = {Chapman and Hall/CRC},
address = {Boca Raton, Florida},
year = {2018},
note = {ISBN 9781138359338},
url = {https://bookdown.org/yihui/rmarkdown},
}
The output README.md:
(Xie, Allaire, and Grolemund 2018)
<div id="refs" class="references csl-bib-body hanging-indent">
<div id="ref-xie2018" class="csl-entry">
Xie, Yihui, J. J. Allaire, and Garrett Grolemund. 2018. *R Markdown: The
Definitive Guide*. Boca Raton, Florida: Chapman; Hall/CRC.
<https://bookdown.org/yihui/rmarkdown>.
</div>
</div>

Related

Can I use attr: in description field of metadata in setup.cfg?

I try to use attr: in description but PyPi dispays attr: round_utils.__doc__ instead of value of that expression.
Docs says I cannot use attr: in description. Look at the Metadata table (link below):
https://setuptools.readthedocs.io/en/latest/userguide/declarative_config.html#metadata
But I had done like here: https://github.com/zifter/numeral-system-py, because I saw the package description works in PyPi https://pypi.org/project/numeral-system-py/.
Attaching my files and links:
setup.cfg
[metadata]
name = round-utils
version = 1.0.4
author = Marchenko Ilya
author_email = mrmar333#yandex.ru
home-page = https://github.com/IliyaZinoviev/round-utils.git
description = attr: round_utils.__doc__
license = MIT
license-file = LICENSE
platform = any
keywords = round, utils, number
classifiers =
Intended Audience :: Developers
License :: OSI Approved :: MIT License
Programming Language :: Python
Programming Language :: Python :: 3.8
Operating System :: OS Independent
[options]
zip_safe = false
include_package_data = true
python_requires = >= 3.8
package_dir =
round_utils=source/round_utils
tests=source/tests
packages =
round_utils
test_suite = tests
setup_requires =
setuptools >=30.3.0 # minimal version for `setup.cfg`
[bdist_wheel]
universal = true
[check]
metadata = true
strict = true
[sdist]
formats = gztar
round_utils.__init__py
"""Package for rounding functions"""
from .round import round_up, round_down
__all__ = [
'round_up',
'round_down'
]
PyPi link: https://test.pypi.org/project/round-utils/
Github repo: https://github.com/IliyaZinoviev/round-utils
No, you can't use attr: for the description configuration value of setuptools' setup.cfg. As of setuptools 51.1.0 (today's newest version), it is not supported. The project you linked to as a reference has not seen a release since they changed to (incorrectly) using attr: for their description, and as can be seen here it does not seem to work (as expected).

Linguist Documentation not working in github?

I recently studied about .gitattributes specifically linguist-documentation and this problem But it does not work for me in this repo. It still counts HTML, CSS, and JavaScript files. Any suggestion to solve this ?
My .gitattributes File
artcpp/docs/** linguist-documentation
artjava/docs/** linguist-documentation
Thanks.
That .gitattributes works fine. The issue is that you have a lot of other HTML files under artjava/target/site/apidocs/. See the full Linguist breakdown below.
$ github-linguist --breakdown
75.45% HTML
11.08% C++
4.30% Java
3.91% JavaScript
2.93% Go
2.34% CSS
0.01% Shell
C++:
Fontcvt/CLI/converter/converter.hpp
Fontcvt/CLI/main/main.cpp
artcpp/example/example_1.cpp
artcpp/example/example_2.cpp
artcpp/example/example_3.cpp
artcpp/example/example_4.cpp
artcpp/include/art.hpp
artcpp/include/art/anixt/anixt_config.hpp
artcpp/include/art/anixt/anixt_font.hpp
artcpp/include/art/anixt/anixt_style.hpp
artcpp/include/art/anixt/basic_anixt.hpp
artcpp/include/art/coartl/coartl.hpp
artcpp/include/art/runeape/basic_runeape.hpp
artcpp/include/art/runeape/runeape_config.hpp
artcpp/include/art/runeape/runeape_gallery.hpp
artcpp/include/art/runeape/runeape_style.hpp
Go:
artgo/anixt/anixt.go
artgo/anixt/config.go
artgo/anixt/font.go
artgo/anixt/style.go
artgo/coartl/coartl.go
artgo/runeape/config.go
artgo/runeape/gallery.go
artgo/runeape/runeape.go
artgo/runeape/style.go
Shell:
artjava/package.sh
Java:
artjava/src/main/java/com/github/srilakshmikanthanp/art/anixt/Anixt.java
artjava/src/main/java/com/github/srilakshmikanthanp/art/anixt/Config.java
artjava/src/main/java/com/github/srilakshmikanthanp/art/anixt/FontBase.java
artjava/src/main/java/com/github/srilakshmikanthanp/art/anixt/JsonFont.java
artjava/src/main/java/com/github/srilakshmikanthanp/art/anixt/KerningStyle.java
artjava/src/main/java/com/github/srilakshmikanthanp/art/anixt/SmushedStyle.java
artjava/src/main/java/com/github/srilakshmikanthanp/art/anixt/StyleBase.java
artjava/src/main/java/com/github/srilakshmikanthanp/art/anixt/StyleUtil.java
artjava/src/main/java/com/github/srilakshmikanthanp/art/anixt/UntouchedStyle.java
artjava/src/main/java/com/github/srilakshmikanthanp/art/coartl/Coartl.java
artjava/src/main/java/com/github/srilakshmikanthanp/art/runeape/Config.java
artjava/src/main/java/com/github/srilakshmikanthanp/art/runeape/GalleryBase.java
artjava/src/main/java/com/github/srilakshmikanthanp/art/runeape/JsonGallery.java
artjava/src/main/java/com/github/srilakshmikanthanp/art/runeape/KerningStyle.java
artjava/src/main/java/com/github/srilakshmikanthanp/art/runeape/Runeape.java
artjava/src/main/java/com/github/srilakshmikanthanp/art/runeape/StyleBase.java
artjava/src/main/java/com/github/srilakshmikanthanp/art/runeape/StyleUtil.java
artjava/src/main/java/com/github/srilakshmikanthanp/art/runeape/UntouchedStyle.java
artjava/src/test/java/com/github/srilakshmikanthanp/art/JsonFontTest.java
artjava/src/test/java/com/github/srilakshmikanthanp/art/JsonGalleryTest.java
artjava/src/test/java/com/github/srilakshmikanthanp/art/KerningAnixtStyleTest.java
artjava/src/test/java/com/github/srilakshmikanthanp/art/KerningRuneapeTest.java
artjava/src/test/java/com/github/srilakshmikanthanp/art/SmushingAnixtStyleTest.java
artjava/src/test/java/com/github/srilakshmikanthanp/art/UntouchedAnixtStyleTest.java
artjava/src/test/java/com/github/srilakshmikanthanp/art/UntouchedRuneapeStyleTest.java
HTML:
artjava/target/site/apidocs/allclasses-index.html
artjava/target/site/apidocs/allclasses.html
artjava/target/site/apidocs/allpackages-index.html
artjava/target/site/apidocs/com/github/srilakshmikanthanp/art/anixt/Anixt.html
artjava/target/site/apidocs/com/github/srilakshmikanthanp/art/anixt/Config.ShrinkLevel.html
artjava/target/site/apidocs/com/github/srilakshmikanthanp/art/anixt/Config.html
artjava/target/site/apidocs/com/github/srilakshmikanthanp/art/anixt/FontBase.html
artjava/target/site/apidocs/com/github/srilakshmikanthanp/art/anixt/JsonFont.html
artjava/target/site/apidocs/com/github/srilakshmikanthanp/art/anixt/KerningStyle.html
artjava/target/site/apidocs/com/github/srilakshmikanthanp/art/anixt/SmushedStyle.html
artjava/target/site/apidocs/com/github/srilakshmikanthanp/art/anixt/StyleBase.html
artjava/target/site/apidocs/com/github/srilakshmikanthanp/art/anixt/StyleUtil.html
artjava/target/site/apidocs/com/github/srilakshmikanthanp/art/anixt/UntouchedStyle.html
artjava/target/site/apidocs/com/github/srilakshmikanthanp/art/anixt/class-use/Anixt.html
artjava/target/site/apidocs/com/github/srilakshmikanthanp/art/anixt/class-use/Config.ShrinkLevel.html
artjava/target/site/apidocs/com/github/srilakshmikanthanp/art/anixt/class-use/Config.html
artjava/target/site/apidocs/com/github/srilakshmikanthanp/art/anixt/class-use/FontBase.html
artjava/target/site/apidocs/com/github/srilakshmikanthanp/art/anixt/class-use/JsonFont.html
artjava/target/site/apidocs/com/github/srilakshmikanthanp/art/anixt/class-use/KerningStyle.html
artjava/target/site/apidocs/com/github/srilakshmikanthanp/art/anixt/class-use/SmushedStyle.html
artjava/target/site/apidocs/com/github/srilakshmikanthanp/art/anixt/class-use/StyleBase.html
artjava/target/site/apidocs/com/github/srilakshmikanthanp/art/anixt/class-use/StyleUtil.html
artjava/target/site/apidocs/com/github/srilakshmikanthanp/art/anixt/class-use/UntouchedStyle.html
artjava/target/site/apidocs/com/github/srilakshmikanthanp/art/anixt/package-summary.html
artjava/target/site/apidocs/com/github/srilakshmikanthanp/art/anixt/package-tree.html
artjava/target/site/apidocs/com/github/srilakshmikanthanp/art/anixt/package-use.html
artjava/target/site/apidocs/com/github/srilakshmikanthanp/art/coartl/Coartl.html
artjava/target/site/apidocs/com/github/srilakshmikanthanp/art/coartl/class-use/Coartl.html
artjava/target/site/apidocs/com/github/srilakshmikanthanp/art/coartl/package-summary.html
artjava/target/site/apidocs/com/github/srilakshmikanthanp/art/coartl/package-tree.html
artjava/target/site/apidocs/com/github/srilakshmikanthanp/art/coartl/package-use.html
artjava/target/site/apidocs/com/github/srilakshmikanthanp/art/runeape/Config.ShrinkLevel.html
artjava/target/site/apidocs/com/github/srilakshmikanthanp/art/runeape/Config.html
artjava/target/site/apidocs/com/github/srilakshmikanthanp/art/runeape/GalleryBase.html
artjava/target/site/apidocs/com/github/srilakshmikanthanp/art/runeape/JsonGallery.html
artjava/target/site/apidocs/com/github/srilakshmikanthanp/art/runeape/KerningStyle.html
artjava/target/site/apidocs/com/github/srilakshmikanthanp/art/runeape/Runeape.html
artjava/target/site/apidocs/com/github/srilakshmikanthanp/art/runeape/StyleBase.html
artjava/target/site/apidocs/com/github/srilakshmikanthanp/art/runeape/StyleUtil.html
artjava/target/site/apidocs/com/github/srilakshmikanthanp/art/runeape/UntouchedStyle.html
artjava/target/site/apidocs/com/github/srilakshmikanthanp/art/runeape/class-use/Config.ShrinkLevel.html
artjava/target/site/apidocs/com/github/srilakshmikanthanp/art/runeape/class-use/Config.html
artjava/target/site/apidocs/com/github/srilakshmikanthanp/art/runeape/class-use/GalleryBase.html
artjava/target/site/apidocs/com/github/srilakshmikanthanp/art/runeape/class-use/JsonGallery.html
artjava/target/site/apidocs/com/github/srilakshmikanthanp/art/runeape/class-use/KerningStyle.html
artjava/target/site/apidocs/com/github/srilakshmikanthanp/art/runeape/class-use/Runeape.html
artjava/target/site/apidocs/com/github/srilakshmikanthanp/art/runeape/class-use/StyleBase.html
artjava/target/site/apidocs/com/github/srilakshmikanthanp/art/runeape/class-use/StyleUtil.html
artjava/target/site/apidocs/com/github/srilakshmikanthanp/art/runeape/class-use/UntouchedStyle.html
artjava/target/site/apidocs/com/github/srilakshmikanthanp/art/runeape/package-summary.html
artjava/target/site/apidocs/com/github/srilakshmikanthanp/art/runeape/package-tree.html
artjava/target/site/apidocs/com/github/srilakshmikanthanp/art/runeape/package-use.html
artjava/target/site/apidocs/constant-values.html
artjava/target/site/apidocs/deprecated-list.html
artjava/target/site/apidocs/help-doc.html
artjava/target/site/apidocs/index-all.html
artjava/target/site/apidocs/index.html
artjava/target/site/apidocs/overview-summary.html
artjava/target/site/apidocs/overview-tree.html
artjava/target/site/apidocs/serialized-form.html
JavaScript:
artjava/target/site/apidocs/jquery/jquery-migrate-3.0.1.js
artjava/target/site/apidocs/script.js
artjava/target/site/apidocs/search.js
CSS:
artjava/target/site/apidocs/stylesheet.css

Markdown, Knitr, Pandoc Header block disappears from output when styles sheet is added

---
title: "![logo](../Shared/logo.jpg) Title Text"
author: "Author Name"
output: html_document
css: styles.css
---
This header information gets output with render or knit2html, but when the css: styles.css and associated code
options(rstudio.markdownToHTML =
function(inputFile, outputFile) {
require(markdown)
markdownToHTML(inputFile, outputFile, stylesheet='custom.css')
}
)
is added to the start up file, the rendered output file has no header output. The first line in the file is the first line after the last "---" in the *.Rmd file. By the way, "Knit HTML" on the individual *.Rmd content works as expected.
Thanks,
Alan
The option rstudio.markdownToHTML is for R Markdown v1 only. The version based on Pandoc is v2, in which case the css field must be put under the html_document field:
---
title: "![logo](../Shared/logo.jpg) Title Text"
author: "Author Name"
output:
html_document:
css: styles.css
---
Please read the documentation.

Pulling Data from Google spreadsheet

I am having difficulty pulling data from Google spreadsheet
I have added following gem files
gem 'roo'
gem 'google_drive'
gem 'google-spreadsheet-ruby'
My jobs file is
require 'roo'
require 'rubygems'
def fetch_spreadsheet_data()
google_user = "MY EMAIL ADDRESS"
google_password = "MY PASSWORD"
workbook = Roo::Google.new("https://docs.google.com/spreadsheet/ccc?key=1hdwnrDsuJId1FLE0yWICYP1HGqYNu2NHH2IcoPyAzOQ#gid=0",user: google_user, password: google_password)
send_event('catchup_data', {current: s.cell('B',2) })
send_event('Bounced_back', {current: s.cell('B',3) )
end
SCHEDULER.every '5m' do
fetch_spreadsheet_data()
end
My dashboard.erb file has following html
<li data-row="2" data-col="3" data-sizex="1" data-sizey="1">
<div data-id="bounce_back" data-view="Number" data-title="Triage - Work in Progress" style="background-color:#5AC352;"></div>
</li>
<li data-row="2" data-col="4" data-sizex="1" data-sizey="1">
<div data-id="catchup_data" data-view="Number" data-title="Squad catchup sessions last month" style="background-color:#DBA901;"></div>
</li>
Not sure what am I missing that the data is not coming through. Can anyone please help me?
There are a few things wrong that I can see:
You're sending 'Bounced_back' but binding to the id of 'bounce_back'
You are trying to get the cell data from 's' but 's' is undefined
Looking at the Roo docs, I believe you have copied 's' from there. Just above that, they use sheet instead so I believe you have to grab the sheet from the workbook before using it.
I googled a bit and found this: http://etzelstorfer.com/en/dashing-graph-from-google-spreadsheet/
In summary, this should work for you:
def fetch_spreadsheet_data()
google_user = "MY EMAIL ADDRESS"
google_password = "MY PASSWORD"
workbook = Roo::Google.new("https://docs.google.com/spreadsheet/ccc?key=1hdwnrDsuJId1FLE0yWICYP1HGqYNu2NHH2IcoPyAzOQ#gid=0",user: google_user, password: google_password)
s = workbook.sheets[0] # assuming first sheet in workbook
send_event('catchup_data', {current: s.cell('B',2) })
send_event('bounce_back', {current: s.cell('B',3) )
end
SCHEDULER.every '5m' do
fetch_spreadsheet_data()
end

How do I access structured metadata using DocPad?

I'm evaluating DocPad at the moment to see if it will be suitable for our website amongst other things. I'm having trouble working out how to use structured metadata in eco templates. I'm pretty sure it's related to How to display Backbone nested attribute using Eco? but that's unanswered too.
My page looks like:
--- yaml
layout: 'post'
title: "Samuel Johnson's garret - an unexpected lull"
category: 'Digital Publishing'
author:
name: Author Name
page: author
email: author.name#ourdomain.co.uk
---
Unexpected free time, a chilly walk, a brown plaque leads me to
[Dr Johnson's house (http://www.drjohnsonshouse.org/) near Fleet-Street…
and the eco template like:
---
layout: default
---
<article id="post" class="post">
<h1><%= #document.title %></h1>
<h2>By: <%= #document.author.email %></h2>
<div class="post-content"><%- #content %></div>
</article>
The #document.author.email leads to the following error being logged:
TypeError: Cannot read property 'email' of undefined
How do I access that structured metadata?
thanks
Everything seems ok. When I test the same structure, the line <%= #document.author.email %> works. Maybe you have some kind of inconsistency using white spaces and tabs ? You can validate your YAML on this site : http://yamllint.com.
Personally I also use arrays of objects in metadata :
choices:
-
text: "Mercure"
feedback: "Mercure est la planète la plus proche du Soleil, elle se situe à une distance de 0,4 UA"
value: 0
-
text: "Neptune"
feedback: "C'est effectivement la planète la plus éloignée avec une distance de 30 UA."
value: 1
and it works great. Sorry for the text in French but I guess it doesn't really matter for an example.
you can see this example, it works perfectly now, i found my issue and i want to share the solution with you:
---
slides:
-
detailimage: "heliski-img.png"
mainimage: "heliski-g.jpg"
title: "Powder South Heliski Guides"
-
detailimage: "nuevos-vientos-img.png"
mainimage: "nuevos-vientos.jpg"
title: "Centro Experiencial Nuevos Vientos"
---
#full-width-slider.royalSlider.heroSlider.rsMinW
each slide in document.slides
.rsContent
img.rsImg(src='/slideshow/#{slide.mainimage}', alt='#{slide.title}')
.infoBlock.infoBlockLeftBlack.rsABlock(data-fade-effect='', data-move-offset='10', data-move-effect='bottom', data-speed='200')
p #{slide.title}
img.rsImg(src='/slideshow/#{slide.detailimage}', alt='#{slide.title}')
the important thing is the each line, it must say "in document.slides" so i can access from jade the document metadata. :D
the final render will look like this:
<div id="full-width-slider" class="royalSlider heroSlider rsMinW">
<div class="rsContent"><img src="/slideshow/heliski-g.jpg" alt="Powder South Heliski Guides" class="rsImg">
<div data-fade-effect="" data-move-offset="10" data-move-effect="bottom" data-speed="200" class="infoBlock infoBlockLeftBlack rsABlock"></div>
<p>Powder South Heliski Guides</p><img src="/slideshow/heliski-img.png" alt="Powder South Heliski Guides" class="rsImg">
</div>
<div class="rsContent"><img src="/slideshow/nuevos-vientos.jpg" alt="Centro Experiencial Nuevos Vientos" class="rsImg">
<div data-fade-effect="" data-move-offset="10" data-move-effect="bottom" data-speed="200" class="infoBlock infoBlockLeftBlack rsABlock"></div>
<p>Centro Experiencial Nuevos Vientos</p><img src="/slideshow/nuevos-vientos-img.png" alt="Centro Experiencial Nuevos Vientos" class="rsImg">
</div>
</div>