casetdown 0.9.0 → 0.9.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7db61cc282539ad38b94b953931b8801cc91dbd43c1bfe2941c7a56fce92abaa
4
- data.tar.gz: 79034f081e7a5bcc75b0e00a579ed5c26c312a4acfc909457c0247b5cb806052
3
+ metadata.gz: 31328bc34c10788c8361a1d14422bb6a5dba8630058b29b135e261be7b2dd4d9
4
+ data.tar.gz: 1793df4dcb84ebc7de9c25dd881b45cbb6aa1ad3bc70abd559a0be2027229d97
5
5
  SHA512:
6
- metadata.gz: f6a439b490240278afb3e86d3f6061b3b8115023d6daada7f5075ad3ceb6f304a671332b45089904ac571892078598db3e0e757cab62d08f979e4abfdd794981
7
- data.tar.gz: d0c622a8dde0dbe7457ba7909bfa82bf8a8a25fda7275eceaed39589bb4070dcbe7d2637a770d2698c428de7e9322158a2e9873bd1cbea9c44e604e599ab5d10
6
+ metadata.gz: 22cd11e74afcb7b396b19dbade9ce481974377e91b92eb343842c4523ba54b78b2c319d400272d4cdecd1b64460d27d92859c423309e42fd433573c3f0c35dfa
7
+ data.tar.gz: a3abef0e944183a284848604ce9f11ad7092f585efd776495a7da464c31b92e27b72e3f9b3b5282e11a4fd0d6b786598b06c99d682de1225d51d9fd6bcd114cf
data/EnData/endata-app.rb CHANGED
@@ -28,7 +28,7 @@ module EnData
28
28
  def table name='table'
29
29
  EnData.load()
30
30
  EnData.parse()
31
- EnData.run(EnData.source (EnData.select name: name))
31
+ EnData.run(EnData.source EnData.select name: name)
32
32
  end
33
33
 
34
34
  def join_table name1, name2
data/Tabot/newtab.rb CHANGED
@@ -5,10 +5,24 @@ module Newtab
5
5
  module_function
6
6
 
7
7
  def trans_table file, sheet, env='conda activate py311', temp='_temp.json'
8
+ $env ||= env
8
9
  table = %Q|python -c "import pandas as pd;pd.read_excel('#{file}',sheet_name='#{sheet}').to_json('#{temp}',orient='records',force_ascii=False)"|
9
- system("#{env} && #{table}")
10
+ system("#{$env} && #{table}")
10
11
  doc = JSON.parse File.read(temp)
11
12
  File.delete(temp)
12
13
  return doc
13
14
  end
15
+
16
+ def sheets file, env='conda activate py311', temp='_temp.rb'
17
+ $env ||= env
18
+ table = %Q|python -c "import pandas as pd; bk=pd.ExcelFile('#{file}'); file = open('#{temp}', 'w', encoding='utf-8'); file.write(str(bk.sheet_names)); file.close()"|
19
+ system("#{$env} && #{table}")
20
+ doc = eval(File.read(temp))
21
+ File.delete(temp)
22
+ return doc
23
+ end
24
+
25
+ def env set='conda activate py311'
26
+ $env = set
27
+ end
14
28
  end
@@ -1,42 +1,42 @@
1
- #coding:utf-8
2
- # require 'custom-core/string'
3
-
4
- module ABString
5
- # {:;} = Left Colon and Semicolon to Right Brace(LCSRB)
6
- # {name : params ; body}
7
- def parse_lcsrb string
8
- head = "{"
9
- tail = "}"
10
- sequences = TextAbstract.match_cascade(string.gsub("\r",""),head,tail)
11
- blocks = sequences.select{|i|i.instance_of?(Array)}
12
-
13
- blocks.inject({}) do|table,block|
14
- prename,prebody = block[1..-2].join.split(":")
15
- name = diet(prename)
16
- if prebody.include?(';')
17
- preparams,postbody = prebody.split(";")
18
- params = preparams.to_s.split(",").map{|r|diet(r)}
19
- else
20
- params,postbody = [],prebody
21
- end
22
- body = diet(postbody).split("\n").map{|line|diet(line)}.join("\n")
23
- table[name] = [name,params,body]
24
- table
25
- end
26
- end
27
-
28
- def parse string,option
29
- case option
30
- when :lcsrb
31
- parse_lcsrb(string)
32
- else
33
- string
34
- end
35
- end
36
-
37
- def diet string
38
- string.strip.gsub("\t"," ")
39
- end
40
-
41
- module_function :parse,:diet,:parse_lcsrb
1
+ #coding:utf-8
2
+ # require 'custom-core/string'
3
+
4
+ module ABString
5
+ # {:;} = Left Colon and Semicolon to Right Brace(LCSRB)
6
+ # {name : params ; body}
7
+ def parse_lcsrb string
8
+ head = "{"
9
+ tail = "}"
10
+ sequences = TextAbstract.match_cascade(string.gsub("\r",""),head,tail)
11
+ blocks = sequences.select{|i|i.instance_of?(Array)}
12
+
13
+ blocks.inject({}) do|table,block|
14
+ prename,prebody = block[1..-2].join.split(":")
15
+ name = diet(prename)
16
+ if prebody.include?(';')
17
+ preparams,postbody = prebody.split(";")
18
+ params = preparams.to_s.split(",").map{|r|diet(r)}
19
+ else
20
+ params,postbody = [],prebody
21
+ end
22
+ body = diet(postbody).split("\n").map{|line|diet(line)}.join("\n")
23
+ table[name] = [name,params,body]
24
+ table
25
+ end
26
+ end
27
+
28
+ def parse string,option
29
+ case option
30
+ when :lcsrb
31
+ parse_lcsrb(string)
32
+ else
33
+ string
34
+ end
35
+ end
36
+
37
+ def diet string
38
+ string.strip.gsub("\t"," ")
39
+ end
40
+
41
+ module_function :parse,:diet,:parse_lcsrb
42
42
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: casetdown
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.0
4
+ version: 0.9.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matt
8
8
  bindir: CasetDown/bin
9
9
  cert_chain: []
10
- date: 2025-03-13 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
11
11
  dependencies: []
12
12
  description: casetdown is a test tool of markdown document
13
13
  email:
@@ -55,7 +55,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
55
55
  - !ruby/object:Gem::Version
56
56
  version: '0'
57
57
  requirements: []
58
- rubygems_version: 3.6.5
58
+ rubygems_version: 3.6.8
59
59
  specification_version: 4
60
60
  summary: test-tool
61
61
  test_files: []