JohnMcLear/ep_context

Resolution sponsor / date parsing

Closed this issue · 9 comments

In the example doc we've been working off here, the line that reads:

Presented by_Alderman Emma Mitts_on_July 29, 2015

seems to be pretty universal ( although I'm not sure what's going on with the underscores ).

It would be useful in resolutions to strip the Presented by and on, and put the sponsor on one line and the date below it.

There isn't really a consistent format used so I will need to be pretty vague in my regex.. For exmaple

Presented by ALDERMAN CPTN A. HERP DERP on DECEMBER 9TH, 2015.

Is another format used..

Also the example doc just points back to here ;)

I'm just trying basic line creation logic and this doesn't work..

The problem is that replace Range method can't include a line break in the replacement.. If you attempt that you get

Uncaught Error: Failed assertion: mismatched composition of two changesetserror @ VM7729:5966assert @ VM7729:5980exports.compose @ VM7729:7248doRecordUndoInformation @ VM7729:2243doRepApplyChangeset @ VM7729:2246performDocumentApplyChangeset @ VM7729:2076performDocumentReplaceRange @ VM7729:2322(anonymous function) @ VM7729:890inCallStackIfNecessary @ VM7729:545replaceRange @ VM7729:887wrapper @ VM7729:919Ace2Inner.editorInfo.ace_callWithAce @ VM7729:938wrapper @ VM7729:919Ace2Inner.editorInfo.ace_callWithAce @ VM7729:938normalizedhook @ VM7728:13346hookCallWrapper @ VM7728:13352(anonymous function) @ VM7728:13407_.map._.collect @ VM7728:11318exports.callAll @ VM7728:13406inCallStack @ VM7729:474inCallStackIfNecessary @ VM7729:541(anonymous function) @ VM7729:1179callback @ VM7729:1130
pad.js?callback=require.define:386 FORCED TO DISCONNECT

Which tbh is expected behavior as we are mid line iteration and logic would go out of sync..

I will spend another hour on this trying to find a way but this might have to be a line too far..

I'm pretty sure I wrestling something similar before but can't remember where/when it is so I'm currently hunting it down..

Okay I have a patch in for this but it's kinda bad as it means iterating through the whole document again..

Give it a test when you can :)

Is this something that you could re-use the logic from the "add line" function with the + button? I'll give it a test run, but just thinking out loud

That's pretty much exactly how I ended up doing it :)

Hmm. I'm not seeing it parse these out, but I'll take a look at this when I have a chance. More important to get the PDF stuff up and running

Try " on " string not "on", I think initially I just handle that explicit string

I took out the _on_ line and tweaked the whitespace one character. This is good for now.