diff --git a/jekyll2rangitaki b/jekyll2rangitaki deleted file mode 160000 index 88e4912..0000000 --- a/jekyll2rangitaki +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 88e491247b459d3f4aeeaa004170f92ac38b5822 diff --git a/jekyll2rangitaki2/LICENSE b/jekyll2rangitaki2/LICENSE new file mode 100644 index 0000000..7ba963c --- /dev/null +++ b/jekyll2rangitaki2/LICENSE @@ -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. diff --git a/jekyll2rangitaki2/README.md b/jekyll2rangitaki2/README.md new file mode 100644 index 0000000..f925eb2 --- /dev/null +++ b/jekyll2rangitaki2/README.md @@ -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 diff --git a/jekyll2rangitaki2/in/2015-02-21-my-name-is-marcel-kapfer.markdown b/jekyll2rangitaki2/in/2015-02-21-my-name-is-marcel-kapfer.markdown new file mode 100644 index 0000000..61776e1 --- /dev/null +++ b/jekyll2rangitaki2/in/2015-02-21-my-name-is-marcel-kapfer.markdown @@ -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! diff --git a/jekyll2rangitaki2/in/2015-02-21-welcome-to-jekyll.markdown b/jekyll2rangitaki2/in/2015-02-21-welcome-to-jekyll.markdown new file mode 100644 index 0000000..1dede9c --- /dev/null +++ b/jekyll2rangitaki2/in/2015-02-21-welcome-to-jekyll.markdown @@ -0,0 +1,25 @@ +--- +layout: post +title: "Welcome to Jekyll!" +date: 2015-02-21 20:26:23 +categories: jekyll update +--- +You’ll 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 [Jekyll’s GitHub repo][jekyll-gh]. If you have questions, you can ask them on [Jekyll’s dedicated Help repository][jekyll-help]. + +[jekyll]: http://jekyllrb.com +[jekyll-gh]: https://github.com/jekyll/jekyll +[jekyll-help]: https://github.com/jekyll/jekyll-help diff --git a/jekyll2rangitaki2/jekyll2rangitaki.rb b/jekyll2rangitaki2/jekyll2rangitaki.rb new file mode 100755 index 0000000..bcccfd9 --- /dev/null +++ b/jekyll2rangitaki2/jekyll2rangitaki.rb @@ -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 diff --git a/jekyll2rangitaki2/out/2015-02-21-my-name-is-marcel-kapfer.md b/jekyll2rangitaki2/out/2015-02-21-my-name-is-marcel-kapfer.md new file mode 100644 index 0000000..7ffd48c --- /dev/null +++ b/jekyll2rangitaki2/out/2015-02-21-my-name-is-marcel-kapfer.md @@ -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! diff --git a/jekyll2rangitaki2/out/2015-02-21-welcome-to-jekyll.md b/jekyll2rangitaki2/out/2015-02-21-welcome-to-jekyll.md new file mode 100644 index 0000000..6a865d7 --- /dev/null +++ b/jekyll2rangitaki2/out/2015-02-21-welcome-to-jekyll.md @@ -0,0 +1,22 @@ +%TITLE: Welcome to Jekyll! +%DATE: 21 February 2015 20:26 +%TAGS: jekyll, update +You’ll 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 [Jekyll’s GitHub repo][jekyll-gh]. If you have questions, you can ask them on [Jekyll’s dedicated Help repository][jekyll-help]. + +[jekyll]: http://jekyllrb.com +[jekyll-gh]: https://github.com/jekyll/jekyll +[jekyll-help]: https://github.com/jekyll/jekyll-help