inline_fn 0.1.5 → 0.1.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8d19738fc73f2dd8bd8e97ced36a0c455be956445cc79fb531f0265cc18adf2a
4
- data.tar.gz: 25df06d45e878b673c2000aedbedd24ab62ac759e4658d55ed968139c47f218b
3
+ metadata.gz: c6a2cadf2f018c1a0234c64d3d7ba9da22cbbb95f8210e7d13b888074851bd9f
4
+ data.tar.gz: dba524dfba1ec0ab477825c3fbff096b56dc768bd6f33b1998087e173274ee31
5
5
  SHA512:
6
- metadata.gz: 4b5a526ad0b24bc01a51edeead9b8bd7f6cb3cd7fbfce13c71f9710d6b5d3324d39deb613dc0c6ff864df8d20f4c14adc7addb64dc8d98887bf2c0658ebef56e
7
- data.tar.gz: da1eded3fd310d43991fa7f8ec795e7543a202c02b41569cca3fd63d27a58f98cbcb9d3c75b4e83f54dbe86e83e1ba4e7f31c3cddb2ab5e2c8c3b49a6909fdaf
6
+ metadata.gz: 2b2ff9476c68b79a15ec0a989d4bee9d28644215ab70fd308eca257d2647edd96e801ea10753beb5b5b1fcc0d4674bad629690f3bb1698e20f79647f3bbfefa8
7
+ data.tar.gz: 22d7c2e968376e3cc4acbcdbb8ca649fc6218992192f78ddd3c74e44cabfc149d93129f0066050217df65cf25e2cd958f06da954ad0a7394081e788c4f1cfe82
data/.idea/workspace.xml CHANGED
@@ -4,9 +4,8 @@
4
4
  <option name="autoReloadType" value="SELECTIVE" />
5
5
  </component>
6
6
  <component name="ChangeListManager">
7
- <list default="true" id="ca42f8e7-82dc-4786-8148-99f859f55553" name="Changes" comment="2022-07-13-20-54">
7
+ <list default="true" id="ca42f8e7-82dc-4786-8148-99f859f55553" name="Changes" comment="Fixed cases of unwanted prefix">
8
8
  <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
9
- <change beforePath="$PROJECT_DIR$/lib/inline_fn.rb" beforeDir="false" afterPath="$PROJECT_DIR$/lib/inline_fn.rb" afterDir="false" />
10
9
  <change beforePath="$PROJECT_DIR$/lib/inline_fn/version.rb" beforeDir="false" afterPath="$PROJECT_DIR$/lib/inline_fn/version.rb" afterDir="false" />
11
10
  </list>
12
11
  <option name="SHOW_DIALOG" value="false" />
@@ -32,10 +31,10 @@
32
31
  "RunOnceActivity.OpenProjectViewOnStart": "true",
33
32
  "RunOnceActivity.ShowReadmeOnStart": "true",
34
33
  "SHARE_PROJECT_CONFIGURATION_FILES": "true",
34
+ "node.js.selected.package.tslint": "(autodetect)",
35
35
  "nodejs_package_manager_path": "npm",
36
36
  "ruby.rails.projectView.checked": "true",
37
- "settings.editor.selected.configurable": "terminal",
38
- "vue.rearranger.settings.migration": "true"
37
+ "settings.editor.selected.configurable": "terminal"
39
38
  }
40
39
  }]]></component>
41
40
  <component name="RunManager" selected="Test::Unit/Shoulda/Minitest.test_inline_fn_mmd">
@@ -138,7 +137,6 @@
138
137
  <option name="presentableId" value="Default" />
139
138
  <updated>1657691753423</updated>
140
139
  <workItem from="1657691754700" duration="5726000" />
141
- <workItem from="1675194856020" duration="190000" />
142
140
  </task>
143
141
  <task id="LOCAL-00001" summary="initial commit">
144
142
  <created>1657693651385</created>
@@ -161,7 +159,14 @@
161
159
  <option name="project" value="LOCAL" />
162
160
  <updated>1657756484127</updated>
163
161
  </task>
164
- <option name="localTasksCounter" value="4" />
162
+ <task id="LOCAL-00004" summary="Fixed cases of unwanted prefix">
163
+ <created>1675205908454</created>
164
+ <option name="number" value="00004" />
165
+ <option name="presentableId" value="LOCAL-00004" />
166
+ <option name="project" value="LOCAL" />
167
+ <updated>1675205908454</updated>
168
+ </task>
169
+ <option name="localTasksCounter" value="5" />
165
170
  <servers />
166
171
  </component>
167
172
  <component name="TypeScriptGeneratedFilesManager">
@@ -182,11 +187,12 @@
182
187
  <MESSAGE value="initial commit" />
