Skip to content

Commit

Permalink
Merge pull request #270 from PDConSec/269-lines-get-cutoff-in-the-pri…
Browse files Browse the repository at this point in the history
…nted-version

269 lines get cutoff in the printed version
  • Loading branch information
PeterWone authored Sep 17, 2023
2 parents 63dc70e + 62ac969 commit c47d8e7
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 4 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Change Log

### 0.11.16

- Line breaking bugfix

### 0.11.14

- Support for document renderers to linking and serving script files
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "vscode-print",
"displayName": "Print",
"description": "Rendered Markdown, coloured code.",
"version": "0.11.15",
"version": "0.11.16",
"icon": "assets/vscode-print-128.png",
"author": {
"name": "Peter Wone",
Expand Down
7 changes: 4 additions & 3 deletions src/html-renderer-sourcecode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,21 +32,22 @@ export function getBodyHtml(raw: string, languageId: string, options?: any): str
}
renderedCode = fixMultilineSpans(renderedCode);
const printConfig = vscode.workspace.getConfiguration("print");
const bpre = /([^ -<]{40}|\)\]\},)/g;
const pattern = /((?:(?:[A-Za-z0-9_]{40}|[\])},;=]))(?![^<>]*>))/g;
const replacement = "$1<wbr>";
logger.debug(`Line numbering: ${printConfig.lineNumbers} (resolves to ${options.lineNumbers})`)
if (options.lineNumbers) {
renderedCode = renderedCode
.split("\n")
.map(line => line || "&nbsp;")
.map((line, i) => `<tr><td class="line-number">${options.startLine + i}</td><td class="line-text">${line.replace(bpre, "$1<wbr>")}</td></tr>`)
.map((line, i) => `<tr><td class="line-number">${options.startLine + i}</td><td class="line-text">${line.replace(pattern, replacement)}</td></tr>`)
.join("\n")
.replace("\n</td>", "</td>")
;
} else {
renderedCode = renderedCode
.split("\n")
.map(line => line || "&nbsp;")
.map((line, i) => `<tr><td class="line-text">${line.replace(bpre, "$1<wbr>")}</td></tr>`)
.map((line, i) => `<tr><td class="line-text">${line.replace(pattern, replacement)}</td></tr>`)
.join("\n")
.replace("\n</td>", "</td>")
;
Expand Down
16 changes: 16 additions & 0 deletions src/test/test-docs/sample.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
def main(master_path):

#this code puts the logs and environment details in the directory component of input_path; if input path ends in a directory name,
# it will be treated as a directory not the file; i.e. f"G:\directoryname" will be treated as a request to put output inside G:\directoryname
#and not as a request to handle a file called "directoryname" in G:\
#log file mode should be W or omitted to overwrite the log each time the program runs; and should be "a" if the program is meant to
#add log entries on each of a series of repeated runs -- "a" is appropriate for e.g. webscraping programs designed
# to pick up where they left off and produce results cumulatively
log = get_logger(master_path, __file__, __name__, logging.DEBUG, log_file_mode="w")


for diversity_parameter_times_10 in range(max_div_weight*10+1):
differentiation_weight = diversity_parameter_times_10/10
#backing off to a weight of .999 rather than 1.0 allows the citation counts to act as a tiebreaker.
(selection_vector,cites_score, citing_authors_score,weighted_score)=find_greedy_solution(authornet_dict,max_depth,differentiation_weight,production_possibility_file,noncore_vector_to_exclude,production_possibility_list,log)

0 comments on commit c47d8e7

Please sign in to comment.