Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FEATURE] SpanQuestion for text within customField Template #5721

Open
mikodham opened this issue Nov 28, 2024 · 0 comments
Open

[FEATURE] SpanQuestion for text within customField Template #5721

mikodham opened this issue Nov 28, 2024 · 0 comments
Labels
status: question Indicates that an issue or pull request needs more information type: enhancement Indicates new feature requests

Comments

@mikodham
Copy link

mikodham commented Nov 28, 2024

I am wondering if there is a "rg.SpanQuestion" like feature where the text can be extracted from css+html template.
For example, simple css and html template below where we have two column of text side by side.
I wonder if we can allow rg.SpanQuestion to take a sub-field "text_field.processed"

Thank you!

# Defining Template for Settings
css_template = """
<style>
#container {
    display: flex;
    gap: 10px;
}
.column {
    flex: 1;
}
.column p {
    white-space: pre-wrap; /* Preserve line breaks and whitespace */
    border: 1px solid #ccc;
    padding: 10px;
    border-radius: 5px;
}
</style>
""" # 

html_template = """
<div id="container">
    <div class="column">
        <h3>Original</h3>
        <p>{{record.fields.text_field.raw}}</p>
    </div>
    <div class="column">
        <h3>Revision</h3>
        <p>{{record.fields.text_field.processed}}</p>
    </div>
</div>

custom_field = rg.CustomField(
    name="text_field",
    template =  css_template + html_template
)

# Inserting Records
records = [
    rg.Record(
        fields={
            "text_field": {
                "raw":  "$SOMETEXTDATA",
                "processed": "$SOMETEXTDATA",
            }
        },

    ),
]
"""
@mikodham mikodham changed the title [FEATURE] [FEATURE] SpanQuestion for text within customField Template Nov 28, 2024
@frascuchon frascuchon added type: enhancement Indicates new feature requests status: question Indicates that an issue or pull request needs more information labels Jan 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: question Indicates that an issue or pull request needs more information type: enhancement Indicates new feature requests
Projects
None yet
Development

No branches or pull requests

2 participants