Questions tagged [formatting]

A generic term meaning the process by which text transformed into a more meaningful or clearer output. A typical example would be the transformation of a decimal into a particular currency format with the correct number of decimal places.

19 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
11
votes
0answers
387 views

Document formatting markup engine in Postscript

I've been rewriting this same sort of thing off and on over the years, but finally here's the "perfected" monstrosity. Some kruft in the middle with attempting to predict the number of spaces that ...
4
votes
0answers
127 views

C++ string Formatter Again Part-4

Previously asked here. The code is now available on GitHub. Since the previous review I have added unit tests. Since it is big it will come in a couple of parts. Part 1 | Part 2 | Part 3 | Part 4 ...
3
votes
0answers
28 views

Formatting CSV as a table using BDD

This is the problem: Write a function to create a table from CSV data. The input to the function is a list of strings. Each string is formatted as a CSV record. Here’s an example for a ...
3
votes
0answers
122 views

Script to auto-generate Markdown tables of contents

I would greatly appreciate feedback on the enclosed script, which auto-generates a Markdown table of contents for Github-flavoured Markdown, with respect to: Consistency with Ruby idiom & style ...
3
votes
0answers
526 views

Recursively list files in provided directory in the style of `npm ls`

I've written a small CLI node program to list the contents of a directory with an output similar to that provided by npm ls but listing both files and directories, ...
2
votes
0answers
78 views

VIm function that runs file through shfmt

I've written a Vim function that formats the file using shfmt. I'd like to know if there is a way I can improve this script. I am bothered by the fact that I can't think of a way to do this without ...
2
votes
0answers
61 views

Composing commands to control virtual machines

I created a function which takes some inputs and builds a specific set of strings. The function is working as intended, however I can't help thinking how ridiculous it looks every time I see it. I ...
2
votes
0answers
50 views

Display results from a JSON response based on game type

This code currently works with no errors. I want to know if there is a way to improve its conding structure, as there is a lot of repetition and it looks really bad. I tried an alternative way by ...
2
votes
0answers
225 views

Convert python's strftime directives to user-friendly format examples

I'm converting python's very un user-friendly strftime date time directives to user-friendly formats so that users of an API will know how to format a date if they send an invalid format. My thinking ...
2
votes
0answers
4k views

Regex credit card expiry date auto format

I'm trying to write a function that will get content from input element and try to format numbers entered in input box in MM/YY. Following is a solution that I have, and I want to reduce the number of ...
1
vote
0answers
15 views

Terraform/HCL - First element (or any arbitrary element) from a list of sets, combined into a list

So I am working with Terraform and I feel like there must be a faster or, at the very least, a prettier way to perform the operation I'm attempting. For some boilerplate, I have a data block that ...
1
vote
0answers
20 views

Extract and manipulate date from SharePoint and export into Google Charts

I am extracting a list of data from a SharePoint library with CSOM, then manipulating the data to give some sort of visible statistic through Google Charts. The data is a list of each parent ...
1
vote
0answers
25 views

Append string to list items based on function arguments

My goal with this function is to append a string to a list that's being manipulated first, then return the manipulated string. This all happens with a bit of logic in-between, making me loop through ...
1
vote
0answers
89 views

Echo in Prolog with single print (new version)

In order to learn a bit more of Prolog, I implemented the echo command for SWI-Prolog. I want a correct implementation, that is, it satisfies the following requirements: It makes only one I/O call ...
1
vote
0answers
55 views

Recursive time formatter

This is small utility class I made format.utility.ts. There are some other one off utility methods in here I removed for this. The one in question is ...
1
vote
0answers
68 views

MessageFormat in 2 Locales

I have an HTML template that contains a letter in two languages, EG German & English. I should fill in the same data in both languages. Excerpt from template: ...
1
vote
0answers
212 views

Cookie Clicker esque game idea

I am making a cookie clicker type game as a small project, within Xcode, written in Swift. I have a been developing a function which will turn a Int64() into a 4 ...
1
vote
0answers
227 views

Parse a plain text newsletter and show it with nicer markdown formatting

I wrote some code to parse an e-mailed events newsletter I'm on and redisplay it with better formatting. I like the output, but I'm not thrilled with the code. It feels like there's a lot of ...
0
votes
0answers
20 views

Formatter for converting legacy markup to markdown links

This program converts legacy markup in the form seen in the tests to the resulting markdown seen in the test's respective comment. The full program is as uploaded as a snippet, or you may see below <...