Skip newlines and YAML metadata at the beginning of a markdown file
This commit is contained in:
		
							
								
								
									
										2
									
								
								build.sh
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								build.sh
									
									
									
									
									
								
							| @@ -91,7 +91,7 @@ del_files_in_output() { | ||||
|  | ||||
| read_metadata() { | ||||
| #	Read the metadata from the top of a .md file into a string | ||||
| 	metadata=$(awk 'BEGIN{RS = "\n\n"} {print $0}; {exit}' "$1")  # Reads from the .md file until a double-newline is encountered | ||||
| 	metadata=$(awk 'BEGIN{RS = "\n\n"} ($0 != "") && ($0 !~ /^---/) {print $0; exit}' "$1")  # Reads from the .md file until a double-newline is encountered, as long as 1) the text read is non-empty and 2) it doesn't start with a triple hyphen (the triple hyphen denotes a pandoc metadata block) | ||||
| } | ||||
|  | ||||
| convert_to_array() { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user