Commit 74a2eebf by Cuong Tran

Merge pull request #171 from swistak/develop

Adjusting column match regexp to match markdown template
parents 91033bb6 f906b6fd
...@@ -222,7 +222,7 @@ module AnnotateModels ...@@ -222,7 +222,7 @@ module AnnotateModels
old_header = old_content.match(header_pattern).to_s old_header = old_content.match(header_pattern).to_s
new_header = info_block.match(header_pattern).to_s new_header = info_block.match(header_pattern).to_s
column_pattern = /^#[\t ]+\w+[\t ]+.+$/ column_pattern = /^#[\t ]+[\w\*`]+[\t ]+.+$/
old_columns = old_header && old_header.scan(column_pattern).sort old_columns = old_header && old_header.scan(column_pattern).sort
new_columns = new_header && new_header.scan(column_pattern).sort new_columns = new_header && new_header.scan(column_pattern).sort
...@@ -235,7 +235,7 @@ module AnnotateModels ...@@ -235,7 +235,7 @@ module AnnotateModels
# Replace inline the old schema info with the new schema info # Replace inline the old schema info with the new schema info
new_content = old_content.sub(PATTERN, info_block + "\n") new_content = old_content.sub(PATTERN, info_block + "\n")
if new_content.end_with? (info_block + "\n") if new_content.end_with?(info_block + "\n")
new_content = old_content.sub(PATTERN, "\n" + info_block) new_content = old_content.sub(PATTERN, "\n" + info_block)
end end
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment