mirror of
https://github.com/jzillmann/pdf-to-markdown.git
synced 2024-11-24 00:33:48 +01:00
List intendation
This commit is contained in:
parent
c39f410d76
commit
71b31c2fb5
@ -105,17 +105,17 @@ Also los!
|
||||
Und Untergruppen:
|
||||
|
||||
- Eintrag 1
|
||||
- Sub Eintrag 1.1, aber mit so langem Text, das er umbricht. Wirklich, wirklich lang. Breche du
|
||||
Zeile. Na los. Na endlich. Vielleicht sollt ich das auf 3 Zeilen erweitern? Na ja, schaden kann
|
||||
es ja nicht. Also los!
|
||||
- Sub Eintrag 1.
|
||||
- Sub Eintrag 1.1, aber mit so langem Text, das er umbricht. Wirklich, wirklich lang. Breche du
|
||||
Zeile. Na los. Na endlich. Vielleicht sollt ich das auf 3 Zeilen erweitern? Na ja, schaden kann
|
||||
es ja nicht. Also los!
|
||||
- Sub Eintrag 1.2
|
||||
- Eintrag 2
|
||||
- Sub Eintrag 2.
|
||||
- Sub Eintrag 2.1
|
||||
|
||||
Und eine mit bullet’s:
|
||||
|
||||
- Eintrage 1
|
||||
- Eintrage 2
|
||||
• Eintrage 1
|
||||
• Eintrage 2
|
||||
|
||||
Gemixt:
|
||||
|
||||
@ -147,27 +147,26 @@ Zwei aufeinander folgende Listen:
|
||||
- Zwote 1
|
||||
- Zwote 2
|
||||
|
||||
|
||||
Liste mit drei Levels:
|
||||
|
||||
- Erster Level 1
|
||||
- Zwoter Level 1.1, aber mit so langem Text, das er umbricht. Wirklich, wirklich lang. Breche du
|
||||
Zeile. Na los. Na endlich. Vielleicht sollt ich das auf 3 Zeilen erweitern? Na ja, schaden kann
|
||||
es ja nicht. Also los!
|
||||
- 3ter Level 1.1.
|
||||
- 3ter Level 1.1.2, aber mit so langem Text, das er umbricht. Wirklich, wirklich lang. Breche
|
||||
du Zeile. Na los. Na endlich. Vielleicht sollt ich das auf 3 Zeilen erweitern? Na ja, schaden
|
||||
kann es ja nicht. Also los!
|
||||
- Zwoter Level 1.
|
||||
- Zwoter Level 1.
|
||||
- 3ter Level 1.3.
|
||||
- Zwoter Level 1.1, aber mit so langem Text, das er umbricht. Wirklich, wirklich lang. Breche du
|
||||
Zeile. Na los. Na endlich. Vielleicht sollt ich das auf 3 Zeilen erweitern? Na ja, schaden kann
|
||||
es ja nicht. Also los!
|
||||
- 3ter Level 1.1.1
|
||||
- 3ter Level 1.1.2, aber mit so langem Text, das er umbricht. Wirklich, wirklich lang. Breche
|
||||
du Zeile. Na los. Na endlich. Vielleicht sollt ich das auf 3 Zeilen erweitern? Na ja, schaden
|
||||
kann es ja nicht. Also los!
|
||||
- Zwoter Level 1.2
|
||||
- Zwoter Level 1.3
|
||||
- 3ter Level 1.3.1
|
||||
- Erster Level 2
|
||||
|
||||
Und nun nummeriert mit un-nummerierten Sub-Leveln:
|
||||
|
||||
1. Eintrag 1
|
||||
- Eintrag 1.
|
||||
- Eintrag 1.
|
||||
- Eintrag 1.1
|
||||
- Eintrag 1.2
|
||||
2. Eintrag 2
|
||||
|
||||
Und jetzt eine Liste, die übergangslos aus einem zwei-zeiligen Paragraphen folgt. Mal sehen ob
|
||||
|
@ -2339,47 +2339,47 @@ Appendix M: Summary of the six step improvement process for transfer of care
|
||||
**1**
|
||||
|
||||
• **Start out (page 10)**
|
||||
• Refer to existing policies and procedures for transfers of care in your organisation
|
||||
• Observe, measure and process map the current communication process
|
||||
• What does good look like? Compare your policy and communication process with the good practice checklist.
|
||||
(Appendix B)
|
||||
• Refer to existing policies and procedures for transfers of care in your organisation
|
||||
• Observe, measure and process map the current communication process
|
||||
• What does good look like? Compare your policy and communication process with the good practice checklist.
|
||||
(Appendix B)
|
||||
|
||||
**2**
|
||||
|
||||
• **Define and scope (page 13)**
|
||||
• Begin to answer the three questions of the model for improvement (Appendix C)
|
||||
• Set your project aim and scope and link this to your organisational big issues on a driver diagram (page 22)
|
||||
• Engage staff, patients, clients and residents using patient stories and evidence from useful resources
|
||||
• Choose your project team, include senior and frontline staff and patients/clients/residents
|
||||
• Document your project plan (Appendix F) and use the sustainaiblity guide to think about long term impact of change
|
||||
• Begin to answer the three questions of the model for improvement (Appendix C)
|
||||
• Set your project aim and scope and link this to your organisational big issues on a driver diagram (page 22)
|
||||
• Engage staff, patients, clients and residents using patient stories and evidence from useful resources
|
||||
• Choose your project team, include senior and frontline staff and patients/clients/residents
|
||||
• Document your project plan (Appendix F) and use the sustainaiblity guide to think about long term impact of change
|
||||
|
||||
**3**
|
||||
|
||||
• **Measure and understand (page 19)**
|
||||
• Choose and define your outcomes and process measures, collect baseline data and display on run or SPC charts
|
||||
• Choose and define your outcomes and process measures, collect baseline data and display on run or SPC charts
|
||||
|
||||
**4**
|
||||
|
||||
• **Design and plan (page 24)**
|
||||
• Design your standard transfer of care template and test using Plan Do Study Act (PDSA) cycles (Appendix I & J)
|
||||
• Use dot voting to define your minimum data set (Appendix G)
|
||||
• Select a standardised communication tool (e.g. SBAR) to organise your minimum data set
|
||||
• Generate and test other change ideas using the good practice checklist (Appendix B) and examples (Appendix K)
|
||||
• Choose process measures (Appendix H) collect data and display on run or SPC charts
|
||||
• Design your standard transfer of care template and test using Plan Do Study Act (PDSA) cycles (Appendix I & J)
|
||||
• Use dot voting to define your minimum data set (Appendix G)
|
||||
• Select a standardised communication tool (e.g. SBAR) to organise your minimum data set
|
||||
• Generate and test other change ideas using the good practice checklist (Appendix B) and examples (Appendix K)
|
||||
• Choose process measures (Appendix H) collect data and display on run or SPC charts
|
||||
|
||||
**5**
|
||||
|
||||
• **Pilot and implement (page 34)**
|
||||
• Document your new standardised transfer of care process
|
||||
• Plan your tests for implementation using PDSA cycles. Plan training, measurement, resources & stakeholder
|
||||
engagement. (Appendix I & J)
|
||||
• Consider 'flexible standardisation' and spread good practice to other teams, departments and organisations
|
||||
• Document your new standardised transfer of care process
|
||||
• Plan your tests for implementation using PDSA cycles. Plan training, measurement, resources & stakeholder
|
||||
engagement. (Appendix I & J)
|
||||
• Consider 'flexible standardisation' and spread good practice to other teams, departments and organisations
|
||||
|
||||
**6**
|
||||
|
||||
• **Sustain and share (page 38)**
|
||||
• Use the sustainability guide to ensure your changes will be sustained
|
||||
• Celebrate and spread your success through conferences, posters, journal articles etc. (Appendix L)
|
||||
• Use the sustainability guide to ensure your changes will be sustained
|
||||
• Celebrate and spread your success through conferences, posters, journal articles etc. (Appendix L)
|
||||
|
||||
### Product timeline
|
||||
|
||||
|
@ -5,6 +5,7 @@ export default class Item {
|
||||
page: number;
|
||||
data: object;
|
||||
uuid: string;
|
||||
listLevel = 0;
|
||||
tokenTypes: TokenType[] = [];
|
||||
|
||||
constructor(page: number, data: object, tokenTypes: TokenType[] = [], uuid: string = uuidv4()) {
|
||||
|
@ -61,20 +61,25 @@ export function lineToText(lineItems: Item[], blockTypes: TextType[]) {
|
||||
};
|
||||
|
||||
let lastLineItem: Item = null;
|
||||
lineItems.forEach((lineItem, lineIndex) => {
|
||||
lineItems.forEach((lineItem, indexInLine) => {
|
||||
const words = toWords(lineItem.data['str']);
|
||||
words.forEach((word, wordIndex) => {
|
||||
if (indexInLine === 0 && wordIndex === 0) {
|
||||
if (lineItem.listLevel) {
|
||||
word = ' '.repeat(lineItem.listLevel * 2) + word;
|
||||
}
|
||||
}
|
||||
const wordFormat = lineItem.tokenTypes[0]; // bold, oblique, footnote etc...
|
||||
if (openFormat && (!wordFormat || wordFormat !== openFormat)) {
|
||||
closeFormat();
|
||||
}
|
||||
if (
|
||||
(wordIndex > 0 || lineIndex > 0) &&
|
||||
(wordIndex > 0 || indexInLine > 0) &&
|
||||
!(wordFormat && attachWithoutWhitespace(wordFormat)) &&
|
||||
!isPunctationCharacter(word)
|
||||
) {
|
||||
let insertWhitespace = true;
|
||||
if (lineIndex > 0 && wordIndex == 0) {
|
||||
if (indexInLine > 0 && wordIndex == 0) {
|
||||
const xDistance = lineItem.data['x'] - lastLineItem.data['x'] - lastLineItem.data['width'];
|
||||
if (xDistance < 2 && !lastLineItem.data['str']?.endsWith(' ') && !lineItem.data['str']?.startsWith(' ')) {
|
||||
insertWhitespace = false;
|
||||
@ -98,7 +103,7 @@ export function lineToText(lineItems: Item[], blockTypes: TextType[]) {
|
||||
text += word;
|
||||
}
|
||||
});
|
||||
if (openFormat && (lineIndex == lineItems.length - 1 || firstFormat(lineItems[lineIndex + 1]) !== openFormat)) {
|
||||
if (openFormat && (indexInLine == lineItems.length - 1 || firstFormat(lineItems[indexInLine + 1]) !== openFormat)) {
|
||||
closeFormat();
|
||||
}
|
||||
lastLineItem = lineItem;
|
||||
|
@ -138,3 +138,7 @@ export function majorityElement<T>(items: Item[], extract: (item: Item) => T): T
|
||||
}
|
||||
return extract(items[maj]);
|
||||
}
|
||||
|
||||
export function isGreaterWithTolerance(num1: number, num2: number, tolerance = 0.01) {
|
||||
return num1 - num2 > tolerance;
|
||||
}
|
||||
|
@ -3,7 +3,7 @@ import ItemResult from '../ItemResult';
|
||||
import ItemTransformer from './ItemTransformer';
|
||||
import TransformContext from './TransformContext';
|
||||
import LineItemMerger from '../debug/LineItemMerger';
|
||||
import { groupByBlock, groupByLine } from '../support/groupingUtils';
|
||||
import { groupByBlock, groupByLine, isGreaterWithTolerance } from '../support/groupingUtils';
|
||||
import { TextType, toBlockType } from '../text-types';
|
||||
import { isListItem, isNumberedListItem } from '../support/stringFunctions';
|
||||
|
||||
@ -40,7 +40,7 @@ export default class DetectListLevels extends ItemTransformer {
|
||||
const x = firstItem.data['x'];
|
||||
if (lastItemX) {
|
||||
if (isLineItem) {
|
||||
if (x > lastItemX) {
|
||||
if (isGreaterWithTolerance(x, lastItemX)) {
|
||||
currentLevel++;
|
||||
xByLevel[x] = currentLevel;
|
||||
} else if (x < lastItemX) {
|
||||
@ -54,10 +54,10 @@ export default class DetectListLevels extends ItemTransformer {
|
||||
xByLevel[x] = 0;
|
||||
}
|
||||
if (currentLevel > 0) {
|
||||
lineItems[0].data['str'] = ' '.repeat(currentLevel * 3) + lineItems[0].data['str'];
|
||||
lineItems[0].listLevel = currentLevel;
|
||||
modifiedBlock = true;
|
||||
if (isOverflowLine) {
|
||||
lineItems[0].data['str'] = ' ' + lineItems[0].data['str'];
|
||||
// TODO mark line so it can be indented as well ?
|
||||
}
|
||||
}
|
||||
if (!isOverflowLine) {
|
||||
|
Loading…
Reference in New Issue
Block a user