All scripts in one repository

This commit is contained in:
mmk2410 2015-11-12 22:39:15 +01:00
parent 9f9304d6aa
commit 928b339cbb
8 changed files with 177 additions and 1 deletions

@ -1 +0,0 @@
Subproject commit 88e491247b459d3f4aeeaa004170f92ac38b5822

22
jekyll2rangitaki2/LICENSE Normal file
View file

@ -0,0 +1,22 @@
COPYRIGHT (c) 2015 mmk2410
MIT License
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

View file

@ -0,0 +1,32 @@
# jekyll2rangitaki
A small script for converting Jekyll markdown blog posts to Rangitaki blog posts.
## How to use
You don"t have to install anything. Just run
```
ruby jekyll2rangitaki.rb
```
or
```
chmod +x jekyll2rangitaki.rb
./jekyll2rangitaki.rb
```
The converter will read all `.md` and `.markdown` in the directory `./in/`, so copy the blog posts, you want to convert into this directory, and it will then throw the converted files out into the directory `./out/`.
## License
This small piece of code is licensed under MIT license.
## Contribute
1. Fork it
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Add some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
5. Create New Pull Request

View file

@ -0,0 +1,9 @@
---
layout: post
title: "Please Read!"
date: 2015-02-21 20:58:23
categories: jekyll update
---
#Hello all together
My name is Marcel Kapfer and I'm surprised that you are visiting this page! Because it isn't in use at the moment. My website is at marcel-kapfer.de and there you will find a link to my blog!

View file

@ -0,0 +1,25 @@
---
layout: post
title: "Welcome to Jekyll!"
date: 2015-02-21 20:26:23
categories: jekyll update
---
Youll find this post in your `_posts` directory. Go ahead and edit it and re-build the site to see your changes. You can rebuild the site in many different ways, but the most common way is to run `jekyll serve`, which launches a web server and auto-regenerates your site when a file is updated.
To add new posts, simply add a file in the `_posts` directory that follows the convention `YYYY-MM-DD-name-of-post.ext` and includes the necessary front matter. Take a look at the source for this post to get an idea about how it works.
Jekyll also offers powerful support for code snippets:
{% highlight ruby %}
def print_hi(name)
puts "Hi, #{name}"
end
print_hi('Tom')
#=> prints 'Hi, Tom' to STDOUT.
{% endhighlight %}
Check out the [Jekyll docs][jekyll] for more info on how to get the most out of Jekyll. File all bugs/feature requests at [Jekylls GitHub repo][jekyll-gh]. If you have questions, you can ask them on [Jekylls dedicated Help repository][jekyll-help].
[jekyll]: http://jekyllrb.com
[jekyll-gh]: https://github.com/jekyll/jekyll
[jekyll-help]: https://github.com/jekyll/jekyll-help

View file

@ -0,0 +1,61 @@
#!/usr/bin/ruby
require 'time'
if ARGV[0] == "-h" || ARGV[0] == "--help"
puts "\njekyll2rangitaki converter\n\n" \
"2015 (C) Marcel Kapfer (mmk2410)\n" \
"MIT License\n\n" \
"Version: 0.1.0\n" \
"Release Date: 03 November 2015\n\n" \
"Usage:\n" \
"Copy the jekyll files into an directory called\n" \
" ./in and run the script. The converted files \n" \
"are saved in ./out\n\n" \
"Options:\n" \
"-h || --help print the help and exit\n\n"
exit
end
if !File.directory?("./in/")
puts "No input directory"
exit
end
articles = Dir.entries('./in')
for article in articles
title = ""
date = ""
time = Time.new
tags = ""
text = ""
if article.length > 2 && (article.end_with?(".md") || article.end_with?(".markdown"))
file = File.open("./in/#{article}")
file.each do |line|
if line.start_with?("---")
next
elsif line.start_with?("layout")
next
elsif line.start_with?("title")
title = line[7...line.length].strip!
title = title.chomp("\"")[1...title.length]
elsif line.start_with?("date")
date = line[5...line.length].strip
time = Time.new(date[0...4],date[5...7],date[8...10],date[11...13],date[14...16],date[17...19])
elsif line.start_with?("categories")
tags = line[12...line.length].strip
tags[" "] = ", "
elsif line.start_with?("{% highlight") || line.start_with?("{% endhighlight")
text += "```\n"
else
text += line
end
end
if !File.directory?("./out")
Dir.mkdir("./out")
end
article[".markdown"] = ".md"
post = File.new("./out/#{article}", "w")
post.puts "%TITLE: #{title}" if !title.empty?
post.puts "%DATE: #{time.strftime("%d %B %Y %H:%M")}" if time != nil
post.puts "%TAGS: #{tags}" if !tags.empty?
post.puts text if !text.empty?
post.close
end
end

View file

@ -0,0 +1,6 @@
%TITLE: Please Read!
%DATE: 21 February 2015 20:58
%TAGS: jekyll, update
#Hello all together
My name is Marcel Kapfer and I'm surprised that you are visiting this page! Because it isn't in use at the moment. My website is at marcel-kapfer.de and there you will find a link to my blog!

View file

@ -0,0 +1,22 @@
%TITLE: Welcome to Jekyll!
%DATE: 21 February 2015 20:26
%TAGS: jekyll, update
Youll find this post in your `_posts` directory. Go ahead and edit it and re-build the site to see your changes. You can rebuild the site in many different ways, but the most common way is to run `jekyll serve`, which launches a web server and auto-regenerates your site when a file is updated.
To add new posts, simply add a file in the `_posts` directory that follows the convention `YYYY-MM-DD-name-of-post.ext` and includes the necessary front matter. Take a look at the source for this post to get an idea about how it works.
Jekyll also offers powerful support for code snippets:
```
def print_hi(name)
puts "Hi, #{name}"
end
print_hi('Tom')
#=> prints 'Hi, Tom' to STDOUT.
```
Check out the [Jekyll docs][jekyll] for more info on how to get the most out of Jekyll. File all bugs/feature requests at [Jekylls GitHub repo][jekyll-gh]. If you have questions, you can ask them on [Jekylls dedicated Help repository][jekyll-help].
[jekyll]: http://jekyllrb.com
[jekyll-gh]: https://github.com/jekyll/jekyll
[jekyll-help]: https://github.com/jekyll/jekyll-help