md2site 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (65) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +30 -0
  3. data/.gitmodules +3 -0
  4. data/.rspec +3 -0
  5. data/.rubocop.yml +138 -0
  6. data/.rubocop_todo.yml +47 -0
  7. data/.travis.yml +7 -0
  8. data/Gemfile +8 -0
  9. data/Gemfile.lock +98 -0
  10. data/LICENSE +8 -0
  11. data/LICENSE.txt +8 -0
  12. data/README.md +39 -0
  13. data/Rakefile +6 -0
  14. data/bin/console +14 -0
  15. data/bin/md2site +157 -0
  16. data/bin/setup +8 -0
  17. data/data/conf/conf-sample.yml +5 -0
  18. data/data/conf/conf.sh +32 -0
  19. data/data/conf/setting.yml +3 -0
  20. data/data/conf/site.tsv +1 -0
  21. data/data/template/5col_no_attr.erb +72 -0
  22. data/data/template/5col_no_attr_b.erb +72 -0
  23. data/data/template/functions_static.erb +10 -0
  24. data/data/template/functions_variable.erb +3 -0
  25. data/data/template2/contest_notification.erb +16 -0
  26. data/data/template2/contest_notification_2.erb +34 -0
  27. data/data/template2/contest_winners.erb +69 -0
  28. data/data/template2/contest_winners_statement.erb +1 -0
  29. data/data/testdata/conf-blog.yml +6 -0
  30. data/data/testdata/conf-download.yml +6 -0
  31. data/data/testdata/conf-link.yml +6 -0
  32. data/data/testdata/conf-profile.yml +6 -0
  33. data/data/testdata/conf-top.yml +6 -0
  34. data/data/testdata/site.tsv +5 -0
  35. data/data/testdata0/conf-appliction.yml +1 -0
  36. data/data/testdata0/conf-attempt.yml +69 -0
  37. data/data/testdata0/conf-autosar.yml +11 -0
  38. data/data/testdata0/conf-community.yml +3 -0
  39. data/data/testdata0/conf-document.yml +1 -0
  40. data/data/testdata0/conf-download.yml +1 -0
  41. data/data/testdata0/conf-edu.yml +52 -0
  42. data/data/testdata0/conf-etc.yml +1 -0
  43. data/data/testdata0/conf-members.yml +2 -0
  44. data/data/testdata0/conf-product.yml +37 -0
  45. data/data/testdata0/conf-project.yml +14 -0
  46. data/data/testdata0/conf-rtk.yml +25 -0
  47. data/data/testdata0/conf-top.yml +1 -0
  48. data/data/testdata0/setting.yml +33 -0
  49. data/data/testdata0/site.tsv +123 -0
  50. data/lib/md2site/env.rb +649 -0
  51. data/lib/md2site/htmlutils.rb +142 -0
  52. data/lib/md2site/htmlutils0.rb +223 -0
  53. data/lib/md2site/info.rb +17 -0
  54. data/lib/md2site/init.rb +90 -0
  55. data/lib/md2site/listfile.rb +22 -0
  56. data/lib/md2site/make.rb +295 -0
  57. data/lib/md2site/nkfguess.rb +33 -0
  58. data/lib/md2site/setup.rb +358 -0
  59. data/lib/md2site/statusfile.rb +75 -0
  60. data/lib/md2site/testdata.rb +50 -0
  61. data/lib/md2site/testx.rb +73 -0
  62. data/lib/md2site/version.rb +3 -0
  63. data/lib/md2site.rb +161 -0
  64. data/md2site.gemspec +59 -0
  65. metadata +359 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 540324eb165081d0e690b2dcf827a8dbb279dda2f3c226434cd1a73939d763a8
