To generate the report outline, I will process the provided JSON data, applying all specified structural and language requirements. Here's a breakdown of the steps: 1. Translate to English: The provided outline is already in English. I will ensure units like "thousands" are correctly represented. 2. Heading Styles: I will use for `level 1`, for level 2, for `level 3`, for level 4, and `` for level 5. 3. Concise One-Sentence Summary: I will take the summary field for each chapter, remove any trailing periods, and ensure it's a single, concise sentence. If summary is null, I will generate one based on the title. 4. Page-Jump Links: For each chapter, I will create a link in the format [Chapter Title](index=page_num&type=section&id=item_id). * Chapter Title will be chapter["title"]. * page_num will be chapter["start_page"]. * type will be page specifically for ITEM 1A. RISK FACTORS, and section for all others. * item_id will be chapter["item_id"] URL-encoded. 5. Key Points (insight type): * Display as unordered lists (-). * Bold key metrics and conclusions. I will use a heuristic to bold numbers, percentages, and dollar amounts (e.g., $12,035 thousand, 5.1%, 658 stores). * Append chunk references [chunk_num](index=chunk_num&type=chunk) in ascending order. * Remove trailing periods. 6. Key Points (table type): * Use Markdown tables. * Table titles will be subheadings (e.g., Table Title). * Include units in column headers (e.g., ($ thousands)). 7. Language Style: Formal, avoid explanatory phrases, no "Report Title", professional financial terminology, English output, no periods at the end of sentences. Let's start processing the outline. ```python import urllib.parse import re def url_encode_item_id(item_id): """URL-encodes the item_id, handling spaces and special characters.""" return urllib.parse.quote(item_id) def format_summary(summary_text): """Formats a summary to be concise and without a trailing period.""" if not summary_text: return "" summary_text = summary_text.strip() if summary_text.endswith('.'): summary_text = summary_text[:-1] return summary_text def bold_key_metrics(text): """Applies bold formatting to numbers, percentages, and dollar amounts within a string.""" Bold numbers (integers and decimals, potentially with commas) text = re.sub(r'(?<!*)\b(\d{1,3}(?:,\d{3})(?:.\d+)?)\b(?!*)', r'\1', text) Bold percentages text = re.sub(r'(?<!*)\b(\d{1,3}(?:,\d{3})(?:.\d+)?%)\b(?!*)', r'\1', text) Bold dollar amounts (e.g., $12,035, $12,035 thousand) text = re.sub(r'(?<!*)\b($\s*\d{1,3}(?:,\d{3})(?:.\d+)?(?:\sthousand)?)\b(?!*)', r'\1', text, flags=re.IGNORECASE) Bold specific phrases that are clearly metrics from the example text = text.replace("53 weeks", "53 weeks") text = text.replace("52 weeks", "52 weeks") text = text.replace("48%", "48%") text = text.replace("32%", "32%") text = text.replace("20%", "20%") text = text.replace("34%", "34%") text = text.replace("70%", "70%") text = text.replace("658 Cracker Barrel stores", "658 Cracker Barrel stores") text = text.replace("68 Maple Street Biscuit Company stores", "68 Maple Street Biscuit Company stores") text = text.replace("68 Maple Street Biscuit Company locations", "68 Maple Street Biscuit Company locations") text = text.replace("77,600 people", "77,600 people") text = text.replace("5.1% increase", "5.1% increase") text = text.replace("0.8% to $3,470,762 thousand", "0.8% to $3,470,762 thousand") text = text.replace("7.19%", "7.19%") text = text.replace("15.88 Years", "15.88 Years") text = text.replace("5.38 %", "5.38 %") text = text.replace("1.43 years", "1.43 years") text = text.replace("0.625%", "0.625%") text = text.replace("5.3153 shares", "5.3153 shares") text = text.replace("6.2713 shares", "6.2713 shares") text = text.replace("223.24 per share", "223.24 per share") text = text.replace("0.01 per Right", "0.01 per Right") text = text.replace("50% up to 5%", "50% up to 5%") text = text.replace("25% up to 6%", "25% up to 6%") text = text.replace("4.4%", "4.4%") text = text.replace("(69.2)%", "(69.2)%") text = text.replace("20% or more", "20% or more") text = text.replace("50% or more", "50% or more") text = text.replace("1,300 in 2024", "1,300 in 2024") text = text.replace("83% of Cracker Barrel stores", "83% of Cracker Barrel stores") text = text.replace("approximately $5,700 thousand", "approximately $5,700 thousand") text = text.replace("averaging $835 thousand", "averaging $835 thousand") text = text.replace("358 stores", "358 stores") text = text.replace("368 properties", "368 properties") text = text.replace("370,000 square feet", "370,000 square feet") text = text.replace("15 Cracker Barrel stores", "15 Cracker Barrel stores") text = text.replace("64 Cracker Barrel stores", "64 Cracker Barrel stores") text = text.replace("62 Cracker Barrel stores", "62 Cracker Barrel stores") text = text.replace("982,523 shares", "982,523 shares") text = text.replace("one to three years", "one to three years") text = text.replace("three-year term", "three-year term") text = text.replace("171,792 shares", "171,792 shares") text = text.replace("6,229 shareholders", "6,229 shareholders") text = text.replace("$200,000 thousand", "$200,000 thousand") text = text.replace("$180,000 thousand", "$180,000 thousand") text = text.replace("$300,000 thousand", "$300,000 thousand") text = text.replace("$600,000 thousand to $700,000 thousand", "$600,000 thousand to $700,000 thousand") text = text.replace("$160,000 thousand to $180,000 thousand", "$160,000 thousand to $180,000 thousand") text = text.replace("$0.25 per share", "$0.25 per share") text = text.replace("$1,800 thousand", "$1,800 thousand") text = text.replace("$267,939 thousand", "$267,939 thousand") text = text.replace("$17,448 thousand", "$17,448 thousand") text = text.replace("$11,692 thousand", "$11,692 thousand") text = text.replace("$4,690 thousand", "$4,690 thousand") text = text.replace("$725,830 thousand", "$725,830 thousand") text = text.replace("$5,752 thousand", "$5,752 thousand") text = text.replace("$11,397 thousand", "$11,397 thousand") text = text.replace("$10,713 thousand", "$10,713 thousand") text = text.replace("$9,572 thousand", "$9,572 thousand") text = text.replace("$84,854 thousand", "$84,854 thousand") text = text.replace("$88,556 thousand", "$88,556 thousand") text = text.replace("$1,544 thousand", "$1,544 thousand") text = text.replace("$12,615 thousand", "$12,615 thousand") text = text.replace("$32,644 thousand", "$32,644 thousand") text = text.replace("$7,404 thousand", "$7,404 thousand") text = text.replace("30 years of experience", "30 years of experience") text = text.replace("August 2, 2024", "August 2, 2024")
Cracker Barrel(CBRL) - 2024 Q4 - Annual Report