183
188
  <MESSAGE value="2022-07-13-03-31" />
184
189
  <MESSAGE value="2022-07-13-20-54" />
185
- <option name="LAST_COMMIT_MESSAGE" value="2022-07-13-20-54" />
190
+ <MESSAGE value="Fixed cases of unwanted prefix" />
191
+ <option name="LAST_COMMIT_MESSAGE" value="Fixed cases of unwanted prefix" />
186
192
  </component>
187
193
  <component name="com.intellij.coverage.CoverageDataManagerImpl">
188
194
  <SUITE FILE_PATH="coverage/inline_fn@test_inline_fn_mmd.rcov" NAME="test_inline_fn_mmd Coverage Results" MODIFIED="1657693593278" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="rcov" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$" MODULE_NAME="inline_fn" />
189
195
  <SUITE FILE_PATH="coverage/inline_fn@test_inline_fn_pandoc.rcov" NAME="test_inline_fn_pandoc Coverage Results" MODIFIED="1657693539353" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="rcov" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$" MODULE_NAME="inline_fn" />
190
- <SUITE FILE_PATH="coverage/inline_fn@inline_fn.rcov" NAME="inline_fn Coverage Results" MODIFIED="1657693319814" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="rcov" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$" MODULE_NAME="inline_fn" />
196
+ <SUITE FILE_PATH="coverage/inline_fn@inline_fn.rcov" NAME="inline_fn Coverage Results" MODIFIED="1675205563442" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="rcov" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$" MODULE_NAME="inline_fn" />
191
197
  </component>
192
198
  </project>
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module InlineFn
4
- VERSION = '0.1.5'
4
+ VERSION = '0.1.6'
5
5
  end
data/lib/inline_fn.rb CHANGED
@@ -6,17 +6,11 @@ require_relative 'inline_fn/version'
6
6
  module InlineFn
7
7
  class Error < StandardError; end
8
8
 
9
- def inline_fn(text, style, *array_of_strs)
10
- # str is the text to be processed
11
- # style is the style of the inline footnote: :pandoc or :mmd
12
- # text is an optional array of strings `%w{fn cf}` that need to be removed from the footnotes before processing. This is useful in case you are converting Scrivener footnotes (`[^fn1]` or `[^cf1]`).
9
+ def inline_fn(str, style = :pandoc)
13
10
  ref_start = ''
11
+ text = str
14
12
  counter = 0
15
13
 
16
- array_of_strs.each do |str|
17
- text = text.gsub(/\[\^#{str}/, '[^')
18
- end
19
-
20
14
  until ref_start.nil?
21
15
  counter += 1
22
16
  cite = "[^#{counter}]"
@@ -46,17 +40,9 @@ module InlineFn
46
40
  text = text.gsub(/\n\s*\^\[/, "\n^[")
47
41
  cut_point = text.index("\n^")
48
42
  end
49
- # p text
50
- error_msg = <<~EOF
51
- ERROR: No cut point found.
52
-
53
- Footnotes should be in the format `[^1]` AND NOT `[^fn1]` or `[^cf1]`. If you are converting Scrivener markdown, please use the `scrivener_to_pandoc` (== inline_fn(self, :pandoc, 'fn', 'cf')) or `scrivener_to_mmd` (== inline_fn(self, :mmd, 'fn', 'cf')) methods.
54
-
55
- If you have footnotes in other formats, you can try the `inline_fn` method. It takes as arguments the text to be processed, the style of the inline footnote: :pandoc or :mmd, and an optional array of strings `%w{fn cf}` that need to be removed from the footnotes before processing.
56
- EOF
57
43
 
58
- text = text[0, cut_point] rescue error_msg
59
- puts "#{counter -= 1} notes replaced."
44
+ text = text[0, cut_point]
45
+ # puts "#{counter -= 1} notes replaced."
60
46
  end
61
47
  text
62
48
  end
@@ -65,26 +51,9 @@ EOF
65
51
  inline_fn(self, :pandoc)
66
52
  end
67
53
 
68
- def pandoc_fn
69
- inline_fn_pandoc
70
- end
71
-
72
54
  def inline_fn_mmd
73
55
  inline_fn(self, :mmd)
74
56
  end
75
-
76
- def mmd_fn
77
- inline_fn_mmd
78
- end
79
-
80
- def scrivener_to_pandoc
81
- inline_fn(self, :pandoc, 'fn', 'cf')
82
- end
83
-
84
- def scrivener_to_mmd
85
- inline_fn(self, :mmd, 'fn', 'cf')
86
- end
87
-
88
57
  end
89
58
 
90
59
  class String
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: inline_fn
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5
4
+ version: 0.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bernardo C.D.A. Vasconcelos