4
+ data.tar.gz: 92072281cba303db2a35214f4b1be74083e554eafeba36f3ea82d4dc94f255f5
5
+ SHA512:
6
+ metadata.gz: ae7bd75494fedb7c043d4ba4c4f44b8b85e34c8fcfab35ea2677799f92322bd6dc5cde37e07d596c2b732f2224b34f0945f6f1ecd3bfb0dd75d513b5fcc7c04f
7
+ data.tar.gz: c8c248a620499e7514143d6084e6fb2800b3371c9848ce6b62a37ba42bf30021bae2141d3c435b6a3002e2240fa5557da21bac3ef8d5f9eda27380ed1aa97ef6
data/.gitignore ADDED
@@ -0,0 +1,30 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+
10
+ # rspec failure tracking
11
+ .rspec_status
12
+ log.txt
13
+ vendor/
14
+ *~
15
+ /bin/commands
16
+ bin/bundle
17
+ bin/byebug
18
+ bin/erubis
19
+ bin/htmldiff
20
+ bin/ldiff
21
+ bin/mdextab
22
+ bin/nokogiri
23
+ bin/rake
24
+ bin/rspec
25
+ bin/simpleoptparse
26
+ _xtest
27
+ bin/rubocop
28
+ bin/ruby-parse
29
+ bin/ruby-rewrite
30
+ r.log
data/.gitmodules ADDED
@@ -0,0 +1,3 @@
1
+ [submodule "_xtest"]
2
+ path = _xtest
3
+ url = https://nlightsystem.com/gogs/ykominami/md2site_testdata.git
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
data/.rubocop.yml ADDED
@@ -0,0 +1,138 @@
1
+ inherit_from: .rubocop_todo.yml
2
+
3
+ AllCops:
4
+ TargetRubyVersion: 2.5
5
+ DisplayCopNames: true
6
+ #
7
+ StyleGuideBaseURL: https://github.com/fortissimo1997/ruby-style-guide/blob/japanese/README.ja.md
8
+ #
9
+ Exclude:
10
+ - "Rakefile"
11
+ - "*.gemspec"
12
+ - "vendor/**/*"
13
+ - "spec/*.rb"
14
+ - 'bin/console'
15
+ - 'bin/setup'
16
+ - "bin/x.sh"
17
+ - "bin/x.rb"
18
+ - "bin"
19
+ - "bin/erubis"
20
+ - "bin/md2site"
21
+ - "bin/ldiff"
22
+ - "bin/bundle"
23
+ - "bin/rake"
24
+ - "bin/htmldiff"
25
+ - "bin/ruby-parse"
26
+ - "bin/setup"
27
+ - "bin/simpleoptparse"
28
+ - "bin/ruby-rewrite"
29
+ - "bin/nokogiri"
30
+ - "bin/mdextab"
31
+ - "bin/rspec"
32
+ - "bin/commands"
33
+ - "bin/rubocop"
34
+ - "bin/byebug"
35
+ - "_xtest/*.rb"
36
+ - "_xtest/*/*.rb"
37
+ - "_xtest/*/*/*.rb"
38
+ - "_xtest/*/*/*/*.rb"
39
+
40
+ Layout/ExtraSpacing:
41
+ AllowForAlignment: true
42
+ Layout/SpaceInsideBlockBraces:
43
+ EnforcedStyle: space
44
+ SpaceBeforeBlockParameters: false
45
+ Layout/MultilineMethodCallIndentation:
46
+ EnforcedStyle: indented
47
+ Layout/EmptyLineAfterGuardClause:
48
+ Enabled: false
49
+ Layout/MultilineOperationIndentation:
50
+ EnforcedStyle: indented
51
+
52
+ Lint/UnderscorePrefixedVariableName:
53
+ Enabled: false
54
+ Lint/UnusedMethodArgument:
55
+ Enabled: false
56
+
57
+ Metrics/LineLength:
58
+ Enabled: false
59
+ Metrics/ClassLength:
60
+ Exclude:
61
+ # - "test/**/*.rb"
62
+ Metrics/ParameterLists:
63
+ Max: 7
64
+ Metrics/MethodLength:
65
+ Max: 30
66
+
67
+ Naming/FileName:
68
+ Enabled: false
69
+ Naming/UncommunicativeMethodParamName:
70
+ AllowedNames:
71
+ - z
72
+
73
+ Style/AsciiComments:
74
+ Enabled: false
75
+ Style/HashSyntax:
76
+ Exclude:
77
+ - "**/*.rake"
78
+ - "Rakefile"
79
+ Style/EmptyMethod:
80
+ Enabled: false
81
+ Style/FrozenStringLiteralComment:
82
+ Enabled: false
83
+ Style/NumericLiterals:
84
+ Enabled: false
85
+ Style/StringLiterals:
86
+ EnforcedStyle: double_quotes
87
+ Style/TrailingCommaInArrayLiteral:
88
+ Enabled: false
89
+ Style/TrailingCommaInHashLiteral:
90
+ Enabled: false
91
+ Style/TrailingCommaInArguments:
92
+ Enabled: false
93
+ Style/Documentation:
94
+ Enabled: false
95
+ Style/WordArray:
96
+ Enabled: false
97
+ Style/BarePercentLiterals:
98
+ EnforcedStyle: percent_q
99
+ Style/BracesAroundHashParameters:
100
+ Enabled: false
101
+ Style/PercentQLiterals:
102
+ Enabled: false
103
+ Style/UnneededPercentQ:
104
+ Enabled: false
105
+ Style/IfUnlessModifier:
106
+ Enabled: false
107
+ Style/NumericPredicate:
108
+ Enabled: false
109
+ Style/MutableConstant:
110
+ Enabled: false
111
+ Style/SymbolArray:
112
+ Enabled: false
113
+ Style/FormatString:
114
+ Enabled: false
115
+ Style/ConditionalAssignment:
116
+ Enabled: false
117
+ Style/WhileUntilModifier:
118
+ Enabled: false
119
+ Style/RedundantBegin:
120
+ Enabled: false
121
+ Style/YodaCondition:
122
+ EnforcedStyle: forbid_for_equality_operators_only
123
+ Style/TernaryParentheses:
124
+ EnforcedStyle: require_parentheses_when_complex
125
+ Style/MethodCallWithArgsParentheses:
126
+ Exclude:
127
+ - "**/*.rake"
128
+ - "Rakefile"
129
+ - "Gemfile"
130
+ Enabled: true
131
+ IgnoredMethods:
132
+ - p
133
+ - pp
134
+ - puts
135
+ - print
136
+ - printf
137
+ - raise
138
+ - require
data/.rubocop_todo.yml ADDED
@@ -0,0 +1,47 @@
1
+ # This configuration was generated by
2
+ # `rubocop --auto-gen-config --exclude-limit 9999 --no-offense-counts --no-auto-gen-timestamp`
3
+ # using RuboCop version 0.68.1.
4
+ # The point is for the user to remove these configuration records
5
+ # one by one as the offenses are removed from the code base.
6
+ # Note that changes in the inspected code, or installation of new
7
+ # versions of RuboCop, may require this file to be generated again.
8
+
9
+ # Cop supports --auto-correct.
10
+ # Configuration parameters: .
11
+ # SupportedStyles: space, no_space
12
+ Layout/SpaceAroundEqualsInParameterDefault:
13
+ EnforcedStyle: no_space
14
+
15
+ # Cop supports --auto-correct.
16
+ Lint/ScriptPermission:
17
+ Exclude:
18
+ # - 'bin/md2site'
19
+
20
+ Metrics/AbcSize:
21
+ Max: 160
22
+
23
+ # Configuration parameters: CountComments, ExcludedMethods.
24
+ # ExcludedMethods: refine
25
+ Metrics/BlockLength:
26
+ Max: 27
27
+
28
+ # Configuration parameters: CountComments.
29
+ Metrics/ClassLength:
30
+ Max: 461
31
+
32
+ Metrics/CyclomaticComplexity:
33
+ Max: 27
34
+
35
+ # Configuration parameters: CountComments, ExcludedMethods.
36
+ Metrics/MethodLength:
37
+ Max: 169
38
+
39
+ Metrics/PerceivedComplexity:
40
+ Max: 28
41
+
42
+ # Cop supports --auto-correct.
43
+ # Configuration parameters: EnforcedStyle.
44
+ # SupportedStyles: empty, nil, both
45
+ Style/EmptyElse:
46
+ Exclude:
47
+ # - 'lib/md2site/info.rb'
data/.travis.yml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ sudo: false
3
+ language: ruby
4
+ cache: bundler
5
+ rvm:
6
+ - 2.5.3
7
+ before_install: gem install bundler -v 2.0.1
data/Gemfile ADDED
@@ -0,0 +1,8 @@
1
+ source "https://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in md2site.gemspec
4
+ #gem "filex", path: "../filex"
5
+ #gem "mdextab", path: "../../mdextab"
6
+ gem "mdextab", git: "https://github.com/ykominami/mdextab"
7
+ #gem "messagex", path: "../messagex"
8
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,98 @@
1
+ GIT
2
+ remote: https://github.com/ykominami/mdextab
3
+ revision: 4b4f0f468b3cfbe127d87540dbb21809bc31f047
4
+ specs:
5
+ mdextab (0.1.4)
6
+ erubis
7
+ filex
8
+ messagex
9
+ simpleoptparse
10
+
11
+ PATH
12
+ remote: .
13
+ specs:
14
+ md2site (0.1.2)
15
+ bundler (~> 2.0)
16
+ erubis
17
+ faraday
18
+ faraday_middleware
19
+ filex
20
+ mdextab (~> 0.1.4)
21
+ messagex
22
+ nokogiri
23
+ simpleoptparse
24
+
25
+ GEM
26
+ remote: https://rubygems.org/
27
+ specs:
28
+ ast (2.4.0)
29
+ byebug (11.0.1)
30
+ diff-lcs (1.3)
31
+ erubis (2.7.0)
32
+ faraday (0.15.4)
33
+ multipart-post (>= 1.2, < 3)
34
+ faraday_middleware (0.13.1)
35
+ faraday (>= 0.7.4, < 1.0)
36
+ filex (0.1.2)
37
+ jaro_winkler (1.5.2)
38
+ messagex (0.1.2)
39
+ mini_portile2 (2.4.0)
40
+ multipart-post (2.1.1)
41
+ nokogiri (1.10.3)
42
+ mini_portile2 (~> 2.4.0)
43
+ parallel (1.17.0)
44
+ parser (2.6.3.0)
45
+ ast (~> 2.4.0)
46
+ power_assert (1.1.4)
47
+ rainbow (3.0.0)
48
+ rake (10.5.0)
49
+ rr (1.2.1)
50
+ rspec (3.8.0)
51
+ rspec-core (~> 3.8.0)
52
+ rspec-expectations (~> 3.8.0)
53
+ rspec-mocks (~> 3.8.0)
54
+ rspec-core (3.8.0)
55
+ rspec-support (~> 3.8.0)
56
+ rspec-expectations (3.8.3)
57
+ diff-lcs (>= 1.2.0, < 2.0)
58
+ rspec-support (~> 3.8.0)
59
+ rspec-mocks (3.8.0)
60
+ diff-lcs (>= 1.2.0, < 2.0)
61
+ rspec-support (~> 3.8.0)
62
+ rspec-support (3.8.0)
63
+ rubocop (0.70.0)
64
+ jaro_winkler (~> 1.5.1)
65
+ parallel (~> 1.10)
66
+ parser (>= 2.6)
67
+ rainbow (>= 2.2.2, < 4.0)
68
+ ruby-progressbar (~> 1.7)
69
+ unicode-display_width (>= 1.4.0, < 1.7)
70
+ rubocop-performance (1.3.0)
71
+ rubocop (>= 0.68.0)
72
+ ruby-progressbar (1.10.0)
73
+ simpleoptparse (0.1.1)
74
+ test-unit (3.3.3)
75
+ power_assert
76
+ test-unit-rr (1.0.5)
77
+ rr (>= 1.1.1)
78
+ test-unit (>= 2.5.2)
79
+ unicode-display_width (1.6.0)
80
+
81
+ PLATFORMS
82
+ ruby
83
+
84
+ DEPENDENCIES
85
+ bundler (~> 2.0)
86
+ byebug
87
+ md2site!
88
+ mdextab!
89
+ power_assert (~> 1.1.4)
90
+ rake (~> 10.0)
91
+ rspec (~> 3.0)
92
+ rubocop
93
+ rubocop-performance
94
+ test-unit
95
+ test-unit-rr
96
+
97
+ BUNDLED WITH
98
+ 2.0.1
data/LICENSE ADDED
@@ -0,0 +1,8 @@
1
+ MIT License
2
+ Copyright (c) <year> <copyright holders>
3
+
4
+ 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:
5
+
6
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
7
+
8
+ 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.
data/LICENSE.txt ADDED
@@ -0,0 +1,8 @@
1
+ MIT License
2
+ Copyright (c) <year> <copyright holders>
3
+
4
+ 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:
5
+
6
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
7
+
8
+ 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.
data/README.md ADDED
@@ -0,0 +1,39 @@
1
+ # Md2site
2
+
3
+ Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/md2site`. To experiment with that code, run `bin/console` for an interactive prompt.
4
+
5
+ TODO: Delete this and the text above, and describe your gem
6
+
7
+ ## Installation
8
+
9
+ Add this line to your application's Gemfile:
10
+
11
+ ```ruby
12
+ gem 'md2site'
13
+ ```
14
+
15
+ And then execute:
16
+
17
+ $ bundle
18
+
19
+ Or install it yourself as:
20
+
21
+ $ gem install md2site
22
+
23
+ ## Usage
24
+
25
+ TODO: Write usage instructions here
26
+
27
+ ## Development
28
+
29
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
30
+
31
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
32
+
33
+ ## Contributing
34
+
35
+ Bug reports and pull requests are welcome on GitHub at https://github.com/ykominami/md2site.
36
+
37
+ ## License
38
+
39
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
data/Rakefile ADDED
@@ -0,0 +1,6 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "md2site"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start(__FILE__)
data/bin/md2site ADDED
@@ -0,0 +1,157 @@
1
+ #!/usr/bin/env ruby
2
+ require "bundler/setup"
3
+ require "md2site"
4
+
5
+ require "optparse"
6
+ require "simpleoptparse"
7
+
8
+ opts = {}
9
+
10
+ banner_command_part = %q(Usage: bundle exec ruby bin/md2site )
11
+
12
+ banner_option_part = <<~_BANNER_END
13
+ #init(scafold)
14
+ [-i dir] [--init dir]
15
+ [--url url]
16
+ [--yaml ]
17
+
18
+ #setup(get contents from a web site, copy files to project directory)
19
+ [-g dir] [--getfiles dir]
20
+ [-w x] [-zcontents dir]
21
+ [-u] [--zupdate] opts["contentUpdate"]
22
+
23
+ #make(make html file)
24
+ [-t targetCommand] [--target targetCommand]
25
+ [-s subTargetCommand] [--suttarget subTargetCommand]
26
+
27
+ #info(display information)
28
+ [-z] [--zlist]
29
+ [-x] [--zindex]
30
+
31
+ #help
32
+
33
+ #testx(execute all process for test)
34
+ [-a dir] [--all dir]
35
+
36
+ #(common)
37
+ [-c dir] [--confpath dir] # opts['confPath']
38
+ [-d d|v] [--debug d|v]
39
+ [-l file] [--logfile file]
40
+ #(independent)
41
+ [-v] [--version]
42
+ [-h] [--help]
43
+ _BANNER_END
44
+
45
+ middle_state_lines = banner_option_part.split("\n").map do |y|
46
+ y.split("#").first
47
+ end
48
+ ary = middle_state_lines.select {|x| !x.nil? && !/^\s*$/.match?(x) }
49
+
50
+ BANNER = banner_command_part + " " + ary.join(" ")
51
+
52
+ SUBCMDS = { "init" => "i", "setup" => "gwu", "make" => "ts", "info" => "zx", "help" => "", "testx" => "a" }
53
+
54
+ def usage(exit_code)
55
+ puts BANNER
56
+ exit(exit_code)
57
+ end
58
+
59
+ def need_help?(params, subcmd)
60
+ musts = SUBCMDS[subcmd]
61
+
62
+ musts ? musts.each_char.none? {|must| params[must] } : false
63
+ end
64
+
65
+ def check_file_exist(*args)
66
+ args.shift unless args.first
67
+
68
+ path = File.join(*args)
69
+ File.file?(path) ? path : nil
70
+ end
71
+
72
+ def check_option_confpath(dir=nil)
73
+ if (path = check_file_exist(dir))
74
+ # return path
75
+ elsif (path = check_file_exist(dir, Md2site::CONF_FILE))
76
+ # return path
77
+ elsif (path = check_file_exist(dir, Md2site::CONF_DIR, Md2site::CONF_FILE))
78
+ # return path
79
+ else
80
+ puts "Error: Not specified -c dir or -c file correctory"
81
+ puts
82
+ usage(0)
83
+ end
84
+
85
+ path
86
+ end
87
+
88
+ if ARGV && ARGV[0] && (ARGV[0][0] != "-")
89
+ cmd = ARGV.shift
90
+ end
91
+
92
+ opts["debug"] = ""
93
+ Simpleoptparse::Simpleoptparse.parse(ARGV, opts, BANNER, Md2site::VERSION, nil) do |parser|
94
+ parser.on("-i dir", "--init") {|x| opts["init"] = opts["i"] = x }
95
+ parser.on("--url url") {|x| opts["url"] = x }
96
+
97
+ parser.on("-w dir", "--zcontents") {|x| opts["zcontents"] = opts["w"] = x }
98
+ parser.on("-g dir", "--getfiles") {|x| opts["getfiles"] = opts["g"] = x }
99
+ parser.on("-u", "--zupdate") {|_x| opts["contentUpdate"] = opts["u"] = true }
100
+
101
+ parser.on("-t target", "--target") {|x| opts["targetCommand"] = opts["t"] = x }
102
+ parser.on("-s subtarget", "--subtarget") {|x| opts["subTargetCommand"] = opts["s"] = x }
103
+
104
+ parser.on("-z", "--zlist") {|_x| opts["zlist"] = opts["z"] = true }
105
+ parser.on("-x", "--zindex") {|_x| opts["zindex"] = opts["x"] = true }
106
+
107
+ parser.on("-a dir", "--all") {|x| opts["all"] = opts["a"] = x }
108
+
109
+ parser.on("-c confpath", "--confpath") {|x| opts["confPath"] = opts["c"] = x }
110
+ parser.on("-d [d|v]", "--debug") {|x| opts["debug"] = opts["d"] = x }
111
+ parser.on("-l file", "--logfile") {|x| opts["logfile"] = opts["l"] = x }
112
+
113
+ parser.on("-h", "--help") {|_x| opts["help"] = opts["h"] = true }
114
+ end
115
+
116
+ if opts["debug"] == "d"
117
+ opts["debug"] = "debug"
118
+ elsif opts["debug"] == "v"
119
+ opts["debug"] = "verbose"
120
+ elsif opts["debug"] == ""
121
+ opts["debug"] = nil
122
+ else
123
+ opts["debug"] = "debug"
124
+ end
125
+
126
+ usage(0) if (cmd == "help") || (cmd == "-h") || opts["h"] || opts["help"]
127
+
128
+ unless cmd
129
+ puts "Error: No subcommand"
130
+ puts
131
+ usage(0)
132
+ end
133
+
134
+ if (cmd != "init") && (cmd != "testx")
135
+ opts["confPath"] = check_option_confpath(opts["confPath"])
136
+ else
137
+ unless opts["url"]
138
+ puts "Error: Not specified --url url"
139
+ puts
140
+ usage(0)
141
+ end
142
+ end
143
+
144
+ unless SUBCMDS.keys.include?(cmd)
145
+ puts "Error: Invalid subcommand"
146
+ puts
147
+ usage(0)
148
+ end
149
+
150
+ if need_help?(opts, cmd)
151
+ puts "Error: Some needed parameters are ignored"
152
+ puts
153
+ usage(1)
154
+ end
155
+
156
+ md2 = Md2site::Md2site.new(opts)
157
+ md2.execute_command(cmd)
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,5 @@
1
+ #sample:
2
+ #sample2:
3
+ # - sample2,:include,sample/sample2/work
4
+ #sample3:
5
+ # - sample3_timetable,5col_no_attr_b.erb
data/data/conf/conf.sh ADDED
@@ -0,0 +1,32 @@
1
+ ABSOLUTE_PATH_ROOT=<%= absolutePathRoot %>
2
+
3
+ OUTPUT_DIR=<%= rootOutputDir %>
4
+ TEMPLELATE_DIR=<%= templateDir %>
5
+ CONF_DIR=<%= confDir %>
6
+ SRC_DIR=<%= rootSrcDir %>
7
+
8
+ ABSOLUTE_PATH_ROOT_TEMPLATE=${ABSOLUTE_PATH_ROOT}/${TEMPLELATE_DIR}
9
+ ABSOLUTE_PATH_ROOT_CONF=${ABSOLUTE_PATH_ROOT}/${CONF_DIR}
10
+
11
+ ABSOLUTE_PATH_STATUS_FILE=${ABSOLUTE_PATH_ROOT_CONF}/<%= statusFile %>
12
+ ABSOLUTE_PATH_SITE_FILE=${ABSOLUTE_PATH_ROOT_CONF}/<%= siteFile %>
13
+ ABSOLUTE_PATH_ROOT_SETTINGFILE=${ABSOLUTE_PATH_ROOT_CONF}/<%= settingfile %>
14
+
15
+ DATA_DIR=<%= dataDir %>
16
+ WORK_DIR=<%= workDir %>
17
+ MATERIAL_DIR=<%= materialDir %>
18
+
19
+ <%= url %>
20
+
21
+ TARGET_COMMAND_INDEX=0
22
+ SUBTARGET_COMMAND_INDEX=1
23
+ KEY_INDEX=2
24
+ HTMLFILE_INDEX=3
25
+ ALIAS_HTMLFILE_INDEX=4
26
+
27
+ CATEGORY_CONF_PREFIX=<%= categoryConfPrefix %>
28
+
29
+ <%= functions_variable %>
30
+ <%= functions_static %>
31
+ DEFAULT_TABLE_TEMPLATE=${ABSOLUTE_PATH_ROOT_TEMPLATE}/<%= defaultTableTampleteFile %>
32
+ <%= contentDivisionWay %>
@@ -0,0 +1,3 @@
1
+ img_sample: <img src="./imgs/sample.gif" width="16" height="16">
2
+ #img_pdf: '%Q!<img src="./imgs/pdf.gif" width="16" height="16">!'
3
+ #img_archive: '%Q!<img src="./imgs/archive.gif" width="16" height="16">!'
@@ -0,0 +1 @@
1
+ s s sample sample.html