Skip to content
This repository has been archived by the owner on Mar 20, 2020. It is now read-only.

Improvement: Text after % field seperator #9

Open
sandersantema opened this issue Jan 3, 2019 · 2 comments
Open

Improvement: Text after % field seperator #9

sandersantema opened this issue Jan 3, 2019 · 2 comments

Comments

@sandersantema
Copy link

Hi there,

I've modified your code to allow for 11 fields, this is my basic card type (I don't have that many fields which I actually use for text, some work as toggles). Since it's quite hard to see which of the 11 % symbols belongs to which of the 11 fields it would be nice to put some text after the % symbol.

For instance:

Front

% Back:

Back

% Field 3:

Content of field 3.

etc.

Would there be a simple way to implement this?

@benwr
Copy link
Owner

benwr commented Jan 3, 2019

I think this could be a relatively straightforward change to the produce_cards function; it might require also doing some work to make the card type configurable. I don't know that I'll have time to do this myself any time soon, but I'm not opposed to its addition if you wanted to make the changes, and would review a PR.

@sandersantema
Copy link
Author

sandersantema commented Jan 4, 2019

I've come up with a solution but since I barely know any Python I really don't think it's any good, but it works! I don't know any git either so I'll just post it here for others who want a quick fix or don't know any python either. Besides that I'll try to look into the produce_cards function and see if I can come up with a proper solution.

I've placed this at the end of the determine_media_references(self): definition (def?)

            self.fields[i] = re.sub(r'<p>', '', current_stage)
            self.fields[i] = re.sub(r'</p>', '', current_stage)
            self.fields[i] = re.sub(r'[%].*\n', '', current_stage)

Line 1 and 2 replace the paragraph stuff. About line 3: when I put text after the percent sign it treats that line as a field and puts it in the fields array, line 3 edits it out of the fields array by searching for the percent sign until the linebreak regardless of the contents.

As I said this is really hacky but for the moment it works.